"Go" Linux View the number of file handles opened by the process

Source: Internet
Author: User

---View the default maximum number of file handles, the system defaults to 1024

# Ulimit-n

1024

----See how many handles the current process has opened

# Lsof-n|awk ' {print $} ' |sort|uniq-c|sort-nr|more

131 24204

57 24244

57 24231 .....

Where the first column is the number of open handles and the second column is the process ID.

You can view the process name based on the ID number.

# PS Aef|grep 24204

Nginx 24204 24162 99 16:15? 00:24:25/usr/local/nginx/sbin/nginx-s

Linux has hard limits and soft limits. These two parameters can be set by Ulimit. To do this, run the following command as the root user:

# ULIMIT-HSN 4096

In the above command, h specifies the hard size, s specifies the soft size, and n indicates the maximum number of open file handles that are set for a single process. Personally think it's best not to exceed 4096, after all, the more open file handle number of response time will certainly be slower. When the number of handles is set, the default value is restored after the system restarts. If you want to save it permanently, you can modify the. bash_profile file, and you can modify the/etc/profile to add the above command to the last.

Transferred from: http://blog.csdn.net/lastsweetop/article/details/6440136

"Go" Linux View the number of file handles opened by the process

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.