Cgroups - control groups (resource limits)
Cgroups allow you to allocate resources such as CPU, system memory, and disk I/O per user, group, or application. Using Cgroups and other limits we provide outside cgroups makes your server stable and prevents downtime.
Cgroups
Cgroups in combination with other tools provides the best stability for your server.
Working Process
Limit 100% is one CPU core fully used, all user processes are sharing this limit.
For example, two user processes will have a CPU power of 50% each.
Limit range: 1 ~ (Number of cores) x 100, example for 4 cores: 1~400.
Result: User websites might have a slower response if the user has higher demanding scripts.
RMEM (Real Memory RAM)
RAM limit in MB, the value of 1024 MB will limit shared RAM for the user to 1GB.
VMEM (Virtual Memory = RAM + swap)
Swap limit in MB, the value of 2048 MB will limit swap for the user to 2GB.
It’s recommended to have swap (VMEM) higher than RAM (RMEM).
Result: When the ram limit is reached system will kill the most memory demanding process.
In case of killed script webserver could return server error 5xx on the active process.
Set the limit in KB per second, you can monitor this limit with iotop.
Result: User websites might have a slower response if the user has higher demanding scripts.
We use also other Linux limit tools to allow an even more stable system per specific requirements.
- nproc (soft/hard limits)
- nofile (soft/hard limits)
- inode (soft/hard limits)
- cpulimit (available per command)