Skip to main content

3-4: Set open file limits

Ubuntu and other UNIX-like systems have a ulimit shell command that's used to set resource limits for users. One of the limits that can set is the number of open files a user is allowed to have. Pocket nodes will have a lot of files open at times. So we'll need to increase the default ulimit for the user account pocket runs under.

Increasing the ulimit

Before increasing the ulimit, you can check the current ulimit. To do that, run the following command:

ulimit -n

Now let's increase the ulimit to 16384 with the following command:

ulimit -Sn 16384

Note: The -Sn option is for setting the soft limit on the number of open files.

Finally, let's check the new ulimit:

ulimit -n

Note: The -n option is for getting the limit for just the number of open files.

Permanent settings

Using the above method for setting the ulimit will only keep the change in effect for the current session. To permanently set the ulimit, you can do the following:

  1. Open the /etc/security/limits.conf file.

    sudo nano /etc/security/limits.conf
  2. Add the following line to the bottom of the file:

    pocket           soft    nofile          16384
  3. Save and exit.