Tuning Linux Open Files

Linux

NOTES:
a. This section is required only for Linux Operating Systems. Skip this chapter in case the Operating system is Solaris or Windows.
b. The tuning mentioned in this chapter needs to be performed on all application servers.
c. This needs to be performed by the system administrator or root user.
d. In case the hard limit value is already set to a higher value than 65535 (on all the application servers), this chapter might be skipped.

Linux open files limits the number of file descriptors that any one process may open; the default limits are 1024 per process. These limits can prevent optimum performance of applications. For few high usage applications ulimit needs to be increased to a higher value say 65535.
The open file limit is one of the limits that can be tuned with the ulimit command. The command ulimit -aS displays the current limit, and ulimit -aH displays the hard limit (above which the limit cannot be increased without tuning kernel parameters in /proc).
The following is an example of the output of ulimit -aH. You can see that the current shell (and its children) is restricted to 1024 open file descriptors.

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16252
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Increasing The File Descriptor Limit
The file descriptor limit can be increased using the following procedure:
1. Edit /etc/security/limits.conf and add the lines:

* soft nofile <1024 or 65536>
* hard nofile 65536

2. Edit /etc/pam.d/login, adding the line:
session required /lib/security/pam_limits.so

3. The system file descriptor limit is set in /proc/sys/fs/file-max. The following command will increase the limit to 65536:
echo 65536 > /proc/sys/fs/file-max

4. Make sure open files (-n) is 65536 by typing the following command:
ulimit –aH

5. Log out and log in again for the changes take effect.
Increasing the File Descriptor Limit in WebSphere App Server:

navigate to WAS_ROOT/WebSphere/AppServer/profiles/AppSrv01/bin and open setupCmdLine.sh file in vi editor.
Search for “ulimit” and change the value to 65536 and uncomment the line.
Need to restart the server once ulimit set to 65536 to make the changes take effect.
Verification
Type in prompt

ulimit –aH

Ensure that open files (-n) is 65536.

Usually question comes as “what is the default open file limit for WebSphere?”

Its actually same as the systems file descriptor limit(ulimit -aH) till the point you set your own ulimit value in setupCmdLine.sh of WAS server.

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.