From 710a5eea62a9c49ebe2b795e9e44f8ab0706a606 Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Fri, 14 Jun 2013 13:41:45 +0000 Subject: [PATCH] YARN-782. vcores-pcores ratio functions differently from vmem-pmem ratio in misleading way. (sandyr via tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1493064 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/yarn/conf/YarnConfiguration.java | 9 ++------- .../src/main/resources/yarn-default.xml | 10 +--------- .../yarn/server/nodemanager/NodeStatusUpdaterImpl.java | 9 ++------- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1e8cae2af5b..cf51c73b398 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -337,6 +337,9 @@ Release 2.1.0-beta - UNRELEASED YARN-692. Creating NMToken master key on RM and sharing it with NM as a part of RM-NM heartbeat. (Omkar Vinit Joshi via vinodkv) + YARN-782. vcores-pcores ratio functions differently from vmem-pmem ratio in + misleading way. (sandyr via tucu) + OPTIMIZATIONS YARN-512. Log aggregation root directory check is more expensive than it diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 68535345f0f..3ef06e0a7f4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -470,14 +470,9 @@ public class YarnConfiguration extends Configuration { NM_PREFIX + "vmem-pmem-ratio"; public static final float DEFAULT_NM_VMEM_PMEM_RATIO = 2.1f; - /** Number of Physical CPU Cores which can be allocated for containers.*/ - public static final String NM_VCORES = NM_PREFIX + "resource.cpu-cores"; + /** Number of Virtual CPU Cores which can be allocated for containers.*/ + public static final String NM_VCORES = NM_PREFIX + "resource.cpu-vcores"; public static final int DEFAULT_NM_VCORES = 8; - - /** Conversion ratio for physical cores to virtual cores. */ - public static final String NM_VCORES_PCORES_RATIO = - NM_PREFIX + "vcores-pcores-ratio"; - public static final float DEFAULT_NM_VCORES_PCORES_RATIO = 2.0f; /** NM Webapp address.**/ public static final String NM_WEBAPP_ADDRESS = NM_PREFIX + "webapp.address"; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml index d71d193e536..e2457cb7264 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml @@ -510,18 +510,10 @@ Number of CPU cores that can be allocated for containers. - yarn.nodemanager.resource.cpu-cores + yarn.nodemanager.resource.cpu-vcores 8 - - Ratio between virtual cores to physical cores when - allocating CPU resources to containers. - - yarn.nodemanager.vcores-pcores-ratio - 2 - - NM Webapp address. yarn.nodemanager.webapp.address diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java index 99def126f04..182dcadf38d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java @@ -124,14 +124,9 @@ public class NodeStatusUpdaterImpl extends AbstractService implements YarnConfiguration.DEFAULT_NM_VMEM_PMEM_RATIO); int virtualMemoryMb = (int)Math.ceil(memoryMb * vMemToPMem); - int cpuCores = + int virtualCores = conf.getInt( YarnConfiguration.NM_VCORES, YarnConfiguration.DEFAULT_NM_VCORES); - float vCoresToPCores = - conf.getFloat( - YarnConfiguration.NM_VCORES_PCORES_RATIO, - YarnConfiguration.DEFAULT_NM_VCORES_PCORES_RATIO); - int virtualCores = (int)Math.ceil(cpuCores * vCoresToPCores); this.totalResource = recordFactory.newRecordInstance(Resource.class); this.totalResource.setMemory(memoryMb); @@ -144,7 +139,7 @@ public class NodeStatusUpdaterImpl extends AbstractService implements LOG.info("Initialized nodemanager for " + nodeId + ":" + " physical-memory=" + memoryMb + " virtual-memory=" + virtualMemoryMb + - " physical-cores=" + cpuCores + " virtual-cores=" + virtualCores); + " virtual-cores=" + virtualCores); super.serviceInit(conf); }