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.