Resource Limits
I/O Resource Limits (with examples of CPU and memory limits)¶
BlockIO restricts disk I/O bandwidth for specific devices by specifying device paths and limits. The correct syntax is BlockIO=DEVICE:READ_BPS:WRITE_BPS, where DEVICE is the path to the block device (e.g., /dev/sda), and READ_BPS/WRITE_BPS define read/write byte-per-second limits. Major:minor notation is not valid for BlockIO.
IOWeight (with updated syntax) is used for I/O prioritization. Modern systems use IOWeight=weight with explicit weight values (e.g., IOWeight=500) to prioritize I/O operations.
Example:
[Service]
CPUQuota=50%
MemoryLimit=1G
BlockIO=/dev/sda:50M:10M
BlockIO=/dev/sdb:10M:50M
IOWeight=500
CPUQuota=50% limits CPU usage to 50% of a single core.-
MemoryLimit=1G restricts memory usage to 1 gigabyte.-
BlockIO=DEVICE:READ_BPS:WRITE_BPS specifies the maximum read/write bandwidth for a device.-
IOWeight=500 prioritizes I/O operations (higher values = lower priority).
Commands: