Enable cgroups v1 for YARN in to manage Linux
container CPU scheduling and resource isolation across your cluster.
Follow these steps to enable cgroup-based resource management
at Host level configuration on :
Navigate to the Hosts option in the left navigation
pane.
Select Hosts Configuration. The Hosts
Configuration page is displayed.
Search for Enable Cgroups.
Check the Enable Cgroup-based Resource Management box.
cgroups is a Linux kernel feature. cgroups is supported on the following Linux operating
systems:
CentOS
RHEL
SUSE
Ubuntu
cgroups v1 is default on RHEL 7, RHEL 8, and older Ubuntu releases. You must
manually create the cgroup directory hierarchy and set ownership before starting the
NodeManager.
Run the following commands on every reboot of the NodeManager hosts to set up
the cgroup hierarchy. Operating systems use different mount points for the cgroup
interface. Replace /sys/fs/cgroup with your operating system
equivalent.
Search for Always Use Linux Container Executor and select YARN-1 (Service-Wide) option.
Search for NodeManager Advanced Configuration and set the
following properties in the NodeManager Advanced Configuration Snippet
(Safety Valve) for yarn-site.xml field.
Search for CGroups and select the YARN-1
(Service-Wide) option in the Use CGroups for Resource
Management field.
Search for CGroups Hierarchy and set the NodeManager Default Group value to /hadoop-yarn.
(Optional) Set the percentage of CPU to be used by YARN. Search for
Containers CPU Limit and set the value in the
Containers CPU Limit Percentage field.
Set the percentage of CPU that can be allocated for YARN containers. In most
cases, the default value of 100% should be used. If you have another process that
needs to run on a node that also requires CPU resources, you can lower the percentage
of CPU allocated to YARN to free up resources for the other process.
(Optional) Set flexible or strict CPU limits. Search for Strict CGroup
Resource Usage and select the NodeManager Default
Group field.
CPU jobs are constrained with CPU scheduling and cgroups enabled, but by default
these are flexible limits. If spare CPU cycles are available, containers are
allowed to exceed the CPU limits set for them. With flexible limits, the amount of
CPU resources available for containers to use can vary based on cluster usage --
the amount of CPU available in the cluster at any given time.
You can use cgroups to set strict limits on CPU usage. When strict limits are
enabled, each process receives only the amount of CPU resources it requests. With
strict limits, a CPU process will receive the same amount of cluster resources
every time it runs.
Strict limits are not enabled (set to false) by default.