Increasing the number of file handles on Linux workstations

For best product performance, increase the number of file handles above the default of 1024 handles.

Before you begin

Make sure that you have root access. You might need to be an administrator to change the file handle limit.

About this task

Important: Before you work with your product, increase the number of file handles. Most IBM® Rational® products use more than the default limit of 1024 file handles for each process.

Be careful when you increase your file descriptors on Linux. If you do not follow the instructions correctly, your computer might not start correctly.

Procedure

  1. Log in as root.
  2. Change to the etc directory.
    Attention: If you increase the number of file handles in the next step, do not leave an empty initscript file on your computer. If you do so, your computer will not start after you turn it off.
  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. Set the limit to 4096: on the first line, type ulimit -n 4096.
    Important: Do not set the number of handles too high, because doing so can negatively affect system-wide performance.
  5. On the second line, type eval exec "$4".
  6. Make sure that you have completed steps 4 and 5; then, save and close the file.
    Note: Be sure to follow the steps correctly. If this procedure is not completed correctly, your computer will not start.
  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 Version 4.0 have this file by default. If you do not have this file, consider using a smaller number in step 4, for example, 2048. By using a smaller number, most users will have a reasonably low limit on the number of open files that are allowed for each process. If you use a relatively low number in step 4, it is less important to modify the limits.conf file. However, if you set a high number in step 4 and you do not establish limits in the limits.conf file, computer performance can be reduced.

Example

The following sample limits.conf file restricts all users, and then sets different limits for others. In this sample, the handles were set to 8192.

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

The asterisk (*) in the example sets the limits for all users first. These limits are lower than the limits that follow. The root user has a higher number of allowable handles open, while number available to user1 is between the higher and lower numbers. Before you change the limits.conf file, make sure that you read and understand the documentation contained in that file.

Feedback