Modify Ubuntuulimit limits

Source: Internet
Author: User

Modify Ubuntuulimit limits
Modify Ubuntu ulimit restrictions

Recently, the CPU usage has soared to 100% during peak periods, but the memory, I/O, network and other operations are normal. After Google, it may be a problem with ulimit, view the file handle limit now
Ulimit-n
The result is: 1024. This value is small for services in production.
Most of the solutions provided on the Internet are directly input
Ulimit-SHn 51200 #51200 can be adjusted by Application
This method has obvious disadvantages. Once you log out, the setting becomes invalid.
It is also said that the command is directly written to/etc/rc. d/rc. local. Today, a correct method is found.
1. Open/etc/security/limits. conf, which has detailed comments, and find the following settings (insert if not)
* Soft nofile 51200
* Hard nofile 51200
2. edit/etc/pam. d/common-session and add a line.
Session required pam_limits.so
3. edit/etc/profile and add
Ulimit-SHn 51200
Restart the server and log on again. Check the number of handles. The value is set to 51200 correctly.
If you encounter a similar situation, check whether the file handle count is too small.

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.