1

I am measuring the tcp and udp throughput by iperf3. I run iperf3 in virtual machines, one as server and the other as client. The VMs are connecting via 10 Gbps link. The results show that tcp get much higher throughput than udp. However, as we know TCP runs more algorithms and computation and it has three-way handshaking also, so why udp throughtput is less that tcp?is it something related to the buffer size of tcp and udp? below are result of tcp and udp measurements. It is apparent that iperf sends more data for tcp rather than udp in a specific time, but why?

TCP: 8.88 Gbps

[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   922 MBytes  7.73 Gbits/sec    1   3.04 MBytes       
[  4]   1.00-2.00   sec  1.04 GBytes  8.92 Gbits/sec    0   3.04 MBytes       
[  4]   2.00-3.00   sec  1.07 GBytes  9.15 Gbits/sec    0   3.04 MBytes       
[  4]   3.00-4.00   sec  1.05 GBytes  8.99 Gbits/sec    0   3.04 MBytes       
[  4]   4.00-5.00   sec  1.04 GBytes  8.91 Gbits/sec   80   2.17 MBytes       
[  4]   5.00-6.00   sec  1.04 GBytes  8.91 Gbits/sec    0   2.35 MBytes       
[  4]   6.00-7.00   sec  1.04 GBytes  8.98 Gbits/sec    0   2.54 MBytes       
[  4]   7.00-8.00   sec  1.01 GBytes  8.69 Gbits/sec  176   1.88 MBytes       
[  4]   8.00-9.00   sec  1.04 GBytes  8.97 Gbits/sec  208   1.42 MBytes       
[  4]   9.00-10.00  sec  1.02 GBytes  8.80 Gbits/sec    0   1.48 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  10.3 GBytes  8.80 Gbits/sec  465             sender
[  4]

UDP: 3.26 Gbps, packet length is default 8Kbytes

iperf3 -c "server address" -u -b 0


[  4] local 145.100.132.197 port 58375 connected to 145.100.132.34 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec   375 MBytes  3.15 Gbits/sec  48035  
[  4]   1.00-2.00   sec   394 MBytes  3.31 Gbits/sec  50457  
[  4]   2.00-3.00   sec   352 MBytes  2.94 Gbits/sec  45114  
[  4]   3.00-4.00   sec   391 MBytes  3.30 Gbits/sec  50092  
[  4]   4.00-5.00   sec   403 MBytes  3.38 Gbits/sec  51566  
[  4]   5.00-6.00   sec   403 MBytes  3.38 Gbits/sec  51599  
[  4]   6.00-7.00   sec   418 MBytes  3.51 Gbits/sec  53493  
[  4]   7.00-8.00   sec   372 MBytes  3.12 Gbits/sec  47651  
[  4]   8.00-9.00   sec   444 MBytes  3.73 Gbits/sec  56892  
[  4]   9.00-10.00  sec   399 MBytes  3.34 Gbits/sec  51033  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec  3.86 GBytes  3.32 Gbits/sec  0.020 ms  354384/505931 (70%) 

according to the packet length the throughput in udp is calculated based on the packets which are sent, regardless of the recieved ones!

2
  • 2
    The 57% percent lost UDP datagrams would be a logical explanation for having less than half the throughput of TCP ...
    – HBruijn
    Oct 15, 2019 at 15:41
  • Thanks, I also noticed that, but why do we have UDP packet loss, as everything in the network is the same for udp and tcp?
    – sarah sh
    Oct 15, 2019 at 15:42

2 Answers 2

5

TCP includes congestion control. It will limit traffic to prevent packet loss. UDP just sends all of the packets you request and hopes for the best.

https://www.geeksforgeeks.org/tcp-congestion-control/

2
  • I understand we have packet loss in udp, but why? because the link is 10Gbps and no other traffic is on the link, so I think the link is not congested!
    – sarah sh
    Oct 16, 2019 at 7:17
  • 1
    Switches and cards have finite buffer sizes.
    – stark
    Oct 16, 2019 at 14:06
1

Even cheap hardware these days can exceed 10 Gb, especially with traffic generators like iperf. Buffers quickly fill up when link bandwith is exceeded, resulting in drops. No congestion control for UDP means it will keep sending packets through already saturated interfaces, which ruins goodput.

This is like a road half-clogged with crashes of speeding maniacs, with zero traffic management, and complaining that it doesn't hit the theoretical peak cars per hour.

Limit iperf's bandwith. TCP's 8.8 Gb is probably realistic, but let's be optimistic and try for Ethernet theoretical maximum: iperf -u -b 9750M

1
  • Thanks John, I tried udp with -b 9750M, but the result is the same!
    – sarah sh
    Oct 16, 2019 at 15:41

Not the answer you're looking for? Browse other questions tagged .