How do you tune Linux network settings for a high-traffic server?
IntermediateProductionPerformance, Cost & Scale
Answer
Raise net.core.somaxconn and net.ipv4.tcp_max_syn_backlog, widen ip_local_port_range, increase fs.file-max and ulimit -n, set net.core.rmem_max/wmem_max and tcp_rmem/tcp_wmem for high BDP links, enable tcp_tw_reuse for outbound-heavy clients, and use BBR where appropriate.
sysctl -w net.core.somaxconn=4096 net.ipv4.tcp_max_syn_backlog=8192
sysctl -w net.ipv4.ip_local_port_range="10240 65000"
Change one thing at a time and measure; copy-pasted sysctl lists often hurt.
More on Performance, Cost & Scale
How do you reduce cross-AZ data transfer costs?IntermediateWhat are the main drivers of AWS network cost and how do you control each?IntermediateHow do you find what is driving a surprise NAT gateway bill?AdvancedHow do you reach 100k+ concurrent connections on one proxy?AdvancedHow do you choose instance types for network-heavy workloads on AWS?IntermediateWhat is a placement group and when does it matter for networking?Intermediate