Home Database Mysql Tutorial Hadoop 新特性、改进、优化和Bug分析系列5:YARN-3

Hadoop 新特性、改进、优化和Bug分析系列5:YARN-3

Jun 07, 2016 pm 04:30 PM
bug hadoop optimization analyze Improve new features characteristic series

作者: Dong | 新浪微博: 西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明 网址:http://dongxicheng.org/mapreduce-nextgen/hadoop-jira-yarn-3/ 本博客的文章集合:http://dongxicheng.org/recommend/ 重大消息:我的Hadoop新书


重大消息:我的Hadoop新书《Hadoop技术内幕:深入解析MapReduce架构设计与实现原理》已经开始在各大网站销售了,购书链接地址: 当当购书网址,京东购书网址,卓越购书网址。新书官方宣传主页: http://hadoop123.com/。

Hadoop jira链接:https://issues.apache.org/jira/browse/YARN-3
所属范围(新特性、改进、优化或Bug):新特性
修复版本:2.0.3-alpha及以上版本
所属分支(Common、HDFS、YARN或MapReduce):YARN
涉及模块:nodemanager
英文标题:“Add support for CPU isolation/monitoring of containers”

背景介绍

YARN作为一个资源管理系统,主要由两个组件构成,分别是ResourceManager和NodeManager,其中,ResourceManager负责整个集群上资源的管理和分配,而NodeManager则负责单个节点的资源管理和任务启动,这两个组件必须充分发挥各自的作用才能完成资源的有效利用,缺一不可。ResourceManager将资源分配给应用程序的ApplicationMaster,比如将资源分配给appMaster1,而appMaster1则会进一步与node1上的NodeManager通信,启动一个占用1CPU和2GB内存的任务,为了确保该任务“占且仅占”这些资源,NodeManager必须提供合理的隔离机制,提供一个资源容器保证这些资源的前提下,还要防止它多占用资源干扰其他任务。

与之对比,MRv1采用了JVM进行资源隔离,而JVM仅能对内存资源进行限定,其他资源,包括CPU、网络等资源则无法隔离。在资源隔离上,YARN要不MRv1要先进得多。

解决方案

提供资源隔离机制是YARN NodeManager的责任,针对不同的资源,YARN采用了不同的资源隔离机制,而本文涉及到的YARN-3则全面介绍了YARN的资源隔离机制,总结起来,当前YARN针对CPU和内存两种资源提供了隔离机制,其中,CPU采用了CGroups轻量级资源隔离机制,而内存则采用了线程监控的方案。

由于YARN的目标是构建一个通用的资源管理平台,不仅仅限于Java编写的MapReduce这类应用,更多的是非java程序,因此,MRv1基于JVM的资源隔离方案是不可行的。

对于CGroups而言,它可以限制应用程序的内存使用上限,当内存超过某个阈值时,它将直接将其杀死。对于一些应用程序而言,有些情况下会出现内存暴增而又骤降的现象,因此采用硬性限制的策略是缺乏灵活性的,基于这种考虑,YARN仍采用了MRv1中的基于线程监控的方案,该方案启动一个线程监控当前正在运行的任务的进程树,如果发现内存暴增而又骤降,则认为是正常现象,不会将任务杀死,因此,该方案更加友好。

由于CPU资源的多少不会影响任务的生死(只影响任务执行的快慢),因此,YARN采用了CGroups对CPU资源进行隔离,需要注意的是,CGroups采用的是CPU资源下限控制法,该方法是一种公平共享的方法,举个例子,如果一个节点上有8个核(pcore:vcore=1:1),那么如果只运行一个任务(pcore=1),则它最多使用800%的CPU,如果运行2个任务(pcore=1),则每个任务最多可使用400%的CPU,依次类推……

当前,YARN的资源隔离方面还有很多需要改进的地方,比如,支持更细粒度的资源隔离,例如将任务绑定到某个CPU上(已经在做了,使用taskset命令);支持更多类型的资源隔离,比如网络和磁盘IO等(这个依赖于CGroups的发展,当前CGoups在这方面还不完善)。

如何配置?

【注】 配置参数是在https://issues.apache.org/jira/browse/YARN-2中引入的。这部分内容我已在我的博客文章“YARN/MRv2 ResourceManager深入剖析——资源调度器”中进行了详细介绍。

当前YARN支持内存和CPU两种资源类型的管理和分配。当NodeManager启动时,会向ResourceManager注册,而注册信息中会包含该节点可分配的CPU和内存总量,这两个值均可通过配置选项设置(在yarn-site.xml文件中),具体如下:

(1)yarn.nodemanager.resource.memory-mb

该节点可分配的物理内存总量,默认是8*1024MB。

(2)yarn.nodemanager.vmem-pmem-ratio

每单位的物理内存总量对应的虚拟内存量,默认是2.1,表示每使用1MB的物理内存,最多可以使用2.1MB的虚拟内存总量。

(3)yarn.nodemanager.resource.cpu-core(默认是8

可分配的CPU总个数,默认是8

(4)yarn.nodemanager.vcores-pcores-ratio

为了更细粒度的划分CPU资源,YARN将每个物理CPU划分成若干个虚拟CPU,默认值为2用户提交应用程序时,可以指定每个任务需要的虚拟CPU个数。在MRAppMaster中,每个Map Task和Reduce Task默认情况下需要的虚拟CPU个数为1,用户可分别通过mapreduce.map.cpu.vcores和mapreduce.reduce.cpu.vcores进行修改(对于内存资源,Map Task和Reduce Task默认情况下需要1024MB,用户可分别通过mapreduce.map.memory.mb和mapreduce.reduce.memory.mb修改)。

(在最新版本中,yarn.nodemanager.resource.cpu-core和yarn.nodemanager.vcores-pcores-ratio两个参数被遗弃,引入一个新参数yarn.nodemanager.resource.cpu-vcore,表示虚拟CPU个数,具体请阅读YARN-782)

为了启用CGroups和内存线程监控,你可以按照该文档” Hadoop MapReduce Next Generation – Cluster Setup”说明进行配置,安装时请一定要先阅读这篇文章:Using YARN with CGroups。

扩展阅读:

(1)“Hook up cgroups CPU settings to the number of virtual cores allocated”:https://issues.apache.org/jira/browse/YARN-600

(2)“CgroupsLCEResourcesHandler tries to write to cgroup.procs”:https://issues.apache.org/jira/browse/YARN-799

(3)“Support CGroup ceiling enforcement on CPU”:https://issues.apache.org/jira/browse/YARN-810

原创文章,转载请注明: 转载自董的博客

本文链接地址: http://dongxicheng.org/mapreduce-nextgen/hadoop-jira-yarn-3/

作者:Dong,作者介绍:http://dongxicheng.org/about/

本博客的文章集合:http://dongxicheng.org/recommend/


Copyright © 2013
This feed is for personal, non-commercial use only.
The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:
)
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Apple iOS18 bug summary Apple iOS18 bug summary Jun 14, 2024 pm 01:48 PM

As Apple's WWDC conference 2024 came to a successful conclusion, not only macos15 was announced, but the update of Apple's new iOS18 system attracted the most attention. Although there are many new features, as the first version of Apple's iOS18, people inevitably wonder whether it is necessary to upgrade Apple. iOS18, what kind of bugs are there in the latest release of Apple iOS18? After real use evaluation, the following is a summary of Apple iOS18 bugs, let’s take a look. Currently, many iPhone users are rushing to upgrade to iOS18. However, various system bugs are making people uncomfortable. Some bloggers said that you should be cautious when upgrading to iOS18 because "there are so many bugs." The blogger said that if your iPhone is

Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan Aug 22, 2024 pm 06:47 PM

The Xiaomi Mi 15 series is expected to be officially released in October, and its full series codenames have been exposed in the foreign media MiCode code base. Among them, the flagship Xiaomi Mi 15 Ultra is codenamed "Xuanyuan" (meaning "Xuanyuan"). This name comes from the Yellow Emperor in Chinese mythology, which symbolizes nobility. Xiaomi 15 is codenamed "Dada", while Xiaomi 15Pro is named "Haotian" (meaning "Haotian"). The internal code name of Xiaomi Mi 15S Pro is "dijun", which alludes to Emperor Jun, the creator god of "The Classic of Mountains and Seas". Xiaomi 15Ultra series covers

C++ program optimization: time complexity reduction techniques C++ program optimization: time complexity reduction techniques Jun 01, 2024 am 11:19 AM

Time complexity measures the execution time of an algorithm relative to the size of the input. Tips for reducing the time complexity of C++ programs include: choosing appropriate containers (such as vector, list) to optimize data storage and management. Utilize efficient algorithms such as quick sort to reduce computation time. Eliminate multiple operations to reduce double counting. Use conditional branches to avoid unnecessary calculations. Optimize linear search by using faster algorithms such as binary search.

The best time to buy Huawei Mate 60 series, new AI elimination + image upgrade, and enjoy autumn promotions The best time to buy Huawei Mate 60 series, new AI elimination + image upgrade, and enjoy autumn promotions Aug 29, 2024 pm 03:33 PM

Since the Huawei Mate60 series went on sale last year, I personally have been using the Mate60Pro as my main phone. In nearly a year, Huawei Mate60Pro has undergone multiple OTA upgrades, and the overall experience has been significantly improved, giving people a feeling of being constantly new. For example, recently, the Huawei Mate60 series has once again received a major upgrade in imaging capabilities. The first is the new AI elimination function, which can intelligently eliminate passers-by and debris and automatically fill in the blank areas; secondly, the color accuracy and telephoto clarity of the main camera have been significantly upgraded. Considering that it is the back-to-school season, Huawei Mate60 series has also launched an autumn promotion: you can enjoy a discount of up to 800 yuan when purchasing the phone, and the starting price is as low as 4,999 yuan. Commonly used and often new products with great value

Are there any class-like object-oriented features in Golang? Are there any class-like object-oriented features in Golang? Mar 19, 2024 pm 02:51 PM

There is no concept of a class in the traditional sense in Golang (Go language), but it provides a data type called a structure, through which object-oriented features similar to classes can be achieved. In this article, we'll explain how to use structures to implement object-oriented features and provide concrete code examples. Definition and use of structures First, let's take a look at the definition and use of structures. In Golang, structures can be defined through the type keyword and then used where needed. Structures can contain attributes

How to optimize the startup items of WIN7 system How to optimize the startup items of WIN7 system Mar 26, 2024 pm 06:20 PM

1. Press the key combination (win key + R) on the desktop to open the run window, then enter [regedit] and press Enter to confirm. 2. After opening the Registry Editor, we click to expand [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorer], and then see if there is a Serialize item in the directory. If not, we can right-click Explorer, create a new item, and name it Serialize. 3. Then click Serialize, then right-click the blank space in the right pane, create a new DWORD (32) bit value, and name it Star

Analyze whether Tencent's main programming language is Go Analyze whether Tencent's main programming language is Go Mar 27, 2024 pm 04:21 PM

Title: Is Tencent’s main programming language Go: An in-depth analysis. As China’s leading technology company, Tencent has always attracted much attention in its choice of programming languages. In recent years, some people believe that Tencent mainly adopts Go as its main programming language. This article will conduct an in-depth analysis of whether Tencent's main programming language is Go, and give specific code examples to support this view. 1. Application of Go language in Tencent Go is an open source programming language developed by Google. Its efficiency, concurrency and simplicity are loved by many developers.

Vivox100s parameter configuration revealed: How to optimize processor performance? Vivox100s parameter configuration revealed: How to optimize processor performance? Mar 24, 2024 am 10:27 AM

Vivox100s parameter configuration revealed: How to optimize processor performance? In today's era of rapid technological development, smartphones have become an indispensable part of our daily lives. As an important part of a smartphone, the performance optimization of the processor is directly related to the user experience of the mobile phone. As a high-profile smartphone, Vivox100s's parameter configuration has attracted much attention, especially the optimization of processor performance has attracted much attention from users. As the "brain" of the mobile phone, the processor directly affects the running speed of the mobile phone.

See all articles