CloudLinux Resource Limit
Cloudlinux is a platform that has ability of managing resources and users in order to preserve other users resources on server. You can simply manage your server resources by using these simple commands according to your needs.
To find user id
[root@pcname~]# grep “—user—” /etc/passwduser:x:11333:503::/var/www/vhosts/ user.com:/bin/false
then use this id set the resources to user
lvectl command helps to control and set our users resource limit for example
Give 1GB physical and virtual memory to specific lve user
[root@pcname~]# lvectl set $ID –pmem=1G [root@pcname~]# lvectl set $ID –vmem=1G
Assign CPU to specific lve user
[root@pcname~]# lvectl set $ID –speed=100% (set 1 CPU to lve user)
Give a specific LVE access to 4 CPU cores
[root@pcname~]# lvectl set $ID –speed=400%
Control the iops limit
[root@pcname~]# lvectl set $ID –iops=1024
See specific user’s limits
[root@pcname~]# lvectl limits $LVE-ID (show this id’s limits)ID SPEED NCPU PMEM VMEM EP NPROC IO IOPS
$ID 100 16 1.0G 2.0G 25 0 1024 1024
See all users’ limits
[root@pcname~]# lvectl limits all (list all user)
ID SPEED NCPU PMEM VMEM EP NPROC IO IOPS
10222 100 24 256.0M 256.0M 20 50 100 1024
10223 100 24 256.0M 256.0M 20 50 100 1024
10224 100 24 256.0M 256.0M 20 50 100 1024
10226 100 24 256.0M 256.0M 20 50 100 1024
10227 100 24 2.0G 2.0G 20 50 100 1024
10228 100 24 256.0M 256.0M 20 50 100 1024
List User with user name
[root@pcname]# lvectl list-userID SPEED NCPU PMEM VMEM EP NPROC IO IOPS
kockarsogutma 100 24 256.0M 256.0M 20 50 100 1024
ankaratrade 100 24 256.0M 256.0M 20 50 100 1024
borekevi 100 24 256.0M 256.0M 20 50 100 1024
isildakmensucat 100 24 256.0M 256.0M 20 50 100 1024
You can find the default value of resources for lve in /etc/container/ve.cfg
[root@pcname]#cat /etc/container/ve.cfg
You see the output like this;
<defaults>
<cpu limit=”10″/>
<ncpu limit=”1″/>
<io limit=”100″/>
<vmem limit=”0″/>
<pmem limit=”65536″/>
<nproc limit=”50″/>
<other maxentryprocs=”20″/>
<mem limit=”65536″/>
<iops limit=”1024″/>
</defaults>
<enter-by-name/>
<lve id=”495″>
<mem limit=”262144″/>
<pmem limit=”262144″/>
</lve>
<lve id=”11476″>
<mem limit=”262144″/>
<pmem limit=”262144″/>
</lve>
You can set the default value of resources
[root@pcname]# lvectl set default –cpu=25 –pmem=256m
After run this command default value of resources in ve.cfg
[root@pcname]#cat /etc/container/ve.cfg<defaults>
<cpu limit=”25″/>
<ncpu limit=”1″/>
<io limit=”100″/>
<vmem limit=”0″/>
<pmem limit=”256″/>
<nproc limit=”50″/>
<other maxentryprocs=”20″/>
<mem limit=”65536″/>
<iops limit=”1024″/>
</defaults>
Set the default value of resources for all user
[root@pcname]# lvectl apply all
Set the default value of resources for specific user
[root@pcname]# lvectl apply $ID