yarn 内存和cpu参数

1. 内存相关参数

参数

说明

默认值

yarn.nodemanager.resource.memory-mb

该nm能够分配的内存量

-1

yarn.nodemanager.vmem-pmem-ratio

虚拟内存率,Container 的虚拟内存大小的限制,每使用1MB物理内存,最多可用的虚拟内存数

2.1

yarn.nodemanager.pmem-check-enabled

是否启动一个线程检查每个任务正使用的物理内存量,如果任务超出分配值,则直接将其杀掉

true

yarn.nodemanager.vmem-check-enabled

是否启动一个线程检查每个任务正使用的虚拟内存量,如果任务超出分配值,则直接将其杀掉

true

mapreduce.map.memory.mb

分配给map Container的内存大小

-1

mapreduce.reduce.memory.mb

分配给reduce Container的内存大小

-1

mapreduce.map.java.opts

map启动的jvm参数,如 -Xmx,-Xms 等选项,值要小于mapreduce.map.memory.mb,一般为0.75倍

 

mapreduce.reduce.java.opts

reduce启动的jvm参数,如 -Xmx,-Xms 等选项,值要小于mapreduce.reduce.memory.mb,一般为0.75倍

 

yarn.scheduler.minimum-allocation-mb

单个Container最小可申请的资源

1024

yarn.scheduler.maximum-allocation-mb

单个Container最大可申请的资源

8192

yarn.scheduler.increment-allocation-mb

资源规整化因子,规整化因子是用来规整化应用程序资源的,应用程序申请的资源如果不是该因子的整数倍,则将被修改为最小的整数倍对应的值,公式为ceil(a/b)*b,其中a是应用程序申请的资源,b为规整化因子。

对于规整化因子,不同调度器不同,具体如下:

FIFO和Capacity Scheduler,规整化因子等于最小可申请资源量,不可单独配置。

Fair Scheduler:规整化因子通过参数yarn.scheduler.increment-allocation-mb和yarn.scheduler.increment-allocation-vcores设置,默认是1024和1。

 

yarn.app.mapreduce.am.resource.mb

mapreduce的am申请的内存

1536

说明:
yarn.nodemanager.resource.detect-hardware-capabilities默认值是false。

yarn.nodemanager.resource.memory-mb
如果值是-1且yarn.nodemanager.resource.detect-hardware-capabilities值为true,则根据系统内存自动计算,否则默认值为8192。

mapreduce.map.memory.mb在mapreduce.map.java.opts值没设置时,默认值是1024

mapreduce.reduce.memory.mb在mapreduce.reduce.java.opts值没设置时,默认值是1024

yarn.scheduler.increment-allocation-mb该参数后面会被舍弃

经常出现的内存溢出错误如下:
1、Container xxx is running beyond physical memory limits 
2、java heap space 
3、Error: GC overhead limit exceeded
比如:
报错1:Current usage: 1.1gb of 2.0gb physical memory used; 1.2gb of 1gb virtual memory used. Killing container.【即虚拟内存溢出】;
解决办法:提高yarn.nodemanager.vmem-pmem-ratio = 5或者更高

报错2:Current usage: 2.1gb of 2.0gb physical memory used; 3.6gb of 4.2gb virtual memory used. Killing container.【即物理内存溢出】;
解决办法:是mapreduce任务则提高mapreduce.map.memory.mb的值,到不报错为止,是其他类型的任务,比如spark则提高对应要申请的container内存大小

2. 虚拟cpu相关参数

参数

说明

默认值

yarn.nodemanager.resource.cpu-vcores

该nm能够分配的cpu数

-1

yarn.scheduler.minimum-allocation-vcores

单个Container可申请的最小虚拟CPU个数

1

yarn.scheduler.maximum-allocation-vcores

单个Container可申请的最大虚拟CPU个数

4

mapreduce.map.cpu.vcores

map的container申请的虚拟cpu数

1

说明:
yarn.nodemanager.resource.cpu-vcores
如果值是-1且yarn.nodemanager.resource.detect-hardware-capabilities值为true,则其cpu数目根据系统而定,否则默认值为8。

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值