How to Use Cgroups Manager to Increase Website Performance Through Resource Isolation on Linux

Cgroups Manager is here to offer a helping hand with your resource management. Control the resource consumption on your server and set the specific amount of CPU, RAM, and disk read/write bandwidth that each subscriber should receive. Monitor the amount of the consumed resource and send email notifications when a certain threshold is reached.

Until recently, Cgroups Manager was a paid extension, an independent module in the Plesk extensions catalog, allowing users to add new functions and features to Plesk. Now, Cgroups Manager has become a free-to-use feature and a welcome addition to the Plesk Web Pro and Web Host editions.

Cgroups Manager is currently available for Linux, supported by:
Debian 9, 10, Ubuntu 18.04, 20.04, CentOS 7, Red Hat Enterprise Linux 7, and AlmaLinux 8

Cgroups Manager – How can it be helpful to you?

Today we present to you the Cgroups Manager feature, your new best friend when it comes to resource management. Not only can this free-to-use feature assist in providing websites with their own specialized focus, it also helps to increase website performance by isolating resources when needed.

Before we dive further into this feature, let’s have a quick look at the following scenario in which Cgroups Manager can be useful for you:

  • When managing a hosting environment with multiple customers and service plans, some customers pay more and may therefore expect additional resources. Cgroups allows you to easily split and allocate resources accordingly.
  • Different sites have different needs: production websites should always respond as quickly as possible, yet other resources are used for staging, testing or development sites. Using Cgroups, these different types of sites can be provided with the necessary resources to work smoothly.

Want to see it in action? Below we will perform a test to try out the features of the Cgroups Manager for ourselves:

Configuration and Preparation

First of all, to make changes that are easier to observe for this test, we have installed Plesk on a low-cost Virtual Machine with limited resources (1 CPU core, 1 GB of RAM). Now, on Plesk we have created a few subscriptions with the following names:

  • production,
  • staging,
  • testing,
  • development,

In this example, we have created “basic”, “standard”, and “premium” service plans. On our server, all of them are currently attached to the same default service plan without any limitation.

To begin with, we’re making use of the following configuration:

Next, we enabled an integration between Plesk Monitoring and Resource Controller. As the Resource Controller is part of the Cgroups Manager functionality, the integration with Plesk Monitoring has also become free-to-use. This means we can now easily monitor the amount of resources each subscription consumes during performance testing:

 

Now that we finished our server configuration, we are ready to increase the load on our websites. To make sure that the server runs correctly, we made a small test to increase the load on the production website only. And based on the results, we can see that the Production website utilizes around 82% of the CPU.

We also noted the load average from the server (load average: 8.11, 7.11, 5.52) to compare how it might change in the future. As we only have 1 CPU, the load average currently seems to be too high. Although in reality we would prefer to change the configuration, for the purpose of these tests it will suffice. Finally, we also added all websites to the 360 Monitoring service to verify how the response time changes during the remaining tests.

Start Generating Usage Load (without Cgroups)

First, we start generating a load on the server with the ‘ab’ utility. We will run 4 commands at once, each generating 6 simultaneous connections (24 in total) to the server where our subscriptions and domains are safely located:

# ps ax | grep space | grep -v grep
156420 pts/0 S 0:50 ab -n 1000000 -c 6 https://production.plesk.space/
156741 pts/1 S 0:10 ab -n 1000000 -c 6 https://staging.plesk.space/
156743 pts/1 S 0:10 ab -n 1000000 -c 6 https://development.plesk.space/
157137 pts/3 S 0:03 ab -n 1000000 -c 6 https://testing.plesk.space/

Let’s track how the Usage Load has changed through Plesk Monitoring and 360 Monitoring tools:

  • The load average has increased (“load average: 24.94, 26.71, 23.33”).
  • CPU usage is at 100%.
  • CPU is shared across all websites, each using less than 20%, none using more than 100MB.
  • The response time is increased for all websites (around 2-3 times).

All of this is expected as our server is overloaded. It is important to note that the production website works slower than we want due to an insufficient amount of resources. Furthermore, If we can’t increase the performance of the server, we need to prioritize the production website over the others. Have a look at the following section to see how this can be accomplished, and how web performance can be changed going forward.

Starting to Generate Usage Load (with Cgroups)

Let us now create a new service plan and configure Cgroups limitations via Cgroups Manager controls. For this, we allow only 10% for CPU per limited subscription and no more than 128 MB of memory. As we have previously discovered that 100 MB is more than sufficient, there are no reasons to opt for more than 128 MB. Then we moved development, staging, and testing subscriptions to this limited service plan.

Now, let’s see how our metrics can change after applying the new settings and service plans.

  • The load average has slightly decreased (“load average: 12.61, 13.93, 14.12”);
  • CPU usage is at 100%, thus nothing changed in this metric.
  • The production website receives more CPU resources than others, a significant improvement.
  • The response time is different for hosted websites; for the production website it’s much faster than for testing websites, and it’s about the same as before starting the performance tests.

Сonclusions

In conclusion, the now free-to-use Cgroups Manager feature enables you to:

  • Optimize the resource consumption on your server.
  • Prioritize specific websites over others, either production or testing websites, for standard or premium customers.
  • Set actual limits on CPU, RAM, and Disk IO.
  • Prevent unwanted consumption of resources on your server.
  • Limit your resources on a service plan or subscriber basis.
  • Configure to set limits automatically or be notified when necessary.
  • Identify how many resources are consumed per website through Plesk Monitoring with Cgroups Manager.
  • Send out email notifications after certain thresholds are reached.
  • Recognize which subscriptions require additional resources, and make suggestions to customers to switch service plans accordingly.
  • Find out which subscription is overloaded on a server due to, for example, a DDoS attack.
  • During our tests in this specific context, we identified that one of our test servers could be limited by a service provider if it’s under load. Luckily, Plesk Monitoring can assist us here.

Last but not least, always stress-test servers under load before putting them into production, as this can save ample time and resources to identify other issues in the future.

Do you have a Plesk Web Pro or Web Host Edition license? Then you have Cgroups as a part of your package as default! Find out more or upgrade here, and let us know your thoughts in the comments!

5 Comments

  1. Cloudlinux recommends to set CPU limit not less than 100% (1 core) for any subscription on the server. In your example your allow 10% of CPU. I understood it’s only example, but is there any “default recommendations” from your side for limits if I will use Cgroups Manager instead of CloudLinux limits?

    • Louis Vanfraechem
      Louis Vanfraechem Moderator

      Hi Dmytro,

      We do not have specific recommendations about the limit. Although it is advised to follow the general recommendations set out by the Linux kernel, each server can be unique depending on their hosted website’s specifics. It’s always best to validate and produce a test before rolling it out to production.

  2. Thank you – Plesk has outsourced more and more basic functionality into additional paid addons, it’s nice to see some of them become part of the core product. Keep this up, we’re looking forward to future developments!

  3. I’ve enabled the ‘Resource Controller’ component. But to install the ‘Plesk Cgroups Manager’ extension, I still get the message “This paid extension is not licensed, but offers a free trial period. When the trial period ends, you will need to purchase a license to unlock all functions and features of this extension.”.

    Using it on Ubuntu 20.04, Plesk 18.0.42.

Add a Comment

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

We are Plesk

Value simplicity and automation too? We help devs, sysadmins, and resellers run, manage and secure via our control panel solutions, extensions and hyperscale opportunites. Discover how you fit with us.

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! Plesk International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the Plesk Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to privacy[email protected] or use the unsubscribe link in any of the newsletters.

Related Posts

Knowledge Base

Plesk uses LiveChat system (3rd party).

By proceeding below, I hereby agree to use LiveChat as an external third party technology. This may involve a transfer of my personal data (e.g. IP Address) to third parties in- or outside of Europe. For more information, please see our Privacy Policy.

Search
Generic filters
Exact matches only
Search in title
Search in content
Search in excerpt