Repository: hadoop
Updated Branches:
  refs/heads/branch-2 2d1ddbe58 -> cec930020


YARN-2949. Add documentation for CGroups. (Contributed by Varun Vasudev)
(cherry picked from commit 389f881d423c1f7c2bb90ff521e59eb8c7d26214)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cec93002
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cec93002
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cec93002

Branch: refs/heads/branch-2
Commit: cec9300201ef8b7bbb99105d3184d2b1d3408e9b
Parents: 2d1ddbe
Author: Junping Du <junping...@apache.org>
Authored: Thu Dec 18 06:25:59 2014 -0800
Committer: Junping Du <junping...@apache.org>
Committed: Thu Dec 18 06:26:53 2014 -0800

----------------------------------------------------------------------
 hadoop-project/src/site/site.xml                |  1 +
 hadoop-yarn-project/CHANGES.txt                 |  2 +
 .../src/site/apt/NodeManagerCgroups.apt.vm      | 77 ++++++++++++++++++++
 3 files changed, 80 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cec93002/hadoop-project/src/site/site.xml
----------------------------------------------------------------------
diff --git a/hadoop-project/src/site/site.xml b/hadoop-project/src/site/site.xml
index 3daf43f..eb2b3b2 100644
--- a/hadoop-project/src/site/site.xml
+++ b/hadoop-project/src/site/site.xml
@@ -126,6 +126,7 @@
       <item name="Scheduler Load Simulator" 
href="hadoop-sls/SchedulerLoadSimulator.html"/>
       <item name="NodeManager Restart" 
href="hadoop-yarn/hadoop-yarn-site/NodeManagerRestart.html"/>
       <item name="DockerContainerExecutor" 
href="hadoop-yarn/hadoop-yarn-site/DockerContainerExecutor.html"/>
+      <item name="Using CGroups" 
href="hadoop-yarn/hadoop-yarn-site/NodeManagerCGroups.html"/>
     </menu>
 
     <menu name="YARN REST APIs" inherit="top">

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cec93002/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 3e387a3..47477e2 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -109,6 +109,8 @@ Release 2.7.0 - UNRELEASED
     YARN-2972. DelegationTokenRenewer thread pool never expands. (Jason Lowe
     via junping_du)
 
+    YARN-2949. Add documentation for CGroups (Varun Vasudev via junping_du)
+
   OPTIMIZATIONS
 
   BUG FIXES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cec93002/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/NodeManagerCgroups.apt.vm
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/NodeManagerCgroups.apt.vm
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/NodeManagerCgroups.apt.vm
new file mode 100644
index 0000000..f228e3b
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/NodeManagerCgroups.apt.vm
@@ -0,0 +1,77 @@
+~~ Licensed 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. See accompanying LICENSE file.
+
+  ---
+  Using CGroups with YARN
+  ---
+  ---
+  ${maven.build.timestamp}
+
+Using CGroups with YARN
+
+%{toc|section=1|fromDepth=0|toDepth=2}
+
+ CGroups is a mechanism for aggregating/partitioning sets of tasks, and all 
their future children, into hierarchical groups with specialized behaviour. 
CGroups is a Linux kernel feature and was merged into kernel version 2.6.24. 
From a YARN perspective, this allows containers to be limited in their resource 
usage. A good example of this is CPU usage. Without CGroups, it becomes hard to 
limit container CPU usage. Currently, CGroups is only used for limiting CPU 
usage.
+
+* CGroups configuration
+
+ The config variables related to using CGroups are the following:
+
+ The following settings are related to setting up CGroups. All of these need 
to be set in yarn-site.xml.
+
+  [[1]] yarn.nodemanager.container-executor.class
+
+    This should be set to 
"org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor". CGroups is 
a Linux kernel feature and is exposed via the LinuxContainerExecutor.
+
+  [[2]] yarn.nodemanager.linux-container-executor.resources-handler.class
+
+    This should be set to 
"org.apache.hadoop.yarn.server.nodemanager.util.CgroupsLCEResourcesHandler".Using
 the LinuxContainerExecutor doesn't force you to use CGroups. If you wish to 
use CGroups, the resource-handler-class must be set to 
CGroupsLCEResourceHandler.
+
+  [[3]] yarn.nodemanager.linux-container-executor.cgroups.hierarchy
+
+    The cgroups hierarchy under which to place YARN proccesses(cannot contain 
commas). If yarn.nodemanager.linux-container-executor.cgroups.mount is false 
(that is, if cgroups have been pre-configured), then this cgroups hierarchy 
must already exist
+
+  [[4]] yarn.nodemanager.linux-container-executor.cgroups.mount
+
+    Whether the LCE should attempt to mount cgroups if not found - can be true 
or false
+
+  [[5]] yarn.nodemanager.linux-container-executor.cgroups.mount-path
+
+    Where the LCE should attempt to mount cgroups if not found. Common 
locations include /sys/fs/cgroup and /cgroup; the default location can vary 
depending on the Linux distribution in use. This path must exist before the 
NodeManager is launched. Only used when the LCE resources handler is set to the 
CgroupsLCEResourcesHandler, and 
yarn.nodemanager.linux-container-executor.cgroups.mount is true. A point to 
note here is that the container-executor binary will try to mount the path 
specified + "/" + the subsystem. In our case, since we are trying to limit CPU 
the binary tries to mount the path specified + "/cpu" and that's the path it 
expects to exist.
+
+  [[6]] yarn.nodemanager.linux-container-executor.group
+
+    The Unix group of the NodeManager. It should match the setting in 
"container-executor.cfg". This configuration is required for validating the 
secure access of the container-executor binary.
+
+ The following settings are related to limiting resource usage of YARN 
containers
+
+  [[1]] yarn.nodemanager.resource.percentage-physical-cpu-limit
+
+    This setting lets you limit the cpu usage of all YARN containers. It sets 
a hard upper limit on the cumulative CPU usage of the containers. For example, 
if set to 60, the combined CPU usage of all YARN containers will not exceed 60%.
+
+  [[2]] yarn.nodemanager.linux-container-executor.cgroups.strict-resource-usage
+
+    CGroups allows cpu usage limits to be hard or soft. When this setting is 
true, containers cannot use more CPU usage than allocated even if spare CPU is 
available. This ensures that containers can only use CPU that they were 
allocated. When set to false, containers can use spare CPU if available. It 
should be noted that irrespective of whether set to true or false, at no time 
can the combined CPU usage of all containers exceed the value specified in 
"yarn.nodemanager.resource.percentage-physical-cpu-limit".
+
+* CGroups and security
+
+ CGroups itself has no requirements related to security. However, the 
LinuxContainerExecutor does have some requirements. If running in non-secure 
mode, by default, the LCE runs all jobs as user "nobody". This user can be 
changed by setting 
"yarn.nodemanager.linux-container-executor.nonsecure-mode.local-user" to the 
desired user. However, it can also be configured to run jobs as the user 
submitting the job. In that case 
"yarn.nodemanager.linux-container-executor.nonsecure-mode.limit-users" should 
be set to false.
+
+*-----------+-----------+---------------------------+
+|| yarn.nodemanager.linux-container-executor.nonsecure-mode.local-user || 
yarn.nodemanager.linux-container-executor.nonsecure-mode.limit-users || User 
running jobs |
+*-----------+-----------+---------------------------+
+| (default) | (default) | nobody                    |
+*-----------+-----------+---------------------------+
+| yarn      | (default) | yarn                      |
+*-----------+-----------+---------------------------+
+| yarn      | false     | (User submitting the job) |
+*-----------+-----------+---------------------------+

Reply via email to