fbpx

Before reading this document you must read:

  1. Introduction to Containerization (Website Limits)
  2. Apply Limits to Websites

Once limits are applied, resource usage monitoring becomes important. You can view resource usage for any website at https://IP Of Your Server:8090/container/example.com.

We will put stress on CPU, Memory and see how limits behave during the stress.


Testing CPU Performance

Run ls -la /home and find user of your website. Read the website limits document and grant 10% CPU usage to the website.

Now add your website user to the wheel group (usermod -aG wheel user) so it can run commands via sudo. (Don't do this on a production node)

Install a stress testing tool

yum install stress -y

And then run this command to generate high CPU Load

sudo -u <website user> stress -c 3 -i 1 -m 1 --vm-bytes 128M -t 20s

Replace website user in the above command. Now before the limits are applied, your CPU usage should look something like this during the stress period.

As you can see currently limits are not applied, so the website user was able to use 100% of CPU. We will now enforce 10% of CPU usage and see the output.


Testing Memory Allocation

First run the command below without any limits being applied.

sudo -u <website user> stress -c 2 -i 1 -m 1 --vm-bytes 128M -t 20s

Output should be something like

Now apply 30MB of ram limit and run the same command:

Before limits are applied average memory usage was 110MB for the same command, after limits it could not exceed 30MB limit that we've applied.

Previous: Apply Limits to Websites

Before reading this document you must read:

  1. Introduction to Containerization (Website Limits)

To apply limits navigate to https://IP Of Your Server:8090/container/ . Once there click launch, so that you can manage limits for the site. Click Edit to set the limits. You will see default limits but they are not currently applied.


Limits Explained

You can apply 4 type of limits, and they are explained below.

CPU Percentage

Amount of CPU a certain website/user can use. On a Multi-core system user will get assigned share on each CPU Core. But CPU usage calculation will be divided by total cores on system. For example if website is assigned 10% CPU on a 4 core system, they will get 10% share of each CPU core.

If website start using 10% CPU on all 4 cores the average usage will then be 10% (40 / 4 = 10%)

Memory

Memory usage specifies the amount of RAM the website can use. User processes may be killed by kernel if they try to allocate more ram.

I/O

Disk I/O speed allowed for the website such as 10MB/s. This limit is not the same as IOPS  described below.

IOPS

IOPS is different compared to IO, this specifies number of IO operations that a website user can do per second.

Network Speed

This specifies upload/download speed of the website user.

Previous: Introduction to Containerization (Website Limits)

Next: View Website/User Resource Usage

Containerization feature (v1.8.0 and above required, currently only CentOS is supported) offers to limit website resources and have no link to our Docker Manager feature. With containerization you can limit various system resources for a website, cgroups are used on the back end to enforce these limits. You can limit:

  1. CPU Usage.
  2. Memory Usage.
  3. Network Usage.
  4. Disk Usage (IO and IOPS)

These limits are applied to all processes forked under a website user (Such as lsphp processes). You can use ls -la /home command to find out user of each website. LiteSpeed Webserver forks php processes for sites using these Linux user accounts. If there are no limits applied a single tenant can use all available resources on your system.

Next: Apply Limits to Websites

chevron-down