Hadoop层级队列组织方式
作者: Dong | 新浪微博: 西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明 网址:http://dongxicheng.org/mapreduce/hadoop-hierarchy-queues/ 在Hadoop 0.20.x版本或者更早的版本,Hadoop采用了平级队列组织方式,在这种组织方
作者:Dong | 新浪微博:西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明
网址:http://dongxicheng.org/mapreduce/hadoop-hierarchy-queues/
在Hadoop 0.20.x版本或者更早的版本,Hadoop采用了平级队列组织方式,在这种组织方式中,管理员可将用户分到若干个扁平队列中,在每个队列中,可指定一个或几个队列管理员管理这些用户,比如杀死任意用户的作业,修改任意用户作业的优先级。然而,从资源管理角度看,仅仅按照队列组织用户是不够的,还需要将资源划分到这几个队列中,并按照一定的策略完成资源分配,这就需要Hadoop作业调度器的支持。总之,在Hadoop中,队列的组织是队列管理和资源分配的基础。
随着Hadoop应用越来越广泛,有用户提出需支持层级队列组织方式。典型的应用场景如下:在一个Hadoop集群中,管理员将所有计算资源划分给了若干个队列,每个队列对应了一个“组织”,其中有一个组织“Org1”,它分到了60%的资源,它内部包含3中类型的作业:
(1)产品线作业
(2)实验性作业—分属于三个不用的项目:Proj1,Proj2和Proj3
(3)其他类型作业
Org1管理员想更有效地控制这60%资源,比如将大部分资源分配给产品线作业的同时,能够让实验性作业和其他类型作业有最少资源保证。考虑到产品线作业提交频率很低,当有产品线作业提交时,必须第一时间得到资源,剩下的资源才给其他类型的作业,然而,一旦产品线作业运行结束,实验性作业和其他类型作业必须马上获取未使用的资源,一个可能的配置方式如下:
grid { Org1 min=60% { priority min=90% { production min=82% proj1 min=6% max=10% proj2 min=6% proj3 min=6% } miscellaneous min=10% } Org2 min=40% }
这就引出来层级队列组织方式。
(1) 子队列
1)? 队列可以嵌套,每个队列均可以包含子队列。
2)? 用户只能将作业提交到最底层的队列,即叶子队列。
(2)最少容量
1)每个子队列均有一个“最少容量比”属性,表示可以使用父队列的容量的百分比
2)调度器总是优先选择当前资源使用率最低的队列,并为之分配资源。比如同级的两个队列Q1和Q2,他们的最少容量均为30,而Q1已使用10,Q2已使用12,则调度器会优先将资源分配给Q1。
3)最少容量不是“总会保证的最低容量”,也就是说,如果一个队列的最少容量为20,而该队列中所有队列仅使用了5,那么剩下的15可能会分配给其他需要的队列。
4)最少容量的值为不小于0的数,但也不能大于“最大容量”。
(3) 最大容量
1)? 为了防止一个队列超量使用资源,可以为队列设置一个最大容量,这是一个资源使用上限,任何时刻使用的资源总量不能超过该值。
2) 默认情况下队列的最大容量是无限大,这意味着,当一个队列只分配了20%的资源,所有其他队列没有作业时,该队列可能使用100%的资源,当其他队列有作业提交时,再逐步归还。
如何将一个队列中的资源分配给它的各个子队列?
当一个TaskTracker发送心跳请求一个新任务时,调度器会按照以下策略为之选择任务:
1)? 按照 比值{used capacity}/{minimum-capaity},对所有子队列排序;
2)? 选择一个比值{used capacity}/{minimum-capaity}最小的队列:
如果是一个叶子队列,且有处于pending状态的任务,则选择一个任务(不能超过maximum capacity);
否则,递归地从这个队列的子队列中选择任务。
3)? 如果没有找到任务,则查看下一个队列。
层级队列组织方式在 0.21.x和0.22.x中引入,但仅有Capacity Scheduler支持该组织方式(https://issues.apache.org/jira/browse/MAPREDUCE-824 ),当然,最新的YARN(Hadoop 0.23.x和2.0.x-alpha)也为Fair Scheduler增加了层级队列的支持,具体参考:https://issues.apache.org/jira/browse/YARN-187。
如何配置?
以0.21.x为例,管理员可在配置文件mapred-queues.xml中配置层级队列,配置方式如下:
<queues> <queue> <name>Org1</name> <queue> <name>production</name> <properties> <property key="”capacity”" value="”20″/"> <property key="”" maximum-capacity value="”20″/"> <property key="”supports-priority”" value="”true”/"> <property key="”minimum-user-limit-percent”" value="”30″/"> <property key="”maximum-initialized-jobs-per-user”" value="”10″/"> <property key="”user-limit”" value="”30″/"> </property></property></property></property></property></property></properties> </queue> <queue> <name>miscellaneous</name> <properties> <property key="”capacity”" value="”10″/"> <property key="”" maximum-capacity value="”20″/"> <property key="”user-limit”" value="”20″/"> </property></property></property></properties> </queue> 。。。。。。。 </queue></queues>
管理员可在capacity-scheduler.xml中设置一些参数的默认值和Capacity独有的配置:
<configuration> <property> <name>mapred.capacity-scheduler.default-supports-priority</name> <value>false</value> </property> <property> <name>mapred.capacity-scheduler.default-minimum-user-limit-percent</name> <value>100</value> </property> <property> <name>mapred.capacity-scheduler.default-maximum-initialized-jobs-per-user</name> <value>2</value> </property> <property> <name>mapred.capacity-scheduler.init-poll-interval</name> <value>5000</value> </property> <property> <name>mapred.capacity-scheduler.init-worker-threads</name> <value>5</value> </property> </configuration>
原创文章,转载请注明: 转载自董的博客
本文链接地址: http://dongxicheng.org/mapreduce/hadoop-hierarchy-queues/
作者:Dong,作者介绍:http://dongxicheng.org/about/
Copyright © 2012
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:
)

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Application summary of queue technology in message delay and message retry in PHP and MySQL: With the continuous development of web applications, the demand for high concurrency processing and system reliability is getting higher and higher. As a solution, queue technology is widely used in PHP and MySQL to implement message delay and message retry functions. This article will introduce the application of queue technology in PHP and MySQL, including the basic principles of queues, methods of using queues to implement message delay, and methods of using queues to implement message retries, and give

Performance Analysis and Optimization Strategy of JavaQueue Queue Summary: Queue (Queue) is one of the commonly used data structures in Java and is widely used in various scenarios. This article will discuss the performance issues of JavaQueue queues from two aspects: performance analysis and optimization strategies, and give specific code examples. Introduction Queue is a first-in-first-out (FIFO) data structure that can be used to implement producer-consumer mode, thread pool task queue and other scenarios. Java provides a variety of queue implementations, such as Arr

Implementation of queue task monitoring and task scheduling in PHP and MySQL Introduction In modern web application development, task queue is a very important technology. Through queues, we can queue some tasks that need to be executed in the background, and control the execution time and order of tasks through task scheduling. This article will introduce how to implement task monitoring and scheduling in PHP and MySQL, and provide specific code examples. 1. Working principle of queue Queue is a first-in-first-out (FIFO) data structure that can be used to

Java big data technology stack: Understand the application of Java in the field of big data, such as Hadoop, Spark, Kafka, etc. As the amount of data continues to increase, big data technology has become a hot topic in today's Internet era. In the field of big data, we often hear the names of Hadoop, Spark, Kafka and other technologies. These technologies play a vital role, and Java, as a widely used programming language, also plays a huge role in the field of big data. This article will focus on the application of Java in large

Queue and asynchronous processing optimization methods in the PHP flash sale system With the rapid development of the Internet, various preferential activities on e-commerce platforms, such as flash sales and rush sales, have also become the focus of users. However, this high concurrent user request is a huge challenge for traditional PHP applications. In order to improve the performance and stability of the system and solve the pressure caused by concurrent requests, developers need to optimize the flash sale system. This article will focus on the optimization methods achieved through queues and asynchronous processing in the PHP flash sale system, and give specific code examples.

Implementation methods of queue message confirmation and consumption failure handling in PHP and MySQL Queue is a common message passing mechanism, which can help solve high concurrency problems in the system and achieve asynchronous processing and decoupling. In the design of the queue, message confirmation and consumption failure handling are very important links. This article will explore how to use PHP and MySQL to implement queue message confirmation and consumption failure handling, and provide specific code examples. Message confirmation is in the queue. Message confirmation means that after the consumer successfully processes the message, it sends it to the queue.

For example, given a binary search tree, we need to reverse its path from a specific key. Ways to find the solution In this approach we will create a queue and push all the nodes until we get the root node. p>Example #include<bits/stdc++.h>usingnamespacestd;structnode{ intkey; structnode*left,*right;};structnode*newNode(intitem){&nb

How to implement delayed sending of messages through PHP queue? In actual development, we often encounter situations where we need to delay sending messages. For example, send SMS verification code, send push notification, etc. PHP queue can help us achieve such needs by putting messages into the queue and setting the delay time to achieve delayed sending of messages. This article will introduce how to implement delayed sending of messages through PHP queues and provide specific code examples. 1. Using Redis as a queue server When implementing a message queue, we can choose
