Managing LVE limits via the command line (lvectl, lveinfo, lveps) Print

  • cloudlinux, szerver üzemeltetés, monitorozás
  • 0

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

# Loaded LVEs and their limits (by user ID)
lvectl list

# The same by user name
lvectl list-user

# Limits of the loaded LVEs
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:

# The 10 users with the highest CPU usage in the past day
lveinfo --period=1d --order-by=aCPU --limit=10

# Users who hit any limit in the past day
lveinfo --period=1d --by-fault=any

# Users whose average CPU usage was above 80% of the limit in the past 24 hours
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

# Running LVEs and their resource usage, per process
lveps -p

# Continuously updated view, like the top command
lvetop

# Current LVE and MySQL usage of a user, in JSON
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.


Was this answer helpful?

« Back