Maximum number of opened file descriptors in Linux

Source: Internet
Author: User

Linux Maximum number of open file descriptors 1. maximum number of opened file descriptors in the system:/proc/sys/fs/file-maxa. view $ cat/proc/sys/fs/file-max1864052. set. temporary # echo 1000000>/proc/sys/fs/file-max2. permanent: in/etc/sysctl. set fs. file-max = 1000000 2. maximum number of opened file descriptors of a process: soft limita of nofile in user limit. view $ ulimit-n17000002. set. temporary: Use ulimit-Sn to set soft limit for the maximum number of open file descriptors. Note that soft limit cannot be greater than hard limit (ulimit-Hn can view hard limit ), in addition, the default value of ulimit-n is soft limit, but ulimit-n 18000. If the value is 00, both soft limit and hard limit are set. For non-root users, only hard limit smaller than the original one can be set. View hard limit: $ ulimit-Hn1700000 and set soft limit, which must be smaller than hard limit: $ ulimit-Sn 16000002. permanent: the above method is only temporary. If you log out and log on again, it becomes invalid. You cannot increase hard limit. You can only modify soft limit within the hard limit range. To make the modification permanently valid, you must go to/etc/security/limits. set in conf (root permission required). You can add the following two lines to indicate that the soft limit of the maximum number of opened file descriptors in chanon is 1800000, and the hard limit is 2000000. The following settings take effect after logging out again: chanon soft nofile 1800000 chanon hard nofile 2000000 sets hard limit for nofile. Note that hard limit cannot be greater than/proc/sys/fs/nr_open. If hard limit is greater than nr_open, you cannot log on normally after logging out. You can modify the value of nr_open: # echo 2000000>/proc/sys/fs/nr_open 3. view the number of open file descriptors used by the current system [root @ localhost bin] # cat/proc/sys/fs/file-nr5664 0 186405 where the first number indicates the open file descriptor allocated by the current system number, the second number is released after the allocation (no longer used currently), and the third number is equal to file-max. 4. conclusion:. the number of file descriptors opened by all processes cannot exceed/proc/sys/fs/file-maxb. the number of file descriptors opened by a single process cannot exceed the soft limitc of nofile in user limit. the soft limit of nofile cannot exceed its hard limitd. nofile hard limit cannot exceed/proc/sys/fs/nr_open

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.