How to Increase the number of simultaneous/concurrent TCP connections?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

Issue

  • what are the steps to change and modify the maximum allowed TCP sessions on the server.

  • /var/log/messages states that packets are being dropped due to the limit being reached.

Resolution

  • It's possible to increase limit, but at a cost of more memory being used (how much per each connection would be possible to derive from looking at the structures used in the kernel code).

  • The current limit can be viewed in one of these files, the exact file can vary based on RHEL version.

For RHEL5

cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max

For RHEL6 and RHEL7

cat /proc/sys/net/netfilter/nf_conntrack_max
  • If the connections are legitimate the limit can be increased by echoing the number to the conntrack_max file as shown below:
cat 250000 >/proc/sys/net/netfilter/nf_conntrack_max
  • To make the changes permanent edit the /etc/sysctl.conf file and edit or add a line based on the location of the ip_conntrack_max file of the respective RHEL version.
net.netfilter.nf_conntrack_max = 250000

Diagnostic Steps

/var/log/messages shows that no of TCP connections has been exhausted and kernel is dropping packets.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

3 Comments

Thanks a lot for this nice tip. I'd like to see more tuning tips if possible

Thanks for the feedback, Bogdan. If you want to check out more performance tuning tips, you could browse by clicking on the "Performance tune" category at the bottom of the above article, or you could receive email notifications on all new performance tuning content by checking the appropriate box in the "Follow" tool to the right.

Rely cool. Thank a lot for the tips :).