Resource allocation and monitoring using LVE – CloudLinux

What is LVE?

It’s a module that works with CloudLinux kernel. This concept has a lot of advantages in web hosting technology. It’s something similar to the virtualization technique that we use traditionally. The most important GOAL of LVE is to make sure that no single website hosted on a server can bring down the server.

In normal cases, a single website hosted on a server can slow down the entire server, if the resource usage of that account is quite high. This concept is very interesting like that manner!

The LVE manages resources allocated for a particular account in a CloudLinux installed server. It makes sure that no particular LVE uses more resource from the server. Today we can limit CPU, Memory (virtual and physical), IO, number of processes as well as the number of entry processes (concurrent connections to apache).

What is EP – Entry Process?

EP is the concurrent connections to the Apache server. That means the Apache processes entering into the LVE. This is the important limiting factor. Each LVE limits the amount of EP to the Apache server to avoid a single website exhausting all resources.

If the limit is reached, the Apache module “mod_hostinglimits” won’t be able to place Apache process into that particular LVE. The server will return 508 error (Resource Limit Reached), without affecting other users on that server.

>> If the site is limited by CPU or IO, then the site will start responding slower.
>> If the site is limited by memory or number of processes limits, then the user will recieve 500 or 503 errors that server cannot execute the script.

Checking LVE installed on the server?

This can be done by using the following commands:

# uname -r
Or
# lsmod|grep lve

To check the iolimits installed on the server?

# lsmod|grep iolimits

Controlling LVE limit!

The main file where the limits are saved is “/etc/container/ve.cfg

See the sample output:

# cat /etc/container/ve.cfg
<?xml version=”1.0″ encoding=”utf-8″?>
<lveconfig>
<defaults>
<cpu limit=”100%”/>
<ncpu limit=”1″/>
<io limit=”4096″/>
<vmem limit=”0″/>
<pmem limit=”524288″/>
<nproc limit=”0″/>
<other maxentryprocs=”20″/>
<mem limit=”0″/>
<iops limit=”1024″/>
</defaults>

You can manage the LVE from WHM :: “Home »Server Configuration »CloudLinux LVE Manager
Commandline tool :: “lvectl

We can toggle LVE and IO on/off by changing its value in the following configuration files.

root@CryBit [~]# grep -i LVE_ENABLE /etc/sysconfig/lve
LVE_ENABLE=yes
-----
root@CryBit [~]# grep -i IOLIMITS_ENABLED /etc/sysconfig/iolimits
IOLIMITS_ENABLED=yes

Checking LVE usage – commandline tool

From cPanel we can check the resource usage details from “cPanel >> Logs >> Resource Usage.”
Via commandline we can monitor the LVE usage dynamically by using the command “lvetop” and statically by checking the file “/proc/lve/list”.

$ lvetop
 
ID     EP    PNO    TNO    CPU    MEM    I/O
290      1      1      1     16%    113K         0
user001  17     18     18     12%    516M         0
user002   20      8     16    68%    172M         0

That’s it!

Also read:

>> CloudLinux installation
>> PHP selector installation

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

Leave a Reply

Your email address will not be published. Required fields are marked *