Show CPU throttling stats (cgroup v2)

How many times and for how many microseconds the cgroup was throttled by the cpu.max quota

grep -E 'nr_throttled|throttled_usec' /sys/fs/cgroup/system.slice/<name>.service/cpu.stat

tool
cgroups8 commands
tags
cgroupscpuperformancetroubleshooting

More cgroups commands

  • cat /sys/fs/cgroup/system.slice/<name>.service/cpu.max # "max 100000" = unlimited; "50000 100000" = 0.5 core

    cpu.max is "quota period" in microseconds, max means no limit. To change it, use systemctl set-property

  • cat /sys/fs/cgroup/system.slice/<name>.service/io.pressure /sys/fs/cgroup/system.slice/<name>.service/io.stat

    PSI IO stalls plus rbytes/wbytes/rios per major:minor. Helps find noisy disk neighbors

  • cat /sys/fs/cgroup/system.slice/<name>.service/cgroup.procs; systemctl status <name>.service | grep CGroup

    All PIDs that are in the service cgroup right now. Compare them with the tree from systemctl status

  • systemd-cgls --all --no-pager; systemd-cgtop -d 2 --depth=3

    cgls --all also shows empty cgroups. cgtop ranks slices by live CPU, memory and IO

  • cgcreate -g memory:/<name>; cgset -r memory.limit_in_bytes=512M <name>; cgexec -g memory:/<name> <command>

    A throwaway memory limit with libcgroup v1. Note: on the unified v2 hierarchy, use systemd-run --scope -p

all 8 cgroups commands