All Products
Search
Document Center

Alibaba Cloud Linux:Enable the PSI feature for cgroup v1 to monitor system resources

Last Updated:Nov 27, 2024

The Pressure Stall Information (PSI) feature helps you monitor CPU, memory, and I/O performance and detect performance exceptions. In the Linux kernel, only control group version 2 (cgroup v2) interfaces support the PSI feature. To ensure that you can use the PSI feature to monitor CPU, memory, and I/O performance and detect performance exceptions when you use control group version 1 (cgroup v1) interfaces, Alibaba Cloud Linux 2 with kernel version 4.19.81-17.al7 and later versions and Alibaba Cloud Linux 3 also support the PSI feature for cgroup v1 interfaces. This topic describes how to enable the PSI feature for cgroup v1 interfaces and query relevant information.

Enable the PSI feature for the cgroup v1 interface

The default value of the args parameter is "psi=1", which indicates that the PSI feature is enabled for cgroup v2 interfaces. The "psi=1 psi_v1=1" parameter indicates that the PSI feature is enabled for cgroup v1 interfaces.

  1. Enable the PSI feature for cgroup v1 interfaces

    sudo grubby --update-kernel="/boot/vmlinuz-$(uname -r)" --args="psi=1 psi_v1=1"
  2. Restart the instance for the configurations to take effect.

    Warning

    The 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 reboot
  3. Check whether the PSI feature is enabled for cgroup v1 interfaces.

    cat /proc/cmdline | grep "psi=1 psi_v1=1"

    The following figure shows that the PSI feature is enabled for cgroup v1 interfaces.

    image

Query the monitoring data of the CPU, memory, and I/O performance

After the PSI feature is enabled for cgroup v1 interfaces, the PSI feature monitors the CPU, memory, and I/O performance and transmits all monitoring data to the cpuacct controller.

Run the following commands to query the monitoring data:

cat /sys/fs/cgroup/cpuacct/cpu.pressure
cat /sys/fs/cgroup/cpuacct/memory.pressure
cat /sys/fs/cgroup/cpuacct/io.pressure