Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP sending is bursty #386

Closed
mpitt opened this issue Mar 21, 2016 · 8 comments
Closed

UDP sending is bursty #386

mpitt opened this issue Mar 21, 2016 · 8 comments
Assignees

Comments

@mpitt
Copy link

mpitt commented Mar 21, 2016

I found this issue while debugging some strange packet loss happening over UDP with a bandwidth setting (-b) much lower than the link/path capacity. I was working under the assumption that using the -b flag would result in a nice constant-bitrate traffic, but this turned out to be wrong.

Some plots to show why. These are packet captures from the sender, as seen through Wireshark IO graph module, with a granularity of 0.01 s.

iperf-server
The first plot shows the behaviour of iperf2 (-u -b 30M). The sending rate is quite stable over the whole test. The receiver reports a 30 Mbit/s achieved throughput, with ~0 packet loss.

iperf3-server
Next, we have iperf3 (-u -b 30M -l 1470, the packet size is set in order to avoid IP fragmentation). We see a very bursty sending rate. Note the Y-axis max, which is 1 order of magnitude bigger than the previous plot. In this case, I observe a 20-25% packet loss, with an according reduction in achieved throughput, as a router in the middle starts dropping packets.

iperf3-server-small
Finally, I started fiddling with the send buffer (-w). This last plot shows iperf 3 with -u -b 30M -l 1470 -w 14700 (the send buffer takes 10 packets). Maybe it's hard to see from the plot, but the send rate smooths out quite a bit, coming closer to a 50/50 duty cycle. The peaks are also lower (~105 vs. ~360). The most interesting observation: with this settings packet loss disappears.

I don't know if this burstiness is desired behaviour, but I have some objections to it:

@DeHackEd
Copy link

DeHackEd commented Apr 6, 2016

I have seen issues caused by this where a sender on a fast port (eg: gigabit) sending to a receiver on a slow port (eg: 100 megabits) will experience severe packet loss due to switch buffers being overloaded and packets dropped. Even with a setting of -b 20M -l 1200 the 100 megabit receiver will experience >75% packet loss.

iPerf version 2 did not have this issue.

@skydevil56
Copy link

I have the same problem. Please fix it, because of this problem iperf3 can not be used for UDP tests :(

@folsson
Copy link

folsson commented Jun 28, 2016

The throttling algorithm seems to be working on 100ms intervals (https://github.com/esnet/iperf/blob/master/src/iperf_api.c#L1203).
Increasing the frequency of this check (i.e. lower 100000L to something like 1000L) seems to smooth out the bursts.
The reason why increasing the size of the send buffer (-w) somewhat mitigates this problem is (probably) because the buffer "absorbs" the burst (as it's is intended to do), but you never set it even close to the size needed to handle these kinds of spikes (when testing "high speed links").

@mpitt
Copy link
Author

mpitt commented Jul 5, 2016

Increasing the frequency of this check (i.e. lower 100000L to something like 1000L) seems to smooth out the bursts.

Good suggestion!

The reason why increasing the size of the send buffer (-w) somewhat mitigates this problem is (probably) because the buffer "absorbs" the burst

Actually, here the problem was mitigated by reducing the buffer size. The packets are not dropped at the sender, so increasing the buffer there wouldn't help. The drops occur at a crappy consumer grade router/access point in the path, which can't handle Gigabit traffic bursts. So reducing the buffer helps because packets are sent at a burst rate lower than the link speed (but the average rate still achieves the -b target).

One other possible solution is to put a shaping buffer (token bucket) between the server and this crappy router, and set it to a speed higher than -b but lower than Gigabit (300 Mb/s seems to satisfy my router).

@DeHackEd
Copy link

DeHackEd commented Jul 6, 2016

Actually even "high end" switches have this problem. I tested on a Juniper EX-2200 (office-class switch). The trend is that switching ASICs have small buffers which are already divided between all the ports for the QoS queues.

@bmah888
Copy link
Contributor

bmah888 commented Jul 6, 2016

If you are running iperf-3.1.3 or later or recent Linux, it can do fair-queue based flow control at the socket level, which should smooth out the bursts at the device driver level.

@mpitt
Copy link
Author

mpitt commented Jul 6, 2016

New test with latest master (099244e), enabling FQ scheduling and pacing.
(Note to future testers: remember to actually enable the scheduler tc qdisc add dev $ETH root fq)

Results look very similar to what I expected and to iperf2.
iperf3-fq

I still think we might want a solution for non-Linux systems though.

@bmah888
Copy link
Contributor

bmah888 commented Apr 14, 2017

We believe we have a fix for this in #460...currently on master but not (yet) in a release. Closing.

@bmah888 bmah888 closed this as completed Apr 14, 2017
@bmah888 bmah888 self-assigned this Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants