Resource throttling

CPU, RAM, IOPS, I/O and Task limits

With the release of DirectAdmin 1.61.6, we now support per-user resource throttling.

Requirements

The following OS are supported:

  • CentOS 8.x and newer
  • Debian 9.x, 10.x and newer
  • Ubuntu 16.04, 18.04, 20.04 and newer

What does it throttle?

  • Cronjobs (Debian systems require session optional pam_systemd.so line to be added to /etc/pam.d/cron)
  • PHP (PHP-FPM, FastCGI) (LSWS and OpenLiteSpeed requires lingering sessions on clients: loginctl enable-linger $USER)
  • Any processes started by the user

What can be throttled?

You may control the following options in user package/settings:

  • CPU - percentage of CPU Core, >100% for more than a single cores
  • RAM - hard memory limit for the account
  • IO read/write speeds - max rate data can be read from (or written to) a disk
  • IOPS read/write - max disk read/write operations per second
  • Tasks - max number of tasks user could run

Statistics

DirectAdmin shows current resource usage of the user under user-level. Any faults can be also seen on user or admin levels.

What is the difference between CloudLinux and integrated solution?

DirectAdmin offers user isolation and resource throttling. CloudLinux offers additional tools like:

  • X-Ray for troubleshooting slow execution of the websites
  • Support end-of-life versions of PHP
  • Ability to control PHP extensions per-user
  • MySQL governor, to throttle MySQL resources (throttles just CPU and read/write bandwidth, because from the technical side it is not possible to throttle other resources due to the use of process threads, that share the memory)

Installation instructions

These steps are required for installs of DirectAdmin 1.61.5 and older. Newer versions should have this all done automatically.

It is required to have systemd.unified_cgroup_hierarchy=1 kernel parameter enabled.

If you run OpenVZ/LXC container, you'd need to ask your provider to enable this kernel option for you. Otherwise, just run:

cd /usr/local/directadmin/custombuild
./build grub_conf

If you run debian/ubuntu, we also suggest executing the following, as we've noticed some systems not assigning CPU/IO controllers for user slices:

mkdir -p "/etc/systemd/system/user@.service.d"
echo "[Service]" > "/etc/systemd/system/user@.service.d/delegate.conf"
echo "Delegate=pids memory cpu io" >> "/etc/systemd/system/user@.service.d/delegate.conf"

If it requires to reboot the server after execution grub_conf command - please do.

If you run PHP as FastCGI, Apache needs to be re-installed:

cd /usr/local/directadmin/custombuild
./build apache

If you run PHP as PHP-FPM or lsphp, PHP needs to be re-installed:

cd /usr/local/directadmin/custombuild
./build php

Resource throttling should work successfully now.

Last Updated: