Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux --- process handle limit summary     - Linux System Getting Started Tutorial: permission to permanently modify the USB device in Linux (Linux)

- OpenGL Superb Learning Notes - Fragment Shader (Programming)

- The AWK use Cygwin tools mysql binlog log viewer (Database)

- Under CentOS Linux automatic backup MySQL database daily (Database)

- CentOS7 installed MySQL (Database)

- Sturdy build secure Linux server (Linux)

- Secondary exponential smoothing prediction method implemented in Python (Programming)

- Java implementation linear table - represents the order of representation and chain (Programming)

- socket busy poll of Linux kernel 3.11 to avoid sleep switch (Linux)

- Linux suffered SYN flood attack setting (Linux)

- Ubuntu 14.04 + xRDP + Xfce implement Windows Remote Desktop Connection (Linux)

- 10 Regulation of painless SQL Schema (Database)

- To install the latest version of Shotwell 0.18 under Ubuntu (Linux)

- RabbitMQ user roles and access control (Linux)

- Linux firewall settings instance (Linux)

- Oracle 10g New Features - Archive Compression (Database)

- Linux Fundamentals of the memory management mechanism (Linux)

- How to use Aptik to backup and restore Apps/PPAs under ubuntu (Linux)

- OpenSSL Introduction and compilation steps on Windows, Linux, Mac systems (Linux)

- CentOS7 installed VMware 10 (Linux)

  Linux --- process handle limit summary
  Add Date : 2018-11-21      
  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.


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


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


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.


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.


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.
- Java memory analysis tool uses detailed MAT (Programming)
- 20 Linux commands interview questions and answers (Linux)
- To setup Cocos2dx project under Ubuntu (Linux)
- C ++ Supplements - Virtual Function Principle (Programming)
- Fedora 20, Fedora 19, CentOS 6 and RHEL6 users how to install Wine 1.7.15 (Linux)
- Android Service service applications and the phone SMS Listener Listener (Programming)
- Oracle TDE transparent data encryption (Database)
- Implement firewall function on a closed Linux machine (Linux)
- Installation of Python2.7.8 and iPython under CentOS6.5 (Linux)
- AngularJS application unit testing started (Programming)
- Simple to install Tor browser to Ubuntu 14.04 and Linux Mint 17 (Linux)
- Github Getting Started Basic Course (Linux)
- Install Visual Studio Code in Ubuntu (Linux)
- How to Install Foreman under Ubuntu (Server)
- AngularJS notes --- Data Binding (Programming)
- Debian (Wheezy) Install Java environment / replace OpenJDK as the SUN JDK (Linux)
- HDFS Hadoop Distributed File System Works (Server)
- Ubuntu Learning Advanced article - to teach you to further enhance system security (Linux)
- PostgreSQL query result area is removed and precision (Database)
- Using IntelliJ IDEA Import Spark Spark latest source code and compile the source code (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.