Modify the maximum number of file handles in linux

Source: Internet
Author: User
The limit on the maximum number of file handles for linux is sufficient for general applications (such as Apache and system processes. However, how to process a large number of requests by a single process such as squid, mysql, and java is a little stretched. If the number of file handles opened by a single process exceeds the limit for modifying the maximum number of file handles in linux, 1024 is sufficient for general applications (such as Apache and system processes. However, how to process a large number of requests by a single process such as squid, mysql, and java is a little stretched. If the number of file handles opened by a single process exceeds the value defined by the system, the "too program files open" error message will be mentioned. How many file handles are opened by the current process? The following small script can help you view it: 1 lsof-n | awk '{print $2}' | sort | uniq-c | sort-nr | more: 1) ulimit-n 65535 is valid in the current session. the default value is restored after the user exits or the system restarts. 2) modify the profile File: add the following to the profile file: ulimit-n 65535 is valid only for one user. 3) modify the File:/etc/security/limits. conf, add it to the File: (effective immediately-the ulimit-a command is not displayed in the current session) [html] * soft nofile 32768 # limit the maximum number of file handles of a single process (when this limit is reached, the system will trigger an alarm) * hard nofile 65536 # limit the maximum number of file handles of a single process (the system reports an error when this limit is reached) 4) modify the File:/etc/sysctl. conf. Add: [html] fs. file-max = 655350 # limit the maximum number of file handles in the system. run the command:/sbin/sysctl-p to make the configuration take effect.
Related Article

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.