Verify cgroups v2 enforcement

Verify that cgroups v2 is actively enforcing CPU limits on NodeManager hosts.

After enabling cgroups v2, confirm that the kernel is correctly enforcing the CPU limits you have configured. This procedure sets a known CPU limit and then inspects the cgroups v2 control file on a NodeManager host to confirm that the limit is in effect.

  1. In Cloudera Manager, navigate to YARN > Configuration.
  2. Search for Containers CPU Limit and set Containers CPU Limit Percentage to 50.
  3. Click Save Changes.
  4. Restart the YARN service.
  5. On a NodeManager host, run the following command:
    cat /sys/fs/cgroup/YARN/hadoop-yarn/cpu.max
  6. Verify that the output matches the expected enforced CPU limit:
    500000 1000000

    The first value (500000) is the enforced quota in microseconds per period. The second value (1000000) is the period length in microseconds. A quota of 500,000 out of a period of 1,000,000 corresponds to 50% CPU, confirming that the limit is active.

The cpu.max file confirms that cgroups v2 is enforcing the configured CPU limit on the NodeManager host.