Linux – Sysctl config for high performance, large activity

debianlinuxsysctlweb-server

We have some server with a huge amount of visitors (every minute, every day). Basically we had a nice fine-tuned sysctl config for this purpose. (If you don't modify it, it starts to behave strangely).

I'd like to ask the community if you could provide me one which.. well.. optimized for this purpose. Like maximizing open file limits and so on. That's what I meant.

Best Answer

define large activity? large number of files open? large files being transferred? lots of slow clients? This is taken off a machine that runs nginx serving 900+mb/sec of 120k or smaller images on a Quad Core Xeon 2.4. The settings on a server that does streaming content are much different. Each machine config is different based on the requirements. Blindly implementing these could make your performance better or worse.

fs/file-max=60000
fs/dir-notify-enable=0

net/ipv4/tcp_keepalive_time=600
net/core/rmem_max=262143
net/core/rmem_default=262143
net/core/wmem_max=262143
net/core/wmem_default=262143
net/ipv4/tcp_sack=0
net/ipv4/tcp_timestamps=0

net/nf_conntrack_max=262143
net/ipv4/tcp_frto=0

net.ipv4.tcp_sack=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_wmem = 4096 65536 4194304
net.ipv4.tcp_rmem = 4096 87380 4194304

net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_tw_recycle = 1
net.core.wmem_max = 16777216
net.core.rmem_max = 16777216
net.core.wmem_default = 16777216
net.core.rmem_default = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144

net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2

While the information on this page is somewhat old, much of it still applies:

http://www.acc.umu.se/~maswan/linux-netperf.txt www.ibm.com/developerworks/linux/library/l-hisock.html slaptijack.com/system-administration/linux-tcp-performance-tuning/