Maximum open files (file-max) is not sufficient with new installs

This one is really strange and I just don't find where Virtualmin was configuring this earlier and not now anymore... :

On a virtualmin Pro installation that we installed a year ago, we have a comfortable setting:

cat /proc/sys/fs/file-max


But on new installs made a few weeks back we had this:

cat /proc/sys/fs/file-max


Rather very insufficient open files maximum (taking in account mysql open files requirements for smoothly running cached databases)...

We have manually set it higher after last boot, but still don't find where Virtualmin did set that value earlier, and why it's so small (maybe default Ubuntu value) now ?

Any hints on what's virtualmin's recommended way to fix this issue so that the value is higher (even dynamically computed with available memory as seems to be the case on older installs, but with same 8.04LTS up-to-date release) would be welcome :-) ?

Also looks like there is a bug in virtualmin Pro setup that doesn't raise that value ;-) ?



Joe's picture
Submitted by Joe on Sat, 12/19/2009 - 16:04 Pro Licensee

I don't think we ever touch the proc file-max value. It'd be something set by your OS; and 8192 is pretty standard across all Linux distros, I think (I guess it is the standard Linux kernel default).

Most folks don't run into problems with the default, but it sounds like you have a pretty hard-working system, so if you're seeing problems, I guess you might need to alter it; though 181044 sounds like tremendous overkill. I don't think I've ever met a system that needed more than 16k, maybe 32k, for this setting.

Anyway, there is usually a file in /etc for setting the proc values. On Red Hat-based systems it is /etc/security/limits.conf and files in /etc/security/limits.d/. I dunno off-hand what it is on Ubuntu.

Virtualmin never touches this setting, but you can change the default by editing /etc/sysctl.conf and adding the line :

fs.file-max = 181044

Which will be applied when you reboot.

Thanks Jamie and Joe, That's also what i saw in man pages. Didn't find any such settings in those files, even grepped in /etc on the other servers, didn't find anything, but noticed that same xen server started with less memory had less available files open max, so it looks like there is some smart code somewhere adapting files. Still searching for it...

Our server is not overcrowded or busy, but it's fast because it's optimized to have a fast mysql access with comfortable caching, not always opening and closing tables all the time like lots of server do, and that makes the number of open files triple of open mysql tables, exceeding quickly 8192 open files...