容器使用超过了虚拟内存的限制大小,该容器被杀死,导致作业提交失败

is running beyond virtual memory limits. Current usage: 53.7 MB of 1 GB physical memory used; 4.4 GB of 2.1 GB virtual memory used. Killing container.
容器使用超过了虚拟内存的限制大小,该容器被杀死,导致作业提交失败

physical memory used
由于使用了默认虚拟内存率(也就是2.1倍),所以对于Map Task和Reduce Task总的虚拟内存为都为1G*2.1=2.1G。而应用的虚拟内存4.4G超过了这个数值,故报错 

解决方案:在启动Yarn是调节虚拟内存率或者应用运行时调节内存大小。
解决思路参考
要解决这个异常,得熟悉yarn自身的虚拟内存管理规则,在Yarn平台中,CPU,内存,磁盘都被抽象成资源来自使用,管理资源的角色主要有Yarn Resource Manager (RM) 负责总的资源调度,然后每个节点上有Nodemanager 来监听守护资源,在具体到每一个应用上是通过Application Master (AM) container来给Map或Reduce任务来分配资源
具体的属性如下:

  1. yarn.nodemanager.resource.memory-mb
    可分配的物理内存总量,默认是8*1024MB。
  2. yarn.nodemanager.vmem-pmem-ratio
    每单位的物理内存总量对应的虚拟内存量,默认是2.1,表示每使用1MB的物理内存,最多可以使用2.1MB的虚拟内存总量。
    第二个属性,比率的控制影响着虚拟内存的使用,当yarn计算出来的虚拟内存,比在mapred-site.xml里的mapreduce.map.memory.mb或mapreduce.reduce.memory.mb2.1倍还要多时,就会发生上面截图中的异常,而默认的mapreduce.map.memory.mb或mapreduce.reduce.memory.mb得初始大小为1024M,然后根据异常中的yarn自身根据运行环境推算出来的虚拟内存来做比较,发现比1024*2.1还要大,所以就会由NodeManage守护进程kill掉AM容器,
从而导致整个MR作业运行失败,现在我们只需要调大这个比率即可,避免发生这种异常。具体调大多小,可根据具体情况来设置。

详细解决配置设置(各集群根据自己的配置修改)

### Tiered Memory Page Migration in Operating Systems Tiered memory page migration is a memory management technique used in modern operating systems to optimize performance by leveraging different types of memory hardware with varying speeds and costs. The core idea is to place frequently accessed (hot) data in faster memory tiers, such as DRAM or non-volatile memory (NVM), while moving less frequently accessed (cold) data to slower, cheaper tiers like SSDs or even remote memory in distributed systems. This mechanism works by continuously monitoring memory access patterns and dynamically migrating memory pages between tiers based on their usage characteristics. The operating system uses various heuristics and profiling techniques to determine the hotness or coldness of memory pages. For instance, access frequency, recency, and temporal locality are commonly used metrics for this classification. The implementation typically involves several components: - **Page Classification**: The system identifies which pages are frequently accessed and which are not. This can be done using page access counters, last accessed timestamps, or more sophisticated statistical models. - **Migration Policies**: Once pages are classified, the system applies policies to decide when and how to migrate them. These policies may include thresholds for access frequency, time-based criteria, or adaptive algorithms that learn from workload behavior. - **Migration Mechanism**: The actual movement of pages between memory tiers must be efficient and transparent to applications. This involves updating page tables, ensuring data consistency, and minimizing performance overhead during migration. A practical example of tiered memory management can be found in Linux’s Memory Controller (memcg) and its integration with the kernel’s page migration framework. The system can be configured to move memory pages between NUMA nodes or between different memory technologies based on access patterns. ```c // Example pseudo-code for a simple page migration policy void migrate_pages() { foreach (page in all_pages) { if (is_hot(page) && current_tier(page) != FAST_TIER) { migrate_to_fast_tier(page); } else if (is_cold(page) && current_tier(page) != SLOW_TIER) { migrate_to_slow_tier(page); } } } ``` The effectiveness of tiered memory page migration depends on the accuracy of the classification and the efficiency of the migration process. If implemented well, it can significantly improve system performance and resource utilization without requiring additional hardware investments. ###
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

撸依天

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值