Class CGroupsV2CpuResourceHandlerImpl
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.AbstractCGroupsCpuResourceHandler
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsV2CpuResourceHandlerImpl
- All Implemented Interfaces:
CpuResourceHandler,ResourceHandler
@Unstable
@Private
public class CGroupsV2CpuResourceHandlerImpl
extends AbstractCGroupsCpuResourceHandler
An implementation for using CGroups V2 to restrict CPU usage on Linux. The
implementation supports 3 different controls - restrict usage of all YARN
containers, restrict relative usage of individual YARN containers and
restrict usage of individual YARN containers. Admins can set the overall CPU
to be used by all YARN containers - this is implemented by setting
cpu.max to the value desired. If strict resource usage mode is not enabled,
cpu.weight is set for individual containers - this prevents containers from
exceeding the overall limit for YARN containers but individual containers
can use as much of the CPU as available(under the YARN limit). If strict
resource usage is enabled, then container can only use the percentage of
CPU allocated to them and this is again implemented using cpu.max.
-
Field Summary
Fields inherited from class org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.AbstractCGroupsCpuResourceHandler
cGroupsHandler -
Method Summary
Modifier and TypeMethodDescriptionbooleancpuLimitExists(String cgroupPath) protected intgetCpuWeightByContainerVcores(int containerVCores) protected intprotected voidupdateCgroupCpuWeight(String cgroupId, int weight) protected voidupdateCgroupMaxCpuLimit(String cgroupId, String max, String period) Methods inherited from class org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.AbstractCGroupsCpuResourceHandler
bootstrap, getOverallLimits, postComplete, preStart, reacquireContainer, teardown, toString, updateContainer
-
Method Details
-
updateCgroupMaxCpuLimit
protected void updateCgroupMaxCpuLimit(String cgroupId, String max, String period) throws ResourceHandlerException - Specified by:
updateCgroupMaxCpuLimitin classAbstractCGroupsCpuResourceHandler- Throws:
ResourceHandlerException
-
getOpportunisticCpuWeight
protected int getOpportunisticCpuWeight()- Specified by:
getOpportunisticCpuWeightin classAbstractCGroupsCpuResourceHandler
-
getCpuWeightByContainerVcores
protected int getCpuWeightByContainerVcores(int containerVCores) - Specified by:
getCpuWeightByContainerVcoresin classAbstractCGroupsCpuResourceHandler
-
updateCgroupCpuWeight
- Specified by:
updateCgroupCpuWeightin classAbstractCGroupsCpuResourceHandler- Throws:
ResourceHandlerException
-
cpuLimitExists
- Specified by:
cpuLimitExistsin classAbstractCGroupsCpuResourceHandler- Throws:
ResourceHandlerException
-