A website on a shared hosting can consume all system resources and disrupt the performance of other websites. This issue is known as the “noisy neighbor problem”.

Plesk Cgroups Manager is an extension that helps you address this issue by managing the consumption of the CPU, RAM, disk read and write bandwidth.

For each system resource Cgroups Manager allows you to:

  • Set a maximum amount (limit) on the consumed resource.
  • Monitor the amount of the consumed resource and send email notifications when it exceeds a certain level (threshold).

You can configure Cgroups Manager and set the limit on the consumed resource on the following levels:

  • For a service plan, affecting all subscriptions under the plan.
  • For a single subscription.

Note: To use Cgroups on a Plesk server with a custom kernel, you need to specify a number of parameters when compiling the kernel.

Requirements

Plesk License

Cgroups manager is available for the following Plesk editions:

  • Plesk Web Pro
  • Plesk Web Host

If you are using the Web Admin plan and want to manage the resource consumption of your websites, consider upgrading to Web Pro and distributing websites among several subscriptions.

Extension License

Cgroups Manager is a paid extension. You can purchase it either separately or as a part of the Hosting Pack.

OS and init system

Cgroups Manager is available for:

  • Debian 8
  • Ubuntu 16.04 and Ubuntu 18.04
  • CentOS 7
  • Red Hat Enterprise Linux 7

By default, all these distributions use the init system called systemd, which is required for Cgroups Manager. Although Plesk can also be installed on Debian with an alternative init system called System V. To check the current init system, run cat /proc/1/comm in the command line interface.

Note: Note: If you install the Cgroups Manager on Debian with System V, Plesk will replace it with systemd. You will have to manually reboot the system after the installation for the changes to take effect.

Limitations for Debian 8

By default, Cgroups Manager has limited functionality on Debian 8, whose kernel does not support the cgroups CPU and RAM resource usage limitations. Read more about Cgroups Manager for Debian 8 and possible resolution.

Limitations for Virtuozzo 6 & 7

Plesk installed in a Virtuozzo 6 container can only manage RAM. Plesk in a Virtuozzo 7 container can manage RAM and the CPU, but not the disk I/O. Plesk installed on a Virtuozzo virtual machine does not suffer from these limitations.

If your system does not meet some requirements, you can migrate Plesk to one that meets them.

Installation

To enable the Cgroups Manager:

  1. Install the component Resource Controller (Cgroups) using the Plesk Installer:

    1. Go to Tools & Settings

    2. Click the Updates and Upgrades link

    3. Click the Add/Remove Components link

    4. Select the “Resource Controller (Cgroups)” and hit Continue.

      Note: Note: If the required component is missing from the list of available components, make sure that your system meets the requirements.

  2. Start the component:

    1. Go to Tools & Settings
    2. Click the Services Management link
    3. Start the service “Resource Controller (Cgroups)”.

Configuring the Cgroups Manager

Note: Caution: Incorrect configuration of Cgroups Manager can make hosted websites slower or even unavailable. Please make sure that you have read and understood the instructions in this topic before making any changes.

You can configure Cgroups Manager on the following levels:

  • For a service plan, affecting all subscriptions under the plan.
  • For a single subscription.

Settings on the subscription level override those on the service plan level. Add-on plans can not be used to modify the Cgroups Manager settings.

Once you install and start the service, the following configuration tools become available:

Tool Service Plan Subscription
Plesk Panel (use the Service Provider view)
  1. Go to Service Plans > open the Hosting Plans tab.
  2. Click the service plan for which you want to configure Cgroups Manager.
  3. Open the RAM, CPU, Disk I/O tab.
  1. Go to Subscriptions.
  2. Click the subscription for which you want to configure Cgroups Manager.
  3. Click Customize > open the RAM, CPU, Disk I/O tab.
Plesk CLI Use the -cgroups* options of the service_plan utility. Use the -cgroups* options of the subscription_settings utility.
Plesk XML API See the documentation on Managing Service Plans. See the documentation on Managing Subscriptions.

Limiting Resource Consumption

Setting up the Limits

The first of the settings available for each managed resource is the limit value. Each managed resource has its own limit value. By default, limit values are not set, that is, resources are not limited.

Subscriptions can share limit settings, but each has its own limit.

If a resource is limited for a given subscription:

  • The Cgroups Manager monitors all processes owned by the subscription’s system user. Together these processes can consume no more than the limit value of each resource.
  • If a subscription reaches its limit, the operating system performs a certain action, depending on the resource type.
  • A subscription cannot exceed the limit even if free resources of the corresponding type are available on the server (idle CPU cycles, free RAM, etc.).

If a resource is not limited for a given subscription:

  • A subscription’s processes can use as much of that resource as is available.
  • The resource is shared between processes of all subscriptions:
    • CPU time and disk I/O are shared almost equally.
    • RAM is shared as requested by processes.

In both cases, there is no guarantee that a subscription will receive any minimal amount of resource.

Allowed Setting Values for Limits

The limit settings may have the following values:

Setting Measured in Available values
CPU limit Percentage of CPU time, where 100% is one CPU core fully used Not more than 100% * Number of CPU cores
RAM limit Bytes Not less than 1MB
Disk input (write) speed Bytes per seconds Not less than 1MB per second
Disk output (read) speed Bytes per seconds Not less than 1MB per second

If the server has multiple CPU cores, the available CPU amount is equal to 100% * the number of CPU cores. For example, if your server has four CPU cores, the available CPU amount is 400%.

image 78709

How the System Manages Resource Consumption

When the processes of a particular subscription use the maximum allowed value of a resource, the operating system performs certain actions, depending on the resource type.

Resource Overused Actions Impact
CPU, disk read and write bandwidth The system restricts the processes of this subscription to use no more resources than the limit allows. The corresponding websites might operate more slowly and have a higher response time.
RAM When the processes of a particular subscription reach the RAM limit, the system kills the most memory-consuming one. The corresponding website might be unavailable for some time and respond to requests with HTTP codes 5xx.

Monitoring and Notifications for Resource Consumption

Setting up Monitoring and Notifications

Once you set the limit for a resource, you can also configure Plesk to monitor the consumption of that resource.

To turn monitoring on, set the following values:

  • Threshold (“Notify when exceeded.” in Plesk Panel).
  • Period.

To turn monitoring off, remove the corresponding threshold value.

Allowed Setting Values for Monitoring

The monitoring settings may have the following values:

Setting Measured in Available values
CPU limit Percentage of CPU time, where 100% is one CPU core fully used Not more than the CPU limit value
RAM limit Bytes Not less than 1MB and not more than the RAM limit value
Disk input (write) speed Bytes per seconds Not less than 1MB per second and not more than the disk write limit value
Disk output (read) speed Bytes per seconds Not less than 1MB per second and not more than the disk read limit value
Check Period (for any resource) Seconds 300 (5 minutes), 3600 (1 hour), or 86400 (24 hours)

How the System Performs Monitoring

When you enable resource monitoring for one or more resources, the Cgroups Manager starts monitoring their consumption. If you enabled resource monitoring on the subscription level, resource usage for that subscription will be monitored. If you enabled resource monitoring on the service plan level, resource usage for all subscriptions based on that service plan will be monitored instead:

  1. Every five minutes the Cgroups Manager counts the average resource consumption of a subscription and checks whether it is equal or greater than the threshold.
  2. After every period the Cgroups Manager checks how many times the subscription has exceeded the threshold within the last period of time.
    • If the subscription has exceeded the threshold in all intervals of a period, Cgroups Manager sends an email notification.
    • If this happens for longer than one period, no extra notifications are sent.

An Example of Monitoring

This example will help you better understand how the Cgroups Manager performs monitoring and triggers notifications.

There is a subscription plan P with the following settings:

Setting Value
CPU Limit 200%
CPU Threshold 160%
CPU Check Period 1 hour

As explained before, 100% means one CPU core is fully used.

There are two subscriptions under the plan: A and B.

Subscription A has a CPU-heavy task which runs each hour and takes about 10 minutes. For those 10 minutes, the subscription’s processes consume more than 160% of CPU time. At other times, the subscription consumes less than 160% of CPU time. It does not matter for notifications whether it reaches the limit value.

The website of Subscription B is under heavy load. The subscription’s processes always consume more than 160% of CPU time.

Cgroups Manager counts the average consumption for each 5-minute interval. Then, at the end of an hour it has the following results:

  • Subscription A has exceeded the threshold in two intervals of 12. Cgroups Manager will not send any notifications.
  • Subscription B has exceeded the threshold in all 12 intervals. Cgroups Manager will send a notification, but will not repeat it if the load continues.

Recipients and Content of the Notifications

To select who will receive the notifications:

  1. Go to Tools & Settings > Notifications.
  2. Select the required recipients next to the CPU, RAM, and Disk I/O (Cgroups).

The content of each notification message is built from a template. To read and edit the template:

  1. Go to Tools & Settings > Notifications.
  2. Click the rightmost button next to the CPU, RAM, and Disk I/O (Cgroups).

For more information, read the documentation on the automatic email notifications.

Restrictions

Some technical and business issues can not be resolved with resource management:

  • Customers who overused resources earlier will probably experience worse performance.
  • Cgroups Manager does not account and limit resources for Ruby, Python, and Node.js web-applications using the Phusion Passenger.

Disabling the Cgroups Manager

To hide the Cgroups Manager functionality, add these lines to the panel.ini file:

[resourceController]
enabled = false