esnet / iperf

iperf3: A TCP, UDP, and SCTP network bandwidth measurement tool
Other
6.93k stars 1.28k forks source link

Queries about Measurement Issues with iPerf3 in UDP Tests #1715

Closed Antonio-sudo-hash closed 4 months ago

Antonio-sudo-hash commented 5 months ago

I am currently conducting network performance tests using iPerf3 in an academic/research lab setting. I am reaching out because I have encountered some issues with UDP measurements that I find confusing and difficult to interpret. My tests have shown results that seem inconsistent, and I would like to better understand if these problems could be inherent to the tool or if there are adjustments I could make to obtain more accurate measurements.

davidBar-On commented 4 months ago

@Antonio-sudo-hash, can you explain what are the issues you encountered, what are the confusions, what seems to be inconsistent, etc?

Antonio-sudo-hash commented 4 months ago

When I perform UDP measurements, using iPerf3, I get confusing results in the sense that I get too high packet losses (when I use -b 0). Also, I get very uneven results when I run for example: -> iperf3 -c -u -b 0 -R Where I get Gbps values on the transmission of the server (positioned on Cloud), but on the reception of my client, positioned on my local network (LAN), it only picks up up to Mbps. On the other hand, when I run: -> iperf3 -c -R Through TCP, I get both the server's emission and the client's reception in Mbps, without reaching such high rates in one direction compared to the other. Even though TCP is supposed to transmit at the maximum possible capacity. Why is this? Is this a measurement error, or is it the intrinsic nature of the protocol used?

Antonio-sudo-hash commented 4 months ago

Likewise, with regard to the TCP protocol. Why do I get better performance, in terms of throughput, when I execute the command on a server located at a greater distance than on a closer server? Is it due to the network infrastructure where each server is installed?

davidBar-On commented 4 months ago

When I perform UDP measurements, using iPerf3, I get confusing results in the sense that I get too high packet losses ... Through TCP, I get both the server's emission and the client's reception in Mbps, without reaching such high rates in one direction ...

UDP is connectionless while TCP is connection-oriented (search "TCP vs UDP" on the internet to learn more about that). That is, TCP includes a mechanism to ensure that all packets arrived to the receiver. In general the sender is sending a limited number of packets and then wait for an ack from the receiver about receiving packets before sending some more packets, and so on. On the other hand, there is no such mechanism for UDP, so in principle, the sending rate is limited only by the sender's machine resources (CPU, etc.), regardless of the actual network throughput.

Therefore, with -b0 for UDP, when the sending rate is much higher than the network throughput, most of the packets will get lost, as in your case (the sender can send Gbps but the network throughput is only Mbps). This is why the iperf3 default is -b1M for UDP but -b0 for TCP.

Likewise, with regard to the TCP protocol. Why do I get better performance, in terms of throughput, when I execute the command on a server located at a greater distance than on a closer server? Is it due to the network infrastructure where each server is installed?

Probably this is the case, but it is hard to tell without knowing the structure of the network. That is, for each path between the client and a server, what network elements (routers, switches, etc.) are used, the performance of each network element, the throughput of the links between the network elements, the network traffic load, etc.