iperf3 テスト帯域幅: TCP は UDP よりもはるかに遅い

iperf3 テスト帯域幅: TCP は UDP よりもはるかに遅い

ファイルサーバー用に使用しているサーバーの 1 つが、nginx 経由で約 7 Mbits/秒という非常に遅い速度でファイルを送信している理由を調べようとしています。

私は、Debian 11 上のサーバー間の転送速度をテストするために iperf3 を使用しています。

  • フランス語サーブ:$ iperf3 -s
  • CanadianServ : $ iperf3 -c 195.154.xxx.xxx -P 1 -t 10 -b 1G// 1 つの接続を使用して 10 秒で 1 GB のデータを送信しようとします

TCP 経由のこのテストでは、次の結果が得られます。

Connecting to host 195.154.xxx.xxx, port 5201
[  5] local 142.44.xxx.xxx port 60610 connected to 195.154.xxx.xxx port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  1.04 MBytes  8.69 Mbits/sec    0    125 KBytes       
[  5]   1.00-2.00   sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
[  5]   2.00-3.00   sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
[  5]   3.00-4.00   sec   640 KBytes  5.24 Mbits/sec    0    125 KBytes       
[  5]   4.00-5.00   sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
[  5]   5.00-6.00   sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
[  5]   6.00-7.00   sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
[  5]   7.00-8.00   sec   640 KBytes  5.24 Mbits/sec    0    125 KBytes       
[  5]   8.00-9.00   sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
[  5]   9.00-10.00  sec   768 KBytes  6.29 Mbits/sec    0    125 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  7.54 MBytes  6.32 Mbits/sec    0             sender
[  5]   0.00-10.09  sec  7.08 MBytes  5.89 Mbits/sec                  receiver

iperf Done.

非常に遅いので、接続をスタックして帯域幅を高速化することもできますが、1 つの接続を維持したいと思います。

現在、UDP 経由でテストしています。

  • カナダサーブ:$ iperf3 -c 195.154.xxx.xxx -P 1 -t 10 -b 1G -u

出力は次のようになります:

Connecting to host 195.154.xxx.xxx, port 5201
[  5] local 142.44.xxx.xxx port 37350 connected to 195.154.xxx.xxx port 5201
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec   113 MBytes   950 Mbits/sec  81331  
[  5]   1.00-2.00   sec   114 MBytes   955 Mbits/sec  81773  
[  5]   2.00-3.00   sec   114 MBytes   956 Mbits/sec  81887  
[  5]   3.00-4.00   sec   114 MBytes   957 Mbits/sec  81904  
[  5]   4.00-5.00   sec   114 MBytes   956 Mbits/sec  81862  
[  5]   5.00-6.00   sec   114 MBytes   957 Mbits/sec  81913  
[  5]   6.00-7.00   sec   114 MBytes   957 Mbits/sec  81909  
[  5]   7.00-8.00   sec   114 MBytes   957 Mbits/sec  81915  
[  5]   8.00-9.00   sec   114 MBytes   956 Mbits/sec  81880  
[  5]   9.00-10.00  sec   114 MBytes   957 Mbits/sec  81904  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec  1.11 GBytes   956 Mbits/sec  0.000 ms  0/818278 (0%)  sender
[  5]   0.00-10.41  sec   600 MBytes   484 Mbits/sec  0.029 ms  387089/818278 (47%)  receiver

iperf Done.

UDP の実際の帯域幅は最大で約 500 Mbits/秒ですが、両方のサーバーのネットワーク インターフェイスを考慮すると、これはまったく問題ありません。

TCP 転送でより多くの帯域幅を使用するにはどうすればよいでしょうか? ローカル コンピューターで試してみたところ、TCP 転送で約 30 Mbits/秒が得られました。

答え1

サーバー構成で解決策が見つかりました。TCPウィンドウは、標準のApache構成で推奨されているように無効になっていました(ここで説明

$ vi /etc/sysctl.conf

# Set this value and save
net.ipv4.tcp_window_scaling = 1

# check with
$ sysctl -p

ここで、TCPウィンドウの値を調整する必要があります。ここまたはここ

関連情報