quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Extremely lower throughput/sec compared with TCP #1414

Closed Kiddinglife closed 2 years ago

Kiddinglife commented 2 years ago

Hey, I ran the bulk via this command: cargo run --bin bulk --release on my top model Macbook Pro 2021.

Client 0 stats:
Overall download stats:

Transferred 1073741824 bytes on 1 streams in 10.16s (100.78 MiB/s)

Stream download metrics:

      │  Throughput   │ Duration 
──────┼───────────────┼──────────
 AVG  │  100.78 MiB/s │  10.16s
 P0   │  100.75 MiB/s │    10.16s
 P10  │  100.81 MiB/s │    10.17s
 P50  │  100.81 MiB/s │    10.17s
 P90  │  100.81 MiB/s │    10.17s
 P100 │  100.81 MiB/s │    10.17s

however, the iperf3 shows me around 6GB/sec throughput with TCP.

iperf3 -s -p 8999
-----------------------------------------------------------
Server listening on 8999 (test #1)
-----------------------------------------------------------
Accepted connection from ::1, port 64124
[  5] local ::1 port 8999 connected to ::1 port 64125
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  6.80 GBytes  58.4 Gbits/sec                  
[  5]   1.00-2.00   sec  6.06 GBytes  52.1 Gbits/sec                  
[  5]   2.00-3.00   sec  6.69 GBytes  57.4 Gbits/sec                  
[  5]   3.00-4.00   sec  6.54 GBytes  56.2 Gbits/sec                  
[  5]   4.00-5.00   sec  6.30 GBytes  54.1 Gbits/sec                  
[  5]   5.00-6.00   sec  6.01 GBytes  51.6 Gbits/sec                  
[  5]   6.00-7.00   sec  5.86 GBytes  50.3 Gbits/sec                  
[  5]   7.00-8.00   sec  6.39 GBytes  54.9 Gbits/sec                  
[  5]   7.00-8.00   sec  6.39 GBytes  54.9 Gbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-8.00   sec  52.0 GBytes  55.8 Gbits/sec                  receiver

iperf3 -c localhost -p 8999 -f M
Connecting to host localhost, port 8999
[  7] local ::1 port 64125 connected to ::1 port 8999
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-1.00   sec  6.80 GBytes  6963 MBytes/sec                  
[  7]   1.00-2.00   sec  6.06 GBytes  6206 MBytes/sec                  
[  7]   2.00-3.00   sec  6.69 GBytes  6845 MBytes/sec                  
[  7]   3.00-4.00   sec  6.54 GBytes  6702 MBytes/sec                  
[  7]   4.00-5.00   sec  6.30 GBytes  6448 MBytes/sec                  
[  7]   5.00-6.00   sec  6.01 GBytes  6149 MBytes/sec                  
[  7]   6.00-7.00   sec  5.86 GBytes  6002 MBytes/sec                  
[  7]   7.00-8.00   sec  6.39 GBytes  6540 MBytes/sec                  
^C[  7]   8.00-8.20   sec  1.35 GBytes  6775 MBytes/sec  

TCP 6GB/sec is far faster than Quinn's 100MB/sec. Is there anything I didwrong here? Thx

Ralith commented 2 years ago

Two main things:

Kiddinglife commented 2 years ago

Two main things:

  • QUIC is encrypted. A fair comparison would be against TLS over TCP.
  • Quinn's MacOS backend is not as well optimized as it could be. You will see substantially better performance on Linux.

Yes. I used ubuntu 22.04 and it goes up tp around 700MB/sec.