Skip to content

Instantly share code, notes, and snippets.

@maxp
Created December 2, 2010 09:56
Show Gist options
  • Save maxp/725054 to your computer and use it in GitHub Desktop.
Save maxp/725054 to your computer and use it in GitHub Desktop.
Tuning the Linux Kernel for many tcp connections
Put these in /etc/sysctl.conf then run sysctl -p to apply them.
# General gigabit tuning:
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_syncookies = 1
# this gives the kernel more memory for tcp
# which you need with many (100k+) open socket connections
net.ipv4.tcp_mem = 50576 64768 98152
net.core.netdev_max_backlog = 2500
# if masquerading used
net.ipv4.netfilter.ip_conntrack_max = 1048576
# one million connections
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_rmem = 4096 16384 33554432
net.ipv4.tcp_wmem = 4096 16384 33554432
net.ipv4.tcp_mem = 786432 1048576 26777216
net.ipv4.tcp_max_tw_buckets = 360000
net.core.netdev_max_backlog = 2500
vm.min_free_kbytes = 65536
vm.swappiness = 0
net.ipv4.ip_local_port_range = 1024 65535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment