Skip to content

Instantly share code, notes, and snippets.

@behrad
Forked from maxp/linux-tcp.txt
Last active March 1, 2020 10:04
Show Gist options
  • Save behrad/c95ce4dbd87c5ed23e8b to your computer and use it in GitHub Desktop.
Save behrad/c95ce4dbd87c5ed23e8b to your computer and use it in GitHub Desktop.
Put these in /etc/sysctl.conf then run sysctl -p to apply them.
fs.file-max = 999999
fs.nr_open = 1000000
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.optmem_max = 25165824
net.core.somaxconn = 65000
net.core.netdev_max_backlog = 100000
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.tcp_max_syn_backlog = 100000
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.ip_local_port_range = 10000 65535
net.netfilter.nf_conntrack_max = 1048576
net.ipv4.netfilter.ip_conntrack_max = 1048576
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 30
vm.min_free_kbytes = 65536
vm.swappiness = 0
vm.overcommit_memory = 1
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
# General gigabit tuning:
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_mem = 50576 64768 98152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment