cloudera learning7:Hadoop资源管理

Linux Control Groups(cgroups):在操作系统级别进行资源分配,可通过Cloudera Static Service Pools配置。

YARN调度器配置:对运行在YARN上的应用进行资源配置,比如M/R,implala。可通过Cloudera 动态资源池进行配置。

以下资源可以通过cgroups配置进行限制:

Memory Hard Limit

– If a process exceeds this limit, the kernel swaps out some of the process’s memory; if it cannot do so, the process will be killed

Memory Soft Limit
– When memory contenFon exists on the host, the OS targets the process to not exceed this limit

CPU Shares
– When CPU contenFon exists on the host, processes with higher CPU shares will be given more CPU time

I/O Weight 
– Specify the proportion of I/O access available to the read requests performed by a process 

通过YARN进行资源配置:

YARN scheduler决定何时何处给应用分配Containers,Containers被赋予memory,CPU等资源。

YARN支持的scheduler类型:

1.FIFO Scheduler:先进先出调度器,基于时间顺序分配资源。

2.Capacity Scheduler:资源分配到资源池,各资源池中采用FIFO分配资源。

3.Fair Scheduler(default,recommend):公平调度器。资源分配到带有权重的资源池。各资源池之间按权重分配资源。

公平调度器的分配份额永远不会高于实际的需要。
单一考虑:应用内存均等的分,CPU均等的分。
综合考虑:应用内存,CPU消耗内存综合考虑分配。
每个pool上可以设权重,可以设最小值。
 

YARN调度器属性配置:yarn.resourcemanager.scheduler.class。

YARN没指定pool,会默认初始化一个和用户同名的pool。
YARN也支持预先指定一个pool,运行时动态指定一个pool。
 
YARN work node资源配置:
yarn.nodemanager.resource.memory-mb:配置NodeManager的tasks可使用的RAM。
yarn.nodemanager.resource.cpu-vcores:配置NodeManager的tasks可使用的CPU个数。
 
yarn.scheduler.minimum-allocation-mb :配置ResourceManager内存。CM default: 1G。
yarn.scheduler.minimum-allocation-vcores:配置ResourceManager的CPU。CM default:1 vcore。
 
yarn.scheduler.increment-allocation-mb:内存规整化单位,CM default 512M。如果资源请求1.6G,则会分配512*4=2G。
yarn.scheduler.increment-allocation-vcores:cpu规整化单位。

YARN Container资源分配:

mapreduce.map.memory.mb :Map task内存分配,CM default 1G。

mapreduce.reduce.memory.mb :Reduce task内存分配,CM default 1G。
yarn.app.mapreduce.am.resource.mb:ApplicationMaster内存分配,CM default 1G。Used by NodeManagers。
yarn.app.mapreduce.am.command-opts:Java堆空间分配,默认1G。
mapreduce.map.java.opts:Java执行Mapper时的堆大小。
mapreduce.reduce.java.opts:Java执行Reducer时的堆大小。
 
YARN tuning:

Calculate the resources needed for other processes:

– Reserve 3GB or 20% of total memory for the OS

– Reserve resources for any non-Hadoop applicaFons

– Reserve resources for other any Hadoop components

– HDFS caching (if configured), NodeManager, DataNode

– Impalad, HBase RegionServer, Solr, etc. 

Configure the YARN scheduler and application framework settings

– Based on the worker node profile determined above

– Determine the number of containers needed to best support YARN applicaFons based on the type of workload

– Monitor usage and tune estimated values to find optimal settings 

 
 
原文地址:https://www.cnblogs.com/zhq1007/p/5928983.html