When running my application I sometimes get an error about too many files open.
Running ulimit -a reports that the limit is 1024. How do I increase the limit above 1024?
Edit
ulimit -n 2048 results in a permission error.
Join Stack Overflow to learn, share knowledge, and build your career.
|
When running my application I sometimes get an error about Running Edit
|
|||||
closed as off topic by casperOne Aug 17 '12 at 2:01Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||
|
|||||
|
You could always try doing a Each operating system has a different hard limit setup in a configuration file. For instance, the hard open file limit on Solaris can be set on boot from /etc/system.
On OS X, this same data must be set in /etc/sysctl.conf.
Under Linux, these settings are often in /etc/security/limits.conf. There are two kinds of limits:
Soft limits could be set by any user while hard limits are changeable only by root. Limits are a property of a process. They are inherited when a child process is created so system-wide limits should be set during the system initialization in init scripts and user limits should be set during user login for example by using pam_limits. There are often defaults set when the machine boots. So, even though you may reset your ulimit in an individual shell, you may find that it resets back to the previous value on reboot. You may want to grep your boot scripts for the existence ulimit commands if you want to change the default. |
|||||||||||||||||||||
|
|
If you are using Linux and you got the permission error, you will need to raise the allowed limit in the For example to allow anyone on the machine to raise their number of open files up to 10000 add the line to the
Then logout and relogin to your system and you should be able to do:
without a permission error. |
|||||||||||||||||||||
|
|
1) Add the following line to
then login as webuser
2) Edit following two files for webuser append .bashrc and .bash_profile file by running
3) Log out, then log back in and verify that the changes have been made correctly:
Thats it and them boom, boom boom. |
|||||||||
|
|
If some of your services are balking into ulimits, it's sometimes easier to put appropriate commands into service's init-script. For example, when Apache is reporting
Try to put |
||||
|
|