In the Linux kernel, only the cgroup v2 interface supports the Pressure Stall Information (PSI) feature. Alibaba Cloud Linux 2 supports the PSI feature for the cgroup v1 interface in the kernel version 4.19.81-17.al7 to allow you to monitor the CPU, memory, and I/O performance. This topic describes how to enable the PSI feature in the cgroup v1 interface and query relevant information.
PSI is a kernel feature that can be used to monitor the CPU, memory, and I/O performance.
For more information about the PSI feature, see the kernel document
Documentation/accounting/psi.txt. The kernel document is contained in the Debuginfo package and source code package
of Alibaba Cloud Linux 2. For information about how to download the Debuginfo package
and source code package, see Use Alibaba Cloud Linux 2.
Enable the PSI feature for the cgroup v1 interface
By default, the PSI feature of the cgroup v1 interface is disabled. You can complete the following steps to enable the PSI feature:
- Run the
grubbycommand to change the startup parameter.The default value of the
"psi=1", which indicates that the PSI feature has been enabled for cgroup v2. Change the value of the parameter to
"psi=1 psi_v1=1", which indicates that the PSI feature is enabled for cgroup v1 in Alibaba Cloud Linux 2. In this example, the kernel version is
4.19.81-17.al7.x86_64. You must use your actual kernel version during the operation. To query the kernel version, run the
sudo grubby --update-kernel="/boot/vmlinuz-4.19.81-17.al7.x86_64" --args="psi=1 psi_v1=1"
- Restart the system to apply the change.
Verify that the PSI feature has been enabled for the cgroup v1 interface
/proc/cmdlineof the kernel.
cat /proc/cmdline | grep "psi=1 psi_v1=1"
Query the monitoring data of the CPU, memory, and I/O performance
cat /sys/fs/cgroup/cpuacct/cpu.pressure cat /sys/fs/cgroup/cpuacct/memory.pressure cat /sys/fs/cgroup/cpuacct/io.pressure