MySQL file limit. Error Out of resources

MySQLresources

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 ?

Best Answer

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.