Vps – “Too many open files in system” on VPS with LSOF far from MAXFILES

fileslsofvps

Good day.

Lately my VPS server (CentOS on it) started crushing with "Too many open files in system" error. I read many on the error and know that the limit is set by my hosting provider. I received a list of limits from host provider and they say that the limit is 12000 files.

I tried looking for the problem using lsof utility. When the problem occured I managed to find those responces of lsof stat:

[root@XXXXXXXX]# lsof | wc -l 
3895

sometimes it went up to 4300 or so, but I never saw it jumping higher then this.

The question is stated like this: Can the lsof utility show not complete results, or is it the host's problem? If it;s lsof than what can I alternatively use to get maximum accuracy of the number.

Best Answer

You can monitor /proc/sys/fs/file-nr with the tool of your choice, the most simple being cat /proc/sys/fs/file-nr - the first number shows the allocated file handles, the second one the allocated but unused filehandles, and the last number shows the maximum number of file handles.

That information is provided by the kernel itself.