[ 
https://issues.apache.org/jira/browse/YARN-6668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16056659#comment-16056659
 ] 

ASF GitHub Bot commented on YARN-6668:
--------------------------------------

Github user haibchen commented on a diff in the pull request:

    https://github.com/apache/hadoop/pull/241#discussion_r123120501
  
    --- 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/CGroupsResourceCalculator.java
 ---
    @@ -0,0 +1,292 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package 
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources;
    +
    +import org.apache.hadoop.util.CpuTimeTracker;
    +import org.apache.hadoop.util.Shell;
    +import org.apache.hadoop.util.SysInfoLinux;
    +import org.apache.hadoop.yarn.exceptions.YarnException;
    +import org.apache.hadoop.yarn.util.Clock;
    +import org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree;
    +import org.apache.hadoop.yarn.util.SystemClock;
    +
    +import java.io.BufferedReader;
    +import java.io.File;
    +import java.io.FileInputStream;
    +import java.io.FileNotFoundException;
    +import java.io.IOException;
    +import java.io.InputStreamReader;
    +import java.math.BigInteger;
    +import java.nio.charset.Charset;
    +import java.util.function.Function;
    +import java.util.regex.Matcher;
    +import java.util.regex.Pattern;
    +
    +/**
    + * A cgroups file-system based Resource calculator without the process tree
    + * features.
    + */
    +
    +public class CGroupsResourceCalculator extends 
ResourceCalculatorProcessTree {
    --- End diff --
    
    This is pretty neat! :-) I have not looked closely at the details of this 
class. One reminder is we want to use this as well to get the aggregated 
container utilization. Now, we just do accumulation while iterating over all 
container process (see ContainerMonitorImpl.setContainersUtilization()) in 
container monitor, which can be stale if there are a lot of containers running. 
 


> Use cgroup to get container resource utilization
> ------------------------------------------------
>
>                 Key: YARN-6668
>                 URL: https://issues.apache.org/jira/browse/YARN-6668
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: nodemanager
>    Affects Versions: 3.0.0-alpha3
>            Reporter: Haibo Chen
>            Assignee: Miklos Szegedi
>
> Container Monitor relies on proc file system to get container resource 
> utilization, which is not as efficient as reading cgroup accounting. We 
> should in NM, when cgroup is enabled, read cgroup stats instead. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to