yarn is not honouring yarn.nodemanager.resource.cpu-vcores
10,797
YARN is running more containers than allocated cores because by default DefaultResourceCalculator is used. It considers only memory.
public int computeAvailableContainers(Resource available, Resource required) {
// Only consider memory
return available.getMemory() / required.getMemory();
}
Use DominantResourceCalculator, It uses both cpu and memory.
Set below config in capacity-scheduler.xml
yarn.scheduler.capacity.resource-calculator=org.apache.hadoop.yarn.util.resource.DominantResourceCalculator
More about DominantResourceCalculator
Author by
banjara
Updated on June 05, 2022Comments
-
banjara almost 2 years
I am using
Hadoop-2.4.0
and my system configs are 24 cores, 96 GB RAM.I am using following configs
mapreduce.map.cpu.vcores=1 yarn.nodemanager.resource.cpu-vcores=10 yarn.scheduler.minimum-allocation-vcores=1 yarn.scheduler.maximum-allocation-vcores=4 yarn.app.mapreduce.am.resource.cpu-vcores=1 yarn.nodemanager.resource.memory-mb=88064 mapreduce.map.memory.mb=3072 mapreduce.map.java.opts=-Xmx2048m
Capacity Scheduler configs
queue.default.capacity=50 queue.default.maximum_capacity=100 yarn.scheduler.capacity.root.default.user-limit-factor=2
With above configs, I expect yarn won't launch more than 10 mappers per node, but It is launching 28 mappers per node. Am I doing something wrong??
-
Stonz2 over 9 yearsGood answers accompany code samples with an explanation for future readers. While the person asking this question may understand your answer, explaining how you arrived at it will help countless others.
-
banjara over 9 years@Stonz2 I apologize for incomplete answer.I asked this question and there was no answer for next 4-5 hour and it had only 5 view. Meanwhile I also debugged the code and found the answer. To help others I quickly added required configs, I had to run more experiments around it.
-
jonson over 8 yearsI spent a few hours trying to figure out why YARN was telling me there are a negative number of vcores available on my nodes!
-
Sai Kiriti Badam about 5 yearsThe link to DominantResourceCalculator is broken.