Chapter 13. Linux Settings for High Load Systems

Table of Contents

fs.file-max
net.ipv4.ip_local_port_range
TCP_keepalive
/etc/sysctl.conf
nofile
su and init script

Artur Hefczyc <artur.hefczyc@tigase.net> v2.0, June 2014: Reformatted for AsciiDoc. :toc: :numbered: :website: http://tigase.net :Date: 2010-04-06 21:18

There are a few basic settings you have to adjust for high load systems to make sure the server have enough resources to handle big number of network connections.

The main parameter is a maximum number of opened files allowed for the process to keep at the same time. Each network connection uses a file handler therefore if the limit is too low you can quickly run out of handlers and the server can not accept any more connections.

This limit is set on 2 levels - on the kernel level (fs.file-max) and on the system level (nofile).

Another kernel property which can be important in certain configurations (like transports installations or when you use proxy for Bosh connections) is: net.ipv4.ip_local_port_range. This parameter can be set the same way as the fs.file-max property.

fs.file-max

The fs.file-max kernel property is set via sysctl command. You can see current settings executing command:

# sysctl fs.file-max
fs.file-max = 358920

If you plan to run high load service with big number of server connections then this parameter should be at least as twice big as the number of network connections you expect to support. You can change this setting executing command:

# sysctl -w fs.file-max=360000
fs.file-max = 360000