ご注意下さい
この記事は3年以上前に書かれた記事ですので、内容が古い可能性があります。
今回はCentOS7.3のネットワーク周りのチューニングを実施し、お金を掛けないでスループットを上げましょう。
性能測定ツールの導入
まずは性能測定ツールですが、speedtest.netはWindowsでもよく利用させてもらっていますが、Linuxコマンドライン用のspeedtest.netもあるんです。まずはこれをインストールします。
# yum install python-setuptools
# easy_install speedtest-cli
# easy_install speedtest-cli
でインストールできます。
使い方は、単純にspeedtest-cliと打つだけでいいのですが、
# speedtest-cli
Retrieving speedtest.net configuration...
Testing from Asahi Net (218.45.184.224)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cordeos Corp. (Tokyo) [3.50 km]: 12.162 ms
Testing download speed................................................................................
Download: 281.61 Mbit/s
Testing upload speed....................................................................................................
Upload: 136.43 Mbit/s
#
Retrieving speedtest.net configuration...
Testing from Asahi Net (218.45.184.224)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cordeos Corp. (Tokyo) [3.50 km]: 12.162 ms
Testing download speed................................................................................
Download: 281.61 Mbit/s
Testing upload speed....................................................................................................
Upload: 136.43 Mbit/s
#
以外と速い…(笑)。
サーバーを指定することもできます。
# speedtest-cli --list | grep -i tokyo
6424) Cordeos Corp. (Tokyo, Japan) [3.50 km]
7510) ASEINet (Tokyo, Japan) [3.50 km]
#
# speedtest-cli --server 6424
Retrieving speedtest.net configuration...
Testing from Asahi Net (218.45.184.224)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cordeos Corp. (Tokyo) [3.50 km]: 14.251 ms
Testing download speed................................................................................
Download: 196.98 Mbit/s
Testing upload speed....................................................................................................
Upload: 143.64 Mbit/s
#
6424) Cordeos Corp. (Tokyo, Japan) [3.50 km]
7510) ASEINet (Tokyo, Japan) [3.50 km]
#
# speedtest-cli --server 6424
Retrieving speedtest.net configuration...
Testing from Asahi Net (218.45.184.224)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cordeos Corp. (Tokyo) [3.50 km]: 14.251 ms
Testing download speed................................................................................
Download: 196.98 Mbit/s
Testing upload speed....................................................................................................
Upload: 143.64 Mbit/s
#
もちろん--server 7510でも構いません。
tunedを使ったチューニング
ネットワーク周りのチューニングにはカーネルパラメーターを調整してチューニングするのもいいのですが、tuned(チューニングデーモン)を使ってチューニングしていきます。
tunedではプロファイルを指定することで手軽にチューニングが行えます。
まずはプロファイルの確認ですが、
# tuned-adm list
Available profiles:
- balanced - General non-specialized tuned profile
- desktop - Optmize for the desktop use-case
- latency-performance - Optimize for deterministic performance at the cost of increased power consumption
- network-latency - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
- network-throughput - Optimize for streaming network throughput. Generally only necessary on older CPUs or 40G+ networks.
- powersave - Optimize for low power consumption
- throughput-performance - Broadly applicable tuning that provides excellent performance across a variety of common server workloads. This is the default profile for RHEL7.
- virtual-guest - Optimize for running inside a virtual guest.
- virtual-host - Optimize for running KVM guests
Current active profile: virtual-guest
Available profiles:
- balanced - General non-specialized tuned profile
- desktop - Optmize for the desktop use-case
- latency-performance - Optimize for deterministic performance at the cost of increased power consumption
- network-latency - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
- network-throughput - Optimize for streaming network throughput. Generally only necessary on older CPUs or 40G+ networks.
- powersave - Optimize for low power consumption
- throughput-performance - Broadly applicable tuning that provides excellent performance across a variety of common server workloads. This is the default profile for RHEL7.
- virtual-guest - Optimize for running inside a virtual guest.
- virtual-host - Optimize for running KVM guests
Current active profile: virtual-guest
現在はvirtual-guestプロファイルが選択されていることが分かります。throughput-performanceプロファイルにしてみましょう。
# tuned-adm profile throughput-performance
speedtest-cliでスループットを測定してみます。
# speedtest-cli --server 6424
Retrieving speedtest.net configuration...
Testing from Asahi Net (218.45.184.224)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cordeos Corp. (Tokyo) [3.50 km]: 12.073 ms
Testing download speed................................................................................
Download: 295.40 Mbit/s
Testing upload speed....................................................................................................
Upload: 117.24 Mbit/s
#
Retrieving speedtest.net configuration...
Testing from Asahi Net (218.45.184.224)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cordeos Corp. (Tokyo) [3.50 km]: 12.073 ms
Testing download speed................................................................................
Download: 295.40 Mbit/s
Testing upload speed....................................................................................................
Upload: 117.24 Mbit/s
#
いきなり100Mbps弱もスループットが向上して驚きです。
これで一度様子を見てみることにします。