Setting open file limits
Last modified: 09/01/2016

NOTICE: Any setting you make to change default kernel limits and/or
user limits must be implemented with caution. All changes should be
thoroughly tested on development servers whenever possible. If you are
not careful when adjusting default limits you can render your server
inoperable.

In RHEL6/CENTOS6 and RHEL7/CENTOS7 the default number of file,
including sockets, is 1024. For load balancer applications with a high
volume of connections you will need to increase the default value.

For RHEL7/CENTOS7, the global ulimit for nofiles is ignored for
systemd services. The nofile limit is now set in the service file:

# more /etc/systemd/system/drlb_server.service

[Service]
LimitNOFILE=65535

For RHEL7/CENTOS7 runtime testing you can change the nofile limit for
a process using the prlimit command:

# ps -ef | grep drlb_server | grep -v grep
# prlimit --pid [pid] --nofile=32767:65535

For RHEL6/CENTOS6, you can increase the max number of open files by
increasing the ulimit value:

# vi /etc/security/limits.d/nofile.conf

*    soft    nofile 32767
*    hard    nofile 65535

This change will require a reboot.

For RHEL6/CENTOS6 runtime testing you can manually set the nofile
limits and start the DRLB server the same shell:

# ulimit -n 32767
# ulimit -H -n 65535

To check the file limits for the DRLB process(es):

# pids=$(ps -ef | grep drlb_server | grep -v grep | awk '{ print $2 }')
# for p in $pids; do cat /proc/$p/limits | grep -i file; done

The Max open files setting should match your ulimit settings for soft
and hard limits. To see how many files the process(es) have open:

# for p in $pids; do ls -l --color=none /proc/$p/fd; done

