0

Using this simple command:

iperf3 -c localhost --time 1 -l 100 --bitrate 100M 

Then watching the output with:

sudo tcpdump -i lo -B 10000000 tcp port 5201 

I would expect to see lots of 100 byte packets coming down the line, but instead I see things like this (flitering out ACK packets, etc):

05:40:18.722627 IP [...]: Flags [P.], seq 12447838:12449238, ack 1, win 64240, options [...], length 1400 05:40:18.722644 IP [...]: Flags [P.], seq 12450738:12450838, ack 1, win 64240, options [...], length 100 05:40:18.722655 IP [...]: Flags [P.], seq 12450838:12452038, ack 1, win 64240, options [...], length 1200 05:40:18.723647 IP [...]: Flags [P.], seq 12452038:12452138, ack 1, win 64240, options [...], length 100 

We have two as expected 100 byte packets, but also another two packets where 14 and 12 messages have been batched up. Why is there batching, and is there any way to turn it off on Ubuntu 22.04?

(Note, log abbreviated to fit length on screen without scrolling: the first [...] is localhost.43286 > localhost.5201 and the second is [nop,nop,TS val 838423036 ecr 838423036].)

1 Answer 1

2

1500 bytes is a common MTU size. That's why you are seeing packets up to that size.

This iperf issue mentions discusses the behavior of -l https://github.com/esnet/iperf/issues/1094

The TCP protocol is bytestream-oriented...it doesn't preserve the size of messages sent. So if you use the -l parameter, that will control the size of messages sent by iperf3, but TCP might combine multiple sends into a larger packet or it might break a large send into multiple smaller packets. Usually TCP will try to send the largest packets it can on the network.

You can try using the -M flag to tell TCP not to send packets of larger than a given size, although some prior experience with this option has shown it to be unreliable.

1
  • 1
    That's what I suspected, so it's good to get an official-ish explanation. I'm going to end up writing my own traffic generator as for my current benchmarking needs I'm interested in regularly-sized payloads only; the headers are just noise and iperf3 doesn't include them in its bandwidth calculations. Commented Nov 9, 2023 at 5:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.