Pressure Stall Information (PSI) is a kernel feature that monitors resource pressure for CPU, memory, and I/O. By default, the Linux kernel only provides PSI for the cgroup v2 interface. Alibaba Cloud Linux 2 (kernel version 4.19.81-17.al7 and later) and Alibaba Cloud Linux 3 also support PSI on the cgroup v1 interface. This topic describes how to enable PSI for cgroup v1 and query its monitoring data.
Enable PSI for the cgroup v1 interface
The psi=1 kernel argument enables PSI for cgroup v2. To enable PSI for the cgroup v1 interface, use the psi=1 and psi_v1=1 kernel arguments.
Enable PSI for the
cgroup v1interface.sudo grubby --update-kernel="/boot/vmlinuz-$(uname -r)" --args="psi=1 psi_v1=1"Restart the instance for the configurations to take effect.
WarningThe restart operation stops the instances for a short period of time and may interrupt the services that are running on the instance. This may result in data loss. Before you restart your instance, we recommend that you back up critical instance data. We also recommend that you restart the instance during off-peak hours.
sudo rebootVerify that PSI for the
cgroup v1interface is enabled.cat /proc/cmdline | grep "psi=1 psi_v1=1"The following output confirms that PSI for the
cgroup v1interface is enabled.
Query the monitoring data of CPU, memory, and I/O
Enabling PSI for the cgroup v1 interface exposes the monitoring data for CPU, memory, and I/O in the cpuacct controller.
To view the monitoring data, run the following commands.
cat /sys/fs/cgroup/cpuacct/cpu.pressure
cat /sys/fs/cgroup/cpuacct/memory.pressure
cat /sys/fs/cgroup/cpuacct/io.pressure