Friday, 8 March 2013

Persisting changes to FileHandles with ulimit



You can check your user limits using the ulimit -a command, which will display the currently configured limits for your user account.

One of the values your are most likely to need to tweak when building large scalable systems is the number of files you can hold open at any one time, which impacts such things as concurrent sessions or TCP sockets.

You can temporaraly override your ulimit parameters for the duration of your session (assuming you have permissions) using the command:

ulimit -n 2048

But when you next login, you will find your modification has reverted to defaults. To ensure your change is persisted, you need to update the values stored in:
/etc/security/limits.conf

Make sure you add BOTH a hard and soft limit, as setting one has no effect without the other!
in the case of root, you could use the following:

root      hard     nofiles    8092
root      soft     nofiles    4096

No comments:

Post a Comment