System Administration
Showing results for 
Search instead for 
Did you mean: 

Guide on maxfiles and maxfiles_lim kernel value

Go to solution

Guide on maxfiles and maxfiles_lim kernel value

Hi Gurus , I have a question . Is there any guideline on modifying maxfiles and maxfiles_lim parameter value ? Based on HP document , it stated that maxfiles is a soft limit whilst maxfiles_lim is the hard limit . If let say , I'm planning to set my softlimit (maxfiles) as 4096 , could you suggest what is the best value that I could plan for the maxfiles_lim ? Thanks a lot in advance for the input .
Pete Randall
Outstanding Contributor

Re: Guide on maxfiles and maxfiles_lim kernel value

You can be generous with these settings. All they do is reserve space for a table in the kernel. In today's large memory systems, a few extra bytes in the kernel really isn't critical.


James R. Ferguson
Acclaimed Contributor

Re: Guide on maxfiles and maxfiles_lim kernel value


The values you choose are wholly dependent on your environment's needs. I would have a look at the manpages for their usual wealth of information:

Look too at 'ulimit' here:



Michael Steele_2
Honored Contributor

Re: Guide on maxfiles and maxfiles_lim kernel value


Here is a sampling from around the forum. As you can see there is a wide range. I would 'sar -v 5 5' > /home/user/openfiles.txt into a 20 min cron for a week to get a better idea. Also, if you are using an application like Oracle or Java, they should be making these recommendations.

maxfiles 256 - 256
maxfiles_lim 2048 Y 2048

For machine with java these are values I usually put:
maxfiles 2048
maxfiles_lim 2176

maxfiles 512 - 512
maxfiles_lim 1536 Y 1536

Also I would like to understand the impact of following confing
maxfiles_lim = 2048
maxfile = 10240
Support Fatherhood - Stop Family Law
Bill Hassell
Honored Contributor

Re: Guide on maxfiles and maxfiles_lim kernel value

The sole purpose for the maxfiles parameters is to prevent a bad program from using all the file slots in the kernel table. NOTE: MAXFILES refers to each program's number of open files at the same time). If you have no programmers or script writers on your system, then you set the soft value (MAXFILES) to 4096, a value that is quite large. This should cover 99% of your applications.

If some program requires a larger number of files to be opened at the same time, the the program should recognize that opening 10000 files at the same is probably unusual and the program should call setrlimit to extend the MAXFILES value to a bit more than 10000. If MAXFILES_LIM = 15000 then the program runs without a problem. Another way to do this is to run the program with a profile that sets ulimit -n 10100 to allow 10100 files to be opened.

NOTE: MAXFILES/MAXFILES_LIM do not modify NFILE which is the maximum number of files open at the same time for the entire system. NFILE counts ordinary files as well as device files (disks, tapes, ptys) and network sockets. Usr sar -v 1 to see if the totan number of files and the maximum are getting close, then adjust NFILE accordingly.

Bill Hassell, sysadmin

Re: Guide on maxfiles and maxfiles_lim kernel value

Gurus , Many thanks for the comprehensive opinions .