Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between `yarn.scheduler.maximum-allocation-mb` and `yarn.nodemanager.resource.memory-mb`?

What is difference between yarn.scheduler.maximum-allocation-mb and yarn.nodemanager.resource.memory-mb?

I see both of these in yarn-site.xml and I see the explanations here.

yarn.scheduler.maximum-allocation-mb is given the following definition: The maximum allocation for every container request at the RM, in MBs. Memory requests higher than this will throw a InvalidResourceRequestException. Does this mean memory requests ONLY on the resourcemanager are limited by this value?

And yarn.nodemanager.resource.memory-mb is given definition of Amount of physical memory, in MB, that can be allocated for containers. Does this mean the total amount for all containers across the entire cluster, summed together?

HOwever, I still cannot discern between these. Those explanations make me think that they are the same.

Even more confusing, their default values are exactly the same: 8192 mb. How do I tell difference between these? Thank you.

like image 483
makansij Avatar asked May 07 '17 00:05

makansij


People also ask

What is yarn scheduler maximum allocation mb?

yarn.scheduler.maximum-allocation-mb. The maximum allocation for every container request at the ResourceManager, in MB. Memory requests higher than the specified value will not take effect. CPU related settings in YARN are as follows: yarn.nodemanager.resource.cpu-vcores.

How does yarn allocate memory?

YARN uses the MB of memory and virtual cores per node to allocate and track resource usage. For example, a 5 node cluster with 12 GB of memory allocated per node for YARN has a total memory capacity of 60GB. For a default 2GB container size, YARN has room to allocate 30 containers of 2GB each.

What is yarn Nodemanager CPU Vcores?

scheduler. maximum-allocation-vcores: This is the maximum allocation for every container request at the Resource Manager, in terms of virtual CPU cores. Requests higher than this won't take effect, and will get capped to this value.

What is yarn App Mapreduce Am resource MB?

Description. yarn.app.mapreduce.am.resource.mb. Sets the memory requested for the application master container to the value in MB.


1 Answers

Consider in a scenario where you are setting up a cluster where each machine having 48 GB of RAM. Some of this RAM should be reserved for Operating System and other installed applications.


yarn.nodemanager.resource.memory-mb:

Amount of physical memory, in MB, that can be allocated for containers. It means the amount of memory YARN can utilize on this node and therefore this property should be lower than the total memory of that machine.

<name>yarn.nodemanager.resource.memory-mb</name> <value>40960</value> <!-- 40 GB --> 

The next step is to provide YARN guidance on how to break up the total resources available into Containers. You do this by specifying the minimum unit of RAM to allocate for a Container.

In yarn-site.xml

<name>yarn.scheduler.minimum-allocation-mb</name> <!-- RAM-per-container ->  <value>2048</value> 

yarn.scheduler.maximum-allocation-mb:

It defines the maximum memory allocation available for a container in MB

it means RM can only allocate memory to containers in increments of "yarn.scheduler.minimum-allocation-mb" and not exceed "yarn.scheduler.maximum-allocation-mb" and It should not be more then total allocated memory of the Node.

In yarn-site.xml

<name>yarn.scheduler.maximum-allocation-mb</name> <!-Max RAM-per-container->  <value>8192</value> 

For MapReduce applications, YARN processes each map or reduce task in a container and on a single machine there can be number of containers. We want to allow for a maximum of 20 containers on each node, and thus need (40 GB total RAM) / (20 # of containers) = 2 GB minimum per container controlled by property yarn.scheduler.minimum-allocation-mb

Again we want to restrict maximum memory utilization for a container controlled by property "yarn.scheduler.maximum-allocation-mb"

For example, if one job is asking for 2049 MB memory per map container(mapreduce.map.memory.mb=2048 set in mapred-site.xml), RM will give it one 4096 MB(2*yarn.scheduler.minimum-allocation-mb) container.

If you have a huge MR job which asks for a 9999 MB map container, the job will be killed with the error message.

like image 107
Sandeep Singh Avatar answered Sep 19 '22 17:09

Sandeep Singh