[
https://issues.apache.org/jira/browse/YARN-6673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059785#comment-16059785
]
ASF GitHub Bot commented on YARN-6673:
--------------------------------------
Github user szegedim commented on a diff in the pull request:
https://github.com/apache/hadoop/pull/232#discussion_r123583254
--- Diff:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/CGroupsCpuResourceHandlerImpl.java
---
@@ -181,16 +184,23 @@ public static boolean cpuLimitsExist(String path)
@Override
public List<PrivilegedOperation> preStart(Container container)
throws ResourceHandlerException {
-
String cgroupId = container.getContainerId().toString();
Resource containerResource = container.getResource();
cGroupsHandler.createCGroup(CPU, cgroupId);
try {
int containerVCores = containerResource.getVirtualCores();
- int cpuShares = CPU_DEFAULT_WEIGHT * containerVCores;
- cGroupsHandler
- .updateCGroupParam(CPU, cgroupId,
CGroupsHandler.CGROUP_CPU_SHARES,
- String.valueOf(cpuShares));
+ ContainerTokenIdentifier id =
container.getContainerTokenIdentifier();
+ if (id != null && id.getExecutionType() ==
+ ExecutionType.OPPORTUNISTIC) {
+ cGroupsHandler
+ .updateCGroupParam(CPU, cgroupId,
CGroupsHandler.CGROUP_CPU_SHARES,
+ String.valueOf(CPU_DEFAULT_WEIGHT_OPPORTUNISTIC));
+ } else {
+ int cpuShares = CPU_DEFAULT_WEIGHT * containerVCores;
+ cGroupsHandler
+ .updateCGroupParam(CPU, cgroupId,
CGroupsHandler.CGROUP_CPU_SHARES,
+ String.valueOf(cpuShares));
+ }
if (strictResourceUsageMode) {
--- End diff --
Yes, I think so. If the admin chooses strict cpu limits, all containers
should get strict cpu limits based on vcores. Opportunistic ones still will be
throttled by cpu.shares, if guaranteed are running. This is just a cap, for
opportunistic containers with different thread counts not to affect each other
negatively.
> Add cpu cgroup configurations for opportunistic containers
> ----------------------------------------------------------
>
> Key: YARN-6673
> URL: https://issues.apache.org/jira/browse/YARN-6673
> Project: Hadoop YARN
> Issue Type: Sub-task
> Reporter: Haibo Chen
> Assignee: Miklos Szegedi
>
> In addition to setting cpu.cfs_period_us on a per-container basis, we could
> also set cpu.shares to 2 for opportunistic containers so they are run on a
> best-effort basis
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]