Maximizing Linux TCP Connections

To maximize Linux TCP Connections use following:

In /etc/sysctl.conf:

net.ipv4.tcp_fin_timeout = 5
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65001

# 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

To maximize maximum open files in Linux, you need this in /etc/security/limits.conf:

USER soft nofile 1000000
USER hard nofile 1000000

Where USER is the username, to raise limits for all users:

* soft nofile 1000000
* hard nofile 1000000

 

Leave a Reply

Your email address will not be published. Required fields are marked *