内容へ移動
fl8 Wiki
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
現在位置:
Dokuwiki.fl8.jp
»
01_linux
»
09_ベンチマーク
»
05 Linuxチューニング
トレース:
01_linux:09_ベンチマーク:05_tuning_linux
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== 05 Linuxチューニング ====== ===== ディスクIO ===== ==== ①.午前四時の高負荷(Cron) ==== mlocate, makewhatis のCronを停止する。 <code> chmod 0 /etc/cron.daily/mlocate.cron chmod 0 /etc/cron.daily/makewhatis.cron chmod 0 /etc/cron.weekly/makewhatis.cron </code> ==== ②.Swap ==== [[01_linux:99_その他:02_swappiness]] <code> # echo 1 > /proc/sys/vm/swappiness </code> ==== ③.IOキューサイズ変更 ==== ディスクIOのキューサイズは低いほどレスポンス重視、高いほどスループット重視 <code> # echo 1024 > /sys/block/ディスクデバイス名/queue/nr_requests # echo 128 > /sys/block/ディスクデバイス名/queue/nr_requests </code> ==== ④.IOスケジューラ ==== [[http://city.hokkai.or.jp/~hachikun/IOScheduler.html]] <code> # echo deadline > /sys/block/ディスクデバイス名/queue/scheduler # echo noop > /sys/block/ディスクデバイス名/queue/scheduler </code> ==== read_ahead_kb ==== <code> # echo 4096 > /sys/block/ディスクデバイス名/queue/read_ahead_kb </code> ==== dm-*デバイス ==== dm-*デバイスは設定を反映せずにsd*から設定を継承します。 <code> It is expected behavior that you only see the settings take effect for the sd* devices. The dm-* devices will not reflect the change directly but will inherit it from the sd* devices that make up its path. </code> ==== ⑤.noatime ==== [[01_linux:09_ベンチマーク:31_noatime]] ==== ⑥.Writebackの設定 ==== [[http://portaltan.hatenablog.com/entry/2015/10/15/145823]] === vm.dirty_background_ratio === メモリ上のdirtyメモリが占める割合(%)。 この値を超えるとpdflushが呼び出され、write back処理がが行われる。 但し、このwrite back処理は優先度の低いバックグラウンドプロセスとして実行される。 デフォルト値は10%。単位は% <code> # sysctl vm.dirty_background_ratio vm.dirty_background_ratio = 10 </code> === vm.dirty_ratio === vm.dirty_backgroup_ratioとほぼ同じだが、この値を超えた場合は、write back処理が優先度の高いフォアグラウンドプロセスとして実行される デフォルト値は20%。単位は% <code> # sysctl vm.dirty_ratio vm.dirty_ratio = 20 </code> === vm.dirty_expire_centisecs === メモリ上に存在しているdirtyメモリの存在時間。 この値を過ぎた場合にwrite back処理が実行される デフォルト値は3000(30秒)単位は1/100秒 <code> # sysctl vm.dirty_expire_centisecs vm.dirty_expire_centisecs = 3000 </code> === vm.dirty_writeback_centisecs === pdflushデーモンが起動する間隔。 この間隔でdirtyメモリのデータが物理ディスクに書き込まれる デフォルト値は500(5秒)。単位は1/100秒 <code> # sysctl vm.dirty_writeback_centisecs vm.dirty_writeback_centisecs = 500 </code> ===== ネットワーク ===== ==== ①.sysctl.confに下記を追加 ==== <code> #net.ipv4.tcp_syncookies net.ipv4.tcp_syncookies = 1 # net.ipv4.tcp_window_scaling net.ipv4.tcp_window_scaling = 1 # net.core.rmem_max net.core.rmem_max = 16777216 # net.core.wmem_max net.core.wmem_max = 16777216 # net.ipv4.tcp_rmem net.ipv4.tcp_rmem = 4096 87380 16777216 # net.ipv4.tcp_wmem net.ipv4.tcp_wmem = 4096 87380 16777216 # net.ipv4.tcp_no_metrics_save net.ipv4.tcp_no_metrics_save = 1 # net.ipv4.tcp_moderate_rcvbuf net.ipv4.tcp_moderate_rcvbuf = 1 # net.core.netdev_max_backlog net.core.netdev_max_backlog = 5000 #net.core.somaxconn net.core.somaxconn = 4096 vm.swappiness = 1 </code> === New === https://pleiades.ucsc.edu/hyades/Linux_Network_Tuning <code> # http://fasterdata.es.net/host-tuning/linux/ # allow testing with buffers up to 128MB net.core.rmem_max = 134217728 net.core.wmem_max = 134217728 # increase Linux autotuning TCP buffer limit to 128MB net.ipv4.tcp_rmem = 4096 87380 67108864 net.ipv4.tcp_wmem = 4096 65536 67108864 # increase the length of the processor input queue net.core.netdev_max_backlog = 250000 # recommended default congestion control is cubic net.ipv4.tcp_congestion_control=cubic # recommended for hosts with jumbo frames enabled net.ipv4.tcp_mtu_probing=1 vm.swappiness = 1 </code> <code> /sbin/ifconfig eth0 txqueuelen 10000 /sbin/ifconfig eth1 txqueuelen 10000 </code> txqueuelenは、送信パケットのキューの長さです。OSによって違いがあるとは思いますが一般的にはMTU x txqueuelenの値がキューに保持可能なパケットのサイズ どこかで作ったパケットを送信するために一度パケットを並ばせる場所 == 反映 == <code> # sysctl -p </code> ==== ②.NICのオフロード機能を無効 ==== <code> for file in `ls /etc/sysconfig/network-scripts/ifcfg-eth[0-9]` do ETH=`echo $file| sed 's/.*\(eth[0-9]\)/\1/g'` ethtool -K $ETH rx off ethtool -K $ETH tx off ethtool -K $ETH tso off ethtool -K $ETH gro off done </code> === CentOS6 === CentOS6 ではなら TSO on / GSO off が良さそう。 [[http://uzy-exe.hateblo.jp/entry/2014/05/10/144824]] <code> for file in `ls /etc/sysconfig/network-scripts/ifcfg-eth[0-9]` do ETH=`echo $file| sed 's/.*\(eth[0-9]\)/\1/g'` ethtool -K $ETH tso on ethtool -K $ETH gro off ifconfig $ETH txqueuelen 10000 done </code> ===== tuned ===== コマンド一個で簡単にチューニングできるツール [[01_linux:09_ベンチマーク:tuned]] {{tag>ベンチマーク}}
01_linux/09_ベンチマーク/05_tuning_linux.txt
· 最終更新: 2022/03/01 09:13 by
matsui
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ