The easiest way to manage CloudLinux limits is via the control panel interface (in WHM on cPanel servers, on the CloudLinux Manager page). However, as a server administrator, it is often quicker to use the command line, for example, if you need to quickly adjust a user’s limits or identify who is putting a strain on the server. This article requires root privileges and is therefore intended for those operating their own VPS or dedicated server.
You can read about the meaning of the various limits in the article on CloudLinux resource limits.
Checking limits
# A betöltött LVE-k és limitjeik (felhasználói azonosítóval)
lvectl list
# Ugyanez felhasználónévvel
lvectl list-user
# A betöltött LVE-k limitjei
lvectl limits
The limits are stored in the /etc/container/ve.cfg file. Do not edit this file manually; use the lvectl command or the control panel interface instead.
Setting limits
Setting a user’s limits:
lvectl set-user felhasznalo --speed=200% --pmem=2048m --io=4096 --iops=1024 --nproc=150 --maxEntryProcs=40
Key links:
| Switch | Limit | Example |
|---|---|---|
--speed |
CPU (100% = one core) | --speed=150% |
--pmem |
physical memory | --pmem=1024m |
--io |
Disk speed in KB/s | --io=4096 |
--iops |
disk operations per second | --iops=1024 |
--nproc |
number of processes | --nproc=100 |
--maxEntryProcs |
Concurrent connections (EP) | --maxEntryProcs=20 |
--unlimited |
All limits are unlimited |
The NPROC limit must be greater than the EP limit + 15, and the PMEM must not be less than 512 MB; otherwise, websites may not function correctly.
Changing the default limits (which apply to all users who do not have custom settings):
lvectl set default --speed=100% --pmem=1024m
Deleting a user’s individual limits, i.e. resetting them to their default values:
lvectl delete-user felhasznalo
Reapply the settings to all LVEs based on the configuration file:
lvectl apply all
For package-level limits, you can use the lvectl package-list and lvectl package-set commands. On cPanel servers, it is more convenient to set package limits in CloudLinux Manager, on the ‘Packages’ tab.
Identifying users causing high load
lveinfo, based on LVE statistics (lve-stats), shows who used how much during a given period:
# Az elmúlt nap legtöbb CPU-t használó 10 felhasználója
lveinfo --period=1d --order-by=aCPU --limit=10
# Akik az elmúlt napban bármelyik limitet elérték
lveinfo --period=1d --by-fault=any
# Akiknek az átlagos CPU-használata az elmúlt 24 órában a limit 80%-a fölött volt
lveinfo --period=24h --by-usage=cpu --percentage=80
The value of --period can be, for example, 5m, 4h, 2d, today or yesterday.
Real-time monitoring
# Futó LVE-k és erőforrás-használatuk, folyamatonként
lveps -p
# Folyamatosan frissülő nézet, a top parancshoz hasonlóan
lvetop
# Egy felhasználó aktuális LVE- és MySQL-használata JSON formátumban
cloudlinux-top --json -u felhasznalo
The lveps -p command shows which processes are running in a user’s LVE, thereby revealing which script or cron job is causing the load.
Checking the LVE kernel
If the commands return an error, check that the server is running a kernel that supports LVE and that the LVE kernel module has been loaded:
uname -r
lsmod | grep lve
The text lve must appear in the kernel name.