Modify linux file descriptor

Source: Internet
Author: User
Article Title: Modify the linux file descriptor. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

By default, the file descriptor in linux is 1024. For squid and other services, this file descriptor is far from enough in the case of heavy load, therefore, it is necessary to modify the file descriptor. in linux, there are two ways to modify the file descriptor.

1. Use the ulimit command to modify

// Display the current file descriptor

Ulimit-n

// Modify the file descriptor of the current user environment to 65536

Ulimit-HSn 65536

Disadvantages of using the ulimit command:

1. You can only modify the file descriptor of the currently logged-on user environment. If this user opens another connection, the file descriptor of this connection environment remains unchanged.

2. if the system is restarted, previous changes will not take effect.

2. Modify the limits. conf file

Edit the/etc/security/limits. conf file and add the following two lines at the end.

* Soft nofile 65536

* Hard nofile 65536

Save and exit. You do not need to restart the server. Log On again and use ulimit-n to see the effect.

In this way, no matter which user is used, no matter whether or not the restart is performed.

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.