Increasing the number of file handles on Linux workstations

About this task

Important: For best results, increase the number of file handles available for HCL OneTest UI, because it uses more than the default limit of 1024 file handles per process. (A system administrator might need to make this change.)

Exercise caution when following these steps to increase your file descriptors on Linux®. Failure to follow the instructions correctly might result in a computer that will not start correctly. For best results, have your system administrator perform this procedure.

Procedure

  1. Log in as root. If you do not have root access you will need to obtain it before continuing.
  2. Change to the etc directory
  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.

    Important: If you decide to increase the number of file handles, do not leave an empty initscript file on your computer. If you do so, your machine will not start up the next time that you turn it on or restart.

  4. On the first line, type ulimit -n 4096 (the key here is that the number is significantly larger than 1024, the default on most Linux computers). Caution: do not set this too high, because it can seriously impact system-wide performance.
  5. On the second line, type eval exec "$4".
  6. Save and close the file after making sure you have done steps 4 and 5.
    Note: Ensure you have followed the steps correctly, as not doing this correctly will result in a machine that does not boot.
  7. Optional: Restrict your 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, you might consider a smaller number in step 4 above (for example, 2048). You need to do this so that most users have a reasonably low limit on the number of allowable open files per process. If you used a relatively low number in step 4, it is less important to do this. However, if you choose to set a high number in step 4, refraining from establishing limits in the limits.conf file can seriously impact computer performance.

    The following is a sample limits.conf file that restricts all users and then sets different limits for others afterwards. This sample assumes you set descriptors to 8192 in step 4 earlier.

    *      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 example above 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 descriptors open, while user1 is in between the two. Make sure you read and understand the documentation contained within the limits.conf file before making your modifications.

What to do next

For more information on the ulimit command, refer to the man page for ulimit.