Skip to content

Instantly share code, notes, and snippets.

@toritori0318
Created October 16, 2014 17:43
Show Gist options
  • Save toritori0318/2565dab2d802aab98b66 to your computer and use it in GitHub Desktop.
Save toritori0318/2565dab2d802aab98b66 to your computer and use it in GitHub Desktop.
sysctlメモ
# カーネルパニックで再起動する
kernel.panic = 10
# tcp
# net.ipv4.tcp_tw_recycle = 1 # LB以下で使うと副作用あり?/でもtimestamp=0で指定すれば問題なさそう?
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 5
# ソケットあたりのメモリチューニング
# データ受信バッファ サイズ
net.ipv4.tcp_rmem = 16384 131072 262144
# データ送信バッファ サイズ
net.ipv4.tcp_wmem = 16384 131072 262144
net.ipv4.tcp_mem = 2048000 4096000 4096000
# OSレベルの接続キューの最大長。
# listen()関数の第二引数"backlog"から溢れた接続要求をキューとして格納する長さ
# ※http://d.hatena.ne.jp/tetsuyai/20111220/1324466655
# ※http://dsas.blog.klab.org/archives/51977201.html
net.core.somaxconn = 10240
# 送信した接続要求のうち、まだ接続先からACKを受けっ取っていないものを記憶する最大長
net.ipv4.tcp_max_syn_backlog = 10240
# システムが同時に保持する time-wait ソケットの最大数
net.ipv4.tcp_max_tw_buckets = 360000
# ポート範囲変更
net.ipv4.ip_local_port_range = 1024 65535
# CLOSE_WAITを減らす対策
net.ipv4.tcp_keepalive_time = 15
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 4
# NAT/SB対策
net.ipv4.tcp_timestamps = 0
# SYN flood攻撃対策
net.ipv4.tcp_syncookies = 1
# ファイルディスクリプタ数
fs.file-max=300000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment