Cgroups Manager (Linux)

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 CPU, RAM, disk read and write bandwidth.

For each subscription and each system resource the Cgroups Manager allows you to:

  • Set the maximum amount (limit) of the resource that the subscription may consume.
  • Monitor the amount of resource that the subscription consumes and send email notifications when it exceeds a certain level (threshold).

在本节:

Requirements

Installation

Configuring the Cgroups Manager

Limiting Resource Consumption

Monitoring and Notifications for Resource Consumption

Restrictions

Disabling the Cgroups Manager

 

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
  • 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: 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 Virtuozzo 6 & 7

Plesk on Virtuozzo 6 can only manage RAM, and Plesk on Virtuozzo 7 can manage RAM and CPU, but not the disk I/O.

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

 

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

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

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 can not exceed the limit even if there are free resources of the corresponding type available on the server (idle CPU cycles, free RAM, etc.).

If a resource is not limited for a given subscription:

  • 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 receives any minimal available amount of resource.

Allowed Setting Values for Limits

The limit settings may have the following values:

Setting Measured in Available values

CPU limit

Percent 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

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 slower and have a higher response time.

RAM

When the processes of a particular subscription reach the RAM limit, 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

Percent 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 5 minutes the Cgroups Manager counts the average resource consumption of a subscription and checks if it is equal or greater than the threshold.
  2. 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% mean one CPU core 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. For the other time, the subscription consumes less than 160% of CPU time. It doesn't 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, in the end of an hour it has the following results:

  • The Subscription A has exceeded the threshold in two intervals of 12. Cgroups Manager will not send any notifications.
  • The 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 solved with resource management:

  • Customers who overused resources earlier will likely 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
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.