Hadoop 新特性、改进、优化和Bug分析系列5:YARN-3
作者: Dong | 新浪微博: 西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明 网址:http://dongxicheng.org/mapreduce-nextgen/hadoop-jira-yarn-3/ 本博客的文章集合:http://dongxicheng.org/recommend/ 重大消息:我的Hadoop新书
作者:Dong | 新浪微博:西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明
网址:http://dongxicheng.org/mapreduce-nextgen/hadoop-jira-yarn-3/
本博客的文章集合:http://dongxicheng.org/recommend/
重大消息:我的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,比如将资源
与之对比,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:
)

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1
Powerful PHP integrated development environment