# System Resource Limits

Hard System Resource limits help manage server load within your Enhance cluster by allocating and limiting server resources to each containerised website.

This tool is especially valuable to users running large deployments for shared hosting. Combined with Enhance's other configurable package settings, System Resources are an effective way of differentiating hosting packages offered to customers.

Configurable System Resource limits include Memory limit, Virtual CPUs, IOPS, IO Bandwidth and nproc.

System resource are set using Linux system calls.

Hard resource limits can be set on a package level (and apply per website) and then can be overridden on a per website basis. The limits apply to all processes belonging to that website. This includes PHP workers, any processes forked by PHP (shell_exec(), passthru() etc), any cron jobs or anything the customer executes via SSH.

Websites that exceed their given system resource limits will break in an unexpected undefined way. If a website is inexplicably slow then insufficient assigned system resources is the most likely cause.

# Memory limit

This is the total system memory which the website processes can consume. If this limit is reached, processes belonging to the website might be killed using the kernel's OOM killer. Usually the newest process will be killed first.

# Virtual CPUs

1 "virtual CPU" is the equivalent of 1 core or CPU thread running at 100%. If this limit is reached, processes will be artificially slowed by the kernel to keep the CPU usage under the threshold.

You can assign virtual CPU resources in smaller increments, for example you can assign 1.5 vCPUs to a website.

TIP

Be wary of setting this limit too low. If website processes take longer to execute, more PHP workers will exist concurrently for a given traffic level and this will in turn consume more memory. It might be more efficient to assign additional CPU resources to your customers to save memory.

# IOPS

IOPS is the number of disk operations per second that the website's processes can perform on any disk on your system. Your server's disks will have an inherent limitation to the number of IOPS they can process and setting a per-website limit helps prevent the storage from being overwhelmed by a single busy or malicious website.

Bear in mind that a single PHP request could perform hundreds of IO operations - reading include files, session files, etc.

If this limit is reached, the website's processes will hang in D state and will continue to consume memory. Be wary of setting this limit too low.

# IO bandwidth

This is the amount of data which can be read or written by your website to and from the disks on your system. It functions similarly to the IOPS limit and processes reaching this limit will hang in D state until more IO bandwidth is available to them.

Generally we recommend being generous with this limit, otherwise a single large file read performed by the website could cause the website to hit its limit.

# nproc

This is the total number of processes the website can have within its container - including PHP workers, anything forked from PHP, cron jobs, SSH, etc. If this limit is reached then the website will not be able to fork additional processes.

This might cause the 500 HTTP error code on the website.

You should set this limit at least +5 higher than the PHP worker limit. For php-fpm this is configurable through the website's php-fpm settings in the UI. For LSPHP this is currently set to 50 and is not yet configurable.

# Hard disk

This is the total amount of disk space each website's home directory can consume. This setting is a hard limit. If a website consumes all of its hard disk quota and needs to write files to function this may cause the site to go offline.

This setting applies to the website (app role) only.

# Setting System Resource limits - package level

TIP

All packages created prior to the release of Enhance 9.0 core will default to 'Unlimited' System resources. To edit the resources for an existing package Packages > Edit.

The system resource limits set in a package apply to each website hosted on the package.

To configure System Resources on a package level:

  1. Open Settings in the left side bar
  2. Select Packages
  3. Scroll to System resources

# Setting System Resource limits - website overrides

By default a website is bound by the system resource limits of the package it is hosted on. It is possible for the master organisation and a Reseller to override these settings on a per website basis.

To override System Resources on a per website basis:

  1. Open Websites in the left side bar
  2. Select the kebab menu on the website you would like to adjust the system resource limits for, then click Overrides
  3. Under System resources make the adjustments as required, remembering to Save

When a system resource is overridden the 'Inherited' tag will no longer show alongside the setting.