Container killed by YARN for exceeding memory limits
19/08/12 14:15:35 ERROR cluster.YarnScheduler: Lost executor 5 on worker01.hadoop.mobile.cn: Container killed by YARN for exceeding memory limits. 5 GB of 5 GB physical memory used. Consider boosting spark.yarn.executor.memoryOverhead.
在看这个问题之前,首先解释下下面参数的含义:
hadoop yarn-site.xml部分资源定义相关参数,更详细的内容可参考官网链接
yarn.nodemanager.resource.memory-mb //每个NodeManager可以供yarn调度(分配给container)的物理内存,单位MB yarn.nodemanager.resource.cpu-vcores //每个NodeManager可以供yarn调度(分配给container)的vcore个数 yarn.scheduler.maximum-allocation-mb //每个container能够申请到的最大内存 yarn.scheduler.minimum-allocation-mb //每个container能够申请到的最小内存,如果设置的值比该值小,默认就是该值 yarn.scheduler.increment-allocation-mb //container内存不够用时一次性加多少内存 单位MB。CDH默认512M yarn.scheduler.minimum-allocation-vcores //每个container能够申请到的最小vcore个数,如果设置的值比该值小,默认就是该值 yarn.scheduler.maximum-allocation-vcores //每个container能够申请到的最大vcore个数。 yarn.nodemanager.pmem-check-enabled //是否对contanier实施物理内存限制,会通过一个线程去监控container内存使用情况,超过了container的内存限制以后,就会被kill掉。 yarn.nodemanager.vmem-check-enabled //是否对container实施虚拟内存限制
executor-memory和executor-memory-overhead源码含义
EXECUTOR_MEMORY: Amount of memory to use per executor process EXECUTOR_MEMORY_OVERHEAD: The amount of off-heap memory to be allocated per executor in cluster mode
spark.yarn.executor.memoryOverhead源代码实现:
val MEMORY_OVERHEAD_FACTOR = 0.10 val MEMORY_OVERHEAD_MIN = 384L
// Executor memory in MB. protected val executorMemory = sparkConf.get(EXECUTOR_MEMORY).toInt // Additional memory overhead. protected val memoryOverhead: Int = sparkConf.get(EXECUTOR_MEMORY_OVERHEAD).getOrElse( math.max((MEMORY_OVERHEAD_FACTOR * executorMemory).toInt, MEMORY_OVERHEAD_MIN)).toInt
到这里,可能有的同学大概就明白了,比如设置了--executor-memory为2G,为什么报错时候是Container killed by YARN for exceeding memory limits. 2.5 GB of 2.5 GB physical memory used,2.5G从哪里来的?是这样,首先计算出memoryOverhead 默认值是max(2G*0.1,384),也就是384M,又根据上面的yarn.scheduler.increment-allocation-mb值,就会分配2G+512M大小的container...
好了,我们再看问题,从报错的描述上可以大概了解到,container超过了内存的限制从而被kill掉,从上面的参数yarn.nodemanager.pmem-check-enabled可以了解到该参数默认是true,也就是会由它来控制监控container的内存使用,所以第一步我们可以尝试关闭该参数看应用是否可以正常运行
调整一:设置yarn.nodemanager.pmem-check-enabled=false
结果:应用成功运行,但是关闭了对container内存的监控,虽然可以运行,但是明显没有实际性的处理问题,而且不可控的内存使用,对多租户的环境不友好
调整二:根据提示 Consider boosting spark.yarn.executor.memoryOverhead
但是什么是memoryOverhead呢? 如下图:
container内存使用情况的时线图:
尝试提升spark.yarn.executor.memoryOverhead参数值至1.5G,可以看到container预留了更多空间给 OS overhead,没有超过container的内存限制
不过很明显,我们是牺牲内存资源来换取应用稳定性。
但是真正的原因到底是什么呢?看下图:
每个任务都是通过NIO channel 去获取shuffle文件。并且所需的缓冲区是从OS overheads中分配的,这也就导致了os overhead越来越大,因此我们也可以通过减少并行度来减少同时运行的任务来尝试避免这样的问题。
调整三:降低参数--excutor-cores值
结果也可以成功运行,但是同样,我们是牺牲了应用的性能和cpu的利用率来换取应用稳定性。
最后,如果有同学单独调整以上参数应用仍然不可用的话,可以尝试上述多种方式同时使用,另外注意
1.对于发生shuffle的算子,比如groupby,可以通过repartition提升并行度
2.避免数据倾斜
Container killed by YARN for exceeding memory limits的更多相关文章
- Hive-Container killed by YARN for exceeding memory limits. 9.2 GB of 9 GB physical memory used. Consider boosting spark.yarn.executor.memoryOverhead.
Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task times, most recen ...
- hadoop的job执行在yarn中内存分配调节————Container [pid=108284,containerID=container_e19_1533108188813_12125_01_000002] is running beyond virtual memory limits. Current usage: 653.1 MB of 2 GB physical memory used
实际遇到的真实问题,解决方法: 1.调整虚拟内存率yarn.nodemanager.vmem-pmem-ratio (这个hadoop默认是2.1) 2.调整map与reduce的在AM中的大小大于y ...
- Kafka:ZK+Kafka+Spark Streaming集群环境搭建(十三)kafka+spark streaming打包好的程序提交时提示虚拟内存不足(Container is running beyond virtual memory limits. Current usage: 119.5 MB of 1 GB physical memory used; 2.2 GB of 2.1 G)
异常问题:Container is running beyond virtual memory limits. Current usage: 119.5 MB of 1 GB physical mem ...
- spark运行任务报错:Container [...] is running beyond physical memory limits. Current usage: 3.0 GB of 3 GB physical memory used; 5.0 GB of 6.3 GB virtual memory used. Killing container.
spark版本:1.6.0 scala版本:2.10 报错日志: Application application_1562341921664_2123 failed 2 times due to AM ...
- [hadoop] - Container [xxxx] is running beyond physical/virtual memory limits.
当运行mapreduce的时候,有时候会出现异常信息,提示物理内存或者虚拟内存超出限制,默认情况下:虚拟内存是物理内存的2.1倍.异常信息类似如下: Container [pid=13026,cont ...
- Container [pid=6263,containerID=container_1494900155967_0001_02_000001] is running beyond virtual memory limits
以Spark-Client模式运行,Spark-Submit时出现了下面的错误: User: hadoop Name: Spark Pi Application Type: SPARK Applica ...
- hive: insert数据时Error during job, obtaining debugging information 以及beyond physical memory limits
insert overwrite table canal_amt1...... 2014-10-09 10:40:27,368 Stage-1 map = 100%, reduce = 32%, Cu ...
- hadoop is running beyond virtual memory limits问题解决
单机搭建了2.6.5的伪分布式集群,写了一个tf-idf计算程序,分词用的是结巴分词,使用standalone模式运行没有任何问题,切换到伪分布式模式运行一直报错: hadoop is running ...
- 运行hadoop的时候提示物理内存或虚拟内存溢出的解决方案running beyond physical memory或者beyond vitual memory limits
当运行中出现Container is running beyond physical memory这个问题出现主要是因为物理内存不足导致的,在执行mapreduce的时候,每个map和reduce都有 ...
随机推荐
- C#跟Lua如何超高性能传递数据
前言 在UWA学堂上线那天,我买了招文勇这篇Lua交互的课程,19块还算值,但是前段时间太忙,一直没空研究,他的demo是基于xlua的,今天终于花了大半天时间在tolua下跑起来了,记录一下我的理解 ...
- 洛谷P3275 [SCOI2011]糖果 题解
题目链接: https://www.luogu.org/problemnew/show/P3275 分析: 本题就是一个裸的差分约束. 核心: x=1x=1x=1时,a=b,a−>b,b−> ...
- UVA816 Abbott的复仇 Abbott's Revenge
以此纪念一道用四天时间完结的题 敲了好几次代码的出错点:(以下均为正确做法) memset初始化 真正的出发位置必须找出. 转换东西南北的数组要从0开始. bfs没有初始化第一个d 是否到达要在刚刚取 ...
- SpringBoot | 第三十八章:基于RabbitMQ实现消息延迟队列方案
前言 前段时间在编写通用的消息通知服务时,由于需要实现类似通知失败时,需要延后几分钟再次进行发送,进行多次尝试后,进入定时发送机制.此机制,在原先对接银联支付时,银联的异步通知也是类似的,在第一次通知 ...
- 使用java Apache poi 根据word模板生成word报表
项目开发过程中,客户提出一堆导出报表的需求,需要导出word格式,页眉还需要加上客户公司的logo,试了几种方案,最后选择了用 Apache poi 加上自定义标签的方式实现. 目前功能还比较简单,一 ...
- Centos7配置BIND开机自启动
Centos7上面已经把/etc/init.d/服务的启动方式更改为systemctl启动. 当然编译安装仍然可以/etc/init.d/手动启动但是chkconfig –add named就用不了. ...
- 温故而知新,重温 Java 7 的那些“新”特性
2009 年 4 月 20 日,Java 的亲生父亲 Sun 被养父 Oracle 以 74 亿美元收购,这在当时可是一件天大的事.有不少同学都担心 Java 的前途,我当时傻不啦叽地也很担心:自己刚 ...
- element 上传组件 el-upload 的经验总结
前言 最近在做后台管理项目,采用的 vue-element-admin ,上传图片是一个很常用的功能,也遇到了很多问题,刚好趁此机会做一些总结. 初步总结下会提到的问题,目录如下: el-upload ...
- 金蝶K3 V12.2版本,中途启用双计量单位出现错误
忘记修改虚仓库存/收料通知单的双计量数量
- ASP.NET Core on K8S深入学习(1)K8S基础知识与集群搭建
在上一个小系列文章<ASP.NET Core on K8S学习初探>中,通过在Windows上通过Docker for Windows搭建了一个单节点的K8S环境,并初步尝试将ASP.NE ...