|
Many online posts that influence has been that Unix, Linux under a single process opens a handle cap number is 65535 and can not exceed this value, most recently from the Internet, another description in SUSE, RedHat have tested that can support a single process 100 million or more handles.
About file system handles several restrictions from big to small arrangement:
/ Proc / sys / fs / nr_open
The total number of system file system supports file handle limit, the default value 1048576 (1M), Linux2.6.25 began to increase the kernel parameter is used to replace the kernel macro NR_OPEN (1048576), the upper limit value is limited by system memory.
In linux 2.26.32 platform to perform "man 5 proc" do not see the "/ proc / sys / fs / nr_open", only to see NR_OPEN parameter limits the / proc / sys / fs / file-max.
/ Proc / sys / fs / file-max
The total number of file system supports file systems handle maximum must be less than / proc / sys / fs / nr_open or NR_OPEN, increases the value must be synchronized modify / proc / sys / fs / inode-max = 4 * / proc / sys / fs / file-max.
ulimit -Hn
Handles single process hard limit, the default value of 1024, can not be greater than / proc / sys / fs / file-max, modification method is not much to say.
ulimit -Hn
Soft cap the number of handles a single process, the default value of 1024 can not exceed "ulimit -Hn" hard cap modification method is not much to say.
FD_SETSIZE
Linux environment a C language macro definition in /usr/include/bits/typesize.h or defined, the default value of 1024, so far, I can only confirm that the macro definition of the limits FD_SET (), file FD_CLR () operation description character values, guess should be a limit earlier version of Linux legacy. Now select () operation has been eliminated, the macro definition should also useless. If you want to use select () series of operations can be defined in gcc when compiling the macro "-DFD_SETSIZE = 65535".
Manually modify the operating system handle, modify the configuration according to the following table:
operating system
See handle several methods
Modify handles several methods
Linux
ulimit -Sn
--- Check the soft limit for the number of handles
ulimit -Hn
--- Check the number of handles hard limit
Check /etc/security/limits.conf file, modify or add the following configuration:
* Hard nofile 65536
* Soft nofile 65535
Add the following configuration file in /etc/pam.d/su,/etc/pam.d/xdm,/etc/pam.d/login:
session required pam_limits.so
HP
kctune -q maxfiles
--- Check the soft limit for the number of handles
kctune -q maxfiles_lim
--- Check the number of handles hard limit
Run Review:
kctune maxfiles> = XXX
XXX range [32, maxfiles_lim] in the range, maxfiles_lim the [] 32,1048576, but greater than 65535, some older versions of the file functions are not compatible.
After maxfiles modification, you must restart the operating system to take effect.
Aix
ulimit -Sn
--- Check the soft limit for the number of handles
ulimit -Hn
--- Check the number of handles hard limit
Check the / etc / security / limits file, and add to modify the following configuration:
nofiles = -1
nofiles_hard = -1
In AIX6 test verification: Even configured ulimited, a single process can only open 65535 handle.
Solaris
ulimit -Sn
--- Check the soft limit for the number of handles
ulimit -Hn
--- Check the number of handles hard limit
Check the / etc / system file, and add modify the following configuration:
rlim_fd_max = 65535
rlim_fd_cur = 65535
After modification, you need to reboot to take effect. |
|
|
|