Skip to content

Instantly share code, notes, and snippets.

@xwiz
Forked from chetth/sysctl.conf
Created February 11, 2023 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xwiz/5eced5436cb69af33759b8effc29c34f to your computer and use it in GitHub Desktop.
Save xwiz/5eced5436cb69af33759b8effc29c34f to your computer and use it in GitHub Desktop.
TCP stack tuning for high traffic server.
net.ipv4.ip_forward=0
net.ipv4.tcp_fin_timeout = 60
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_syn_retries = 5
kernel.sem = 250 32000 100 128
kernel.shmall = 209715200
kernel.shmmax = 214748364800
kernel.shmmni = 4096
fs.file-max = 1000000
vm.swappiness = 0
vm.vfs_cache_pressure = 50
net.ipv4.tcp_fin_timeout = 3
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_max_syn_backlog = 8192
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.somaxconn = 8192
vm.min_free_kbytes = 65536
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_mem = 786432 1048576 1572864
kernel.pid_max = 65536
net.ipv6.conf.all.disable_ipv6=1
net.ipv4.tcp_syncookies = 0
#net.bridge.bridge-nf-call-iptables = 0
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_max_syn_backlog = 3240000
# increase socket listen backlog
net.core.somaxconn = 3240000
net.ipv4.tcp_max_tw_buckets = 1440000
# Increase TCP buffer sizes
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_congestion_control = cubic
#----- Debian/Ubuntu -----------------
#net.bridge.bridge-nf-call-iptables = 0
#net.netfilter.nf_conntrack_max=204800
#------ CentOS -----------------------
net.nf_conntrack_max = 204800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment