Increasing the number of file handles on Linux computers

Most Rational® products use more file handles per process. Increase the number of file handles to more than the default value of 1024 for best product performance. A system administrator might need to make this change.

Before you begin

Important: If you do not do the following steps correctly, your computer will not start when you reboot.

About this task

To increase the number of file handles on Linux:

Procedure

  1. Log in as root. You must have root access to perform this procedure.
  2. Change to the etc directory.
    Attention: If you decide to increase the number of file handles in the next step, do not leave an empty init script file on your computer. If you do, your computer will not start when you reboot.
  3. Use the vi editor to edit the initscript file in the etc directory. If this file does not exist, type vi initscript to create it.
  4. On the first line, type ulimit -n 4096. The point is that 4096 is significantly larger than 1024, the default on most Linux computers.
    Important: Do not set the number of handles too high, because doing so can negatively impact system-wide performance.
  5. On the second line, type eval exec "$4".
  6. Save and close the file after making sure you have completed steps 4 and 5.
  7. Optional: Restrict the number of handles that are available to users or groups by modifying the limits.conf file in the etc/security directory. Both SUSE Linux Enterprise Server (SLES) Version 9 and Red Hat Enterprise Linux 4 have this file by default. If you do not have this file, then try using a smaller number in step 4 of the previous procedure (for example, 2048) to limit the number of open files that are allowed per process. If you set a high number in step 4 and you do not establish limits in the limits.conf file, computer performance can be significantly reduced.
    The following sample limits.conf file restricts all users, and then sets different limits for others afterwards. This sample assumes that you set handles to 8192 in step 4.

    *      soft nofile 1024
    *      hard nofile 2048
    root    soft nofile 4096
    root    hard nofile 8192
    user1   soft nofile 2048
    user1 hard nofile 2048

    Note that the * in the preceding example sets the limits for all users first. These limits are lower than the limits that follow it. The root user has a higher number of allowable handles open, while number available to user1 is between the two. Make sure that you read and understand the documentation contained in the limits.conf file before making changes.

Feedback