# swap memory (not real memory) 調整到 8g dd if=/dev/zero of=/backup/swapfile.img bs=8192 count=1048576 mkswap -f /backup/swapfile.img chmod 0600 /backup/swapfile.img swapon /backup/swapfile.img # /etc/fstab 加入 echo '/backup/swapfile.img swap swap defaults 0 0' >> /etc/fstab
# MaxRequestsPerChild 從 4000 調為 2000 減少子程序佔用
# 讓 out of memory 機率降低 sysctl -w vm.panic_on_oom=1 # out of memory,預設 0 sysctl -w vm.overcommit_memory=1 # out of memory,預設 0 sysctl -w vm.overcommit_ratio=0 # out of memory,預設 50
# 降低連線程序佔用 sysctl -w net.ipv4.tcp_syncookies=1 # time wait,防止 syn flood,預設 1 sysctl -w net.ipv4.tcp_tw_reuse=1 # time wait,允許將 time-wait sockets重新用於新的tcp連線上,預設 0 sysctl -w net.ipv4.tcp_tw_recycle=1 # time wait,允許快速回收,預設為0 sysctl -w net.ipv4.tcp_fin_timeout=30 # time wait,timeout 時間,預設 60
留言