![iperf3 テスト帯域幅: TCP は UDP よりもはるかに遅い](https://rvso.com/image/782599/iperf3%20%E3%83%86%E3%82%B9%E3%83%88%E5%B8%AF%E5%9F%9F%E5%B9%85%3A%20TCP%20%E3%81%AF%20UDP%20%E3%82%88%E3%82%8A%E3%82%82%E3%81%AF%E3%82%8B%E3%81%8B%E3%81%AB%E9%81%85%E3%81%84.png)
ファイルサーバー用に使用しているサーバーの 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/秒が得られました。