Question

I was running into problem with too many open files with Tomcat7 on Ubuntu 12, so I increased the hard and soft limit on the number of open files from 4096 and 1024, respectively, to 16384. Now I'm not getting any more errors about open files, but overall CPU% seems to have risen. Does increasing the number of max files also have some cost in CPU time? If not, why not set the ulimit extremely high?

Was it helpful?

Solution

The entire reason ulimit exists is to protect the overall performance of the system by preventing a process from using up more resources than are "normal".

"Normal" can be different depending on what you are doing, but setting limits extremely high by default would defeat the purpose of ulimit and allow any process to use up ridiculous amounts of resources. On a server without users this is less critical than a big multiuser environment, but its still a useful safeguard against buggy or exploited processes.

Your CPU probably just went up because your computer is doing more work now instead of erroring out.

PS - You want to be sure there isn't something wrong in your tomcat environment too... it might be OK to have thousands of open files, I don't know your application, but that could also be a sign of something gone buggy. If it is, you just allowed the bug's effect to become potentially much worse :( If you can explain why tomcat needs thousands of files open, cool, but if not... yikes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top