Verifying cgroups v2 enforcement

Verify cgroups v2 enforcement of CPU limits for YARN on your NodeManager hosts by checking the cpu.max kernel control file.

Once cgroups v2 is enabled, validate that configured CPU resource limits are properly enforced by the kernel. To verify functionality, set a specific CPU threshold and check the corresponding control file on a NodeManager host.

  1. In , 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. Run the following command on a NodeManager host:
    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.