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:
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.
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.