Linux resource limitations can be categorized into system-level and kernel-level:
First: System-level limitations:
/etc/security/limits.conf
The limits.conf format is as follows:
username| @groupname Type Resource limit
username| @groupname: Sets the user name that needs to be restricted, the group name is preceded by the @ and the user name differs. You can also use the wildcard character * to restrict all users.
Type: Has Soft,hard and-,soft refers to the setting value that the current system is in effect for. Hard indicates the maximum value that can be set in the system. The soft limit cannot be higher than the hard limit. -The soft and hard values are also set.
Resource
Core-limits the size of the kernel file
Date-Maximum data size
Fsize-Maximum file size
Memlock-Maximum lock memory address space
Nofile-Maximum number of open files
RSS-Maximum Persistent setting size
Stack-Maximum stack size
CPU-Maximum CPU time in minutes
Noproc-Maximum number of processes
As-address space limitations
Maxlogins-Maximum number of logons allowed by this user
For the limits.conf file configuration to take effect, you must make sure that the pam_limits.so file is added to the startup file.
View/etc/pam.d/login file with: (not added)
Session required/lib/security/pam_limits.so
Attention:
A lot of people have set up limitc.conf no test, the test found not effective, most of the reasons are:
32-bit System session required/lib/security/pam_limits.so
64-bit System session required/lib64/security/pam_limits.so
Second: Apply software-level limitations:
This is more common, such as nginx in this piece is better
Third: Kernel-level limitations:
This is more, I slowly collect
Linux Resource Limit level rollup