I was benchmarking my database the other day using mysqlslap, and I ran into a "Out of resources when opening file '/tmp/somefile' (Errcode: 24)" error.

I with a few click on google, I found a solution to a problem, which is to modify: "/etc/security/limits.conf" file, by adding: "mysql soft nofile 24000" and "mysql hard nofile 32000" lines. (REF.: http://www.smilecouple.org/2011/03/01/fix-out-of-resource-problem-with-mysqlhttp://www.smilecouple.org/2011/03/01/fix-out-of-resource-problem-with-mysql)

My question: What are the drawbacks of this solution ? I assume it is something to do with a security, and I got a feeling where it is, but maybe someone has some real-life experience on this ?


The primary drawback is to memory consumption if you are on a low memory machine and have a huge number of file handles open. Each of those file handles consumes a small amount of memory.

Nowadays, I wouldn't really worry about it. I'd just monitor it and adjust accordingly as needed.

If you're continuing to run out of file handles, you have something else going on that can't likely be resolved with the information presented so far.

Run lsof -u mysql | wc -l where 'mysql' is your mysqld system user.

  • Ok, I see. Cheers for answer. What could be the best way to monitor just how meny files you got an a time ? – Katafalkas Feb 3 '12 at 14:00
  • See edit above for open file count. – Magellan Feb 6 '12 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.