CapacityScheduler.apt.vm 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License. See accompanying LICENSE file.
  12. ---
  13. Hadoop Map Reduce Next Generation-${project.version} - Capacity Scheduler
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. Hadoop MapReduce Next Generation - Capacity Scheduler
  18. \[ {{{./index.html}Go Back}} \]
  19. %{toc|section=1|fromDepth=0}
  20. * {Purpose}
  21. This document describes the <<<CapacityScheduler>>>, a pluggable scheduler
  22. for Hadoop which allows for multiple-tenants to securely share a large cluster
  23. such that their applications are allocated resources in a timely manner under
  24. constraints of allocated capacities.
  25. * {Overview}
  26. The <<<CapacityScheduler>>> is designed to run Hadoop applications as a
  27. shared, multi-tenant cluster in an operator-friendly manner while maximizing
  28. the throughput and the utilization of the cluster.
  29. Traditionally each organization has it own private set of compute resources
  30. that have sufficient capacity to meet the organization's SLA under peak or
  31. near peak conditions. This generally leads to poor average utilization and
  32. overhead of managing multiple independent clusters, one per each organization.
  33. Sharing clusters between organizations is a cost-effective manner of running
  34. large Hadoop installations since this allows them to reap benefits of
  35. economies of scale without creating private clusters. However, organizations
  36. are concerned about sharing a cluster because they are worried about others
  37. using the resources that are critical for their SLAs.
  38. The <<<CapacityScheduler>>> is designed to allow sharing a large cluster while
  39. giving each organization capacity guarantees. The central idea is
  40. that the available resources in the Hadoop cluster are shared among multiple
  41. organizations who collectively fund the cluster based on their computing
  42. needs. There is an added benefit that an organization can access
  43. any excess capacity no being used by others. This provides elasticity for
  44. the organizations in a cost-effective manner.
  45. Sharing clusters across organizations necessitates strong support for
  46. multi-tenancy since each organization must be guaranteed capacity and
  47. safe-guards to ensure the shared cluster is impervious to single rouge
  48. application or user or sets thereof. The <<<CapacityScheduler>>> provides a
  49. stringent set of limits to ensure that a single application or user or queue
  50. cannot consume dispropotionate amount of resources in the cluster. Also, the
  51. <<<CapacityScheduler>>> provides limits on initialized/pending applications
  52. from a single user and queue to ensure fairness and stability of the cluster.
  53. The primary abstraction provided by the <<<CapacityScheduler>>> is the concept
  54. of <queues>. These queues are typically setup by administrators to reflect the
  55. economics of the shared cluster.
  56. To provide further control and predictability on sharing of resources, the
  57. <<<CapacityScheduler>>> supports <heirarchical queues> to ensure
  58. resources are shared among the sub-queues of an organization before other
  59. queues are allowed to use free resources, there-by providing <affinity>
  60. for sharing free resources among applications of a given organization.
  61. * {Features}
  62. The <<<CapacityScheduler>>> supports the following features:
  63. * Heirarchical Queues - Heirarchy of queues is supported to ensure resources
  64. are shared among the sub-queues of an organization before other
  65. queues are allowed to use free resources, there-by providing more control
  66. and predictability.
  67. * Capacity Guarantees - Queues are allocated a fraction of the capacity of the
  68. grid in the sense that a certain capacity of resources will be at their
  69. disposal. All applications submitted to a queue will have access to the
  70. capacity allocated to the queue. Adminstrators can configure soft limits and
  71. optional hard limits on the capacity allocated to each queue.
  72. * Security - Each queue has strict ACLs which controls which users can submit
  73. applications to individual queues. Also, there are safe-guards to ensure
  74. that users cannot view and/or modify applications from other users.
  75. Also, per-queue and system administrator roles are supported.
  76. * Elasticity - Free resources can be allocated to any queue beyond it's
  77. capacity. When there is demand for these resources from queues running below
  78. capacity at a future point in time, as tasks scheduled on these resources
  79. complete, they will be assigned to applications on queues running below the
  80. capacity. This ensures that resources are available in a predictable and
  81. elastic manner to queues, thus preventing artifical silos of resources in
  82. the cluster which helps utilization.
  83. * Multi-tenancy - Comprehensive set of limits are provided to prevent a
  84. single application, user and queue from monpolizing resources of the queue
  85. or the cluster as a whole to ensure that the cluster isn't overwhelmed.
  86. * Operability
  87. * Runtime Configuration - The queue definitions and properties such as
  88. capacity, ACLs can be changed, at runtime, by administrators in a secure
  89. manner to minimize disruption to users. Also, a console is provided for
  90. users and administrators to view current allocation of resources to
  91. various queues in the system. Administrators can also
  92. <add additional queues> at runtime.
  93. * Drain applications - Administrators can <stop> queues
  94. at runtime to ensure that while existing applications run to completion,
  95. no new applications can be submitted. If a queue is in <<<STOPPED>>>
  96. state, new applications cannot be submitted to <itself> or
  97. <any of its child queueus>. Existing applications continue to completion,
  98. thus the queue can be <drained> gracefully. Administrators can also
  99. <start> the stopped queues.
  100. * Resource-based Scheduling - Support for resource-intensive applications,
  101. where-in a application can optionally specify higher resource-requirements
  102. than the default, there-by accomodating applications with differing resource
  103. requirements. Currently, <memory> is the the resource requirement supported.
  104. []
  105. * {Configuration}
  106. * Setting up <<<ResourceManager>>> to use <<<CapacityScheduler>>>
  107. To configure the <<<ResourceManager>>> to use the <<<CapacityScheduler>>>, set
  108. the following property in the <<conf/yarn-site.xml>>:
  109. *--------------------------------------+--------------------------------------+
  110. || Property || Value |
  111. *--------------------------------------+--------------------------------------+
  112. | <<<yarn.resourcemanager.scheduler.class>>> | |
  113. | | <<<org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.CapacityScheduler>>> |
  114. *--------------------------------------------+--------------------------------------------+
  115. * Setting up <queues>
  116. <<conf/capacity-scheduler.xml>> is the configuration file for the
  117. <<<CapacityScheduler>>>.
  118. The <<<CapacityScheduler>>> has a pre-defined queue called <root>. All
  119. queueus in the system are children of the root queue.
  120. Further queues can be setup by configuring
  121. <<<yarn.scheduler.capacity.root.queues>>> with a list of comma-separated
  122. child queues.
  123. The configuration for <<<CapacityScheduler>>> uses a concept called
  124. <queue path> to configure the heirarchy of queues. The <queue path> is the
  125. full path of the queue's heirarcy, starting at <root>, with . (dot) as the
  126. delimiter.
  127. A given queue's children can be defined with the configuration knob:
  128. <<<yarn.scheduler.capacity.<queue-path>.queues>>>
  129. Here is an example with three top-level child-queues <<<a>>>, <<<b>>> and
  130. <<<c>>> and some sub-queues for <<<a>>> and <<<b>>>:
  131. ----
  132. <property>
  133. <name>yarn.scheduler.capacity.root.queues</name>
  134. <value>a,b,c</value>
  135. <description>The queues at the this level (root is the root queue).
  136. </description>
  137. </property>
  138. <property>
  139. <name>yarn.scheduler.capacity.root.a.queues</name>
  140. <value>a1,a2</value>
  141. <description>The queues at the this level (root is the root queue).
  142. </description>
  143. </property>
  144. <property>
  145. <name>yarn.scheduler.capacity.root.b.queues</name>
  146. <value>b1,b2,b3</value>
  147. <description>The queues at the this level (root is the root queue).
  148. </description>
  149. </property>
  150. ----
  151. * Queue Properties
  152. * Resource Allocation
  153. *--------------------------------------+--------------------------------------+
  154. || Property || Description |
  155. *--------------------------------------+--------------------------------------+
  156. | <<<yarn.scheduler.capacity.<queue-path>.capacity>>> | |
  157. | | Queue <capacity> in percentage (%). |
  158. | | The sum of capacities for all queues, at each level, should be less than |
  159. | | or equal to 100. |
  160. | | Applications in the queue may consume more resources than the queue's |
  161. | | capacity if there are free resources, providing elasticity. |
  162. *--------------------------------------+--------------------------------------+
  163. | <<<yarn.scheduler.capacity.<queue-path>.maximum-capacity>>> | |
  164. | | Maximum queue capacity in percentage (%). |
  165. | | This limits the <elasticity> for applications in the queue. |
  166. *--------------------------------------+--------------------------------------+
  167. | <<<yarn.scheduler.capacity.<queue-path>.minimum-user-limit-percent>>> | |
  168. | | Each queue enforces a limit on the percentage of resources allocated to a |
  169. | | user at any given time, if there is demand for resources. The user limit |
  170. | | can vary between a minimum and maximum value. The former depends on the |
  171. | | number of users who have submitted applications, and the latter is set to |
  172. | | this property value. For e.g., suppose the value of this property is 25. |
  173. | | If two users have submitted applications to a queue, no single user can |
  174. | | use more than 50% of the queue resources. If a third user submits an |
  175. | | application, no single user can use more than 33% of the queue resources. |
  176. | | With 4 or more users, no user can use more than 25% of the queues |
  177. | | resources. A value of 100 implies no user limits are imposed. |
  178. *--------------------------------------+--------------------------------------+
  179. | <<<yarn.scheduler.capacity.<queue-path>.user-limit-factor>>> | |
  180. | | The multiple of the queue capacity which can be configured to allow a |
  181. | | single user to acquire more resources. By default this is set to 1 which |
  182. | | ensures that a single user can never take more than the queue's configured |
  183. | | capacity irrespective of how idle th cluster is. |
  184. *--------------------------------------+--------------------------------------+
  185. * Running and Pending Application Limits
  186. The <<<CapacityScheduler>>> supports the following parameters to control
  187. the runnign and pending applications:
  188. *--------------------------------------+--------------------------------------+
  189. || Property || Description |
  190. *--------------------------------------+--------------------------------------+
  191. | <<<yarn.scheduler.capacity.maximum-applications>>> | |
  192. | | Maximum number of jobs in the system which can be concurently active |
  193. | | both running and pending. Limits on each queue are directly proportional |
  194. | | to their queue capacities. |
  195. *--------------------------------------+--------------------------------------+
  196. | yarn.scheduler.capacity.maximum-am-resource-percent | |
  197. | | Maximum percent of resources in the cluster which can be used to run |
  198. | | application masters - controls number of concurrent running applications. |
  199. *--------------------------------------+--------------------------------------+
  200. * Queue Administration & Permissions
  201. The <<<CapacityScheduler>>> supports the following parameters to
  202. the administer the queues:
  203. *--------------------------------------+--------------------------------------+
  204. || Property || Description |
  205. *--------------------------------------+--------------------------------------+
  206. | <<<yarn.scheduler.capacity.<queue-path>.state>>> | |
  207. | | The <state> of the queue. Can be one of <<<RUNNING>>> or <<<STOPPED>>>. |
  208. | | If a queue is in <<<STOPPED>>> state, new applications cannot be |
  209. | | submitted to <itself> or <any of its child queueus>. |
  210. | | Thus, if the <root> queue is <<<STOPPED>>> no applications can be |
  211. | | submitted to the entire cluster. |
  212. | | Existing applications continue to completion, thus the queue can be
  213. | | <drained> gracefully. |
  214. *--------------------------------------+--------------------------------------+
  215. | <<<yarn.scheduler.capacity.root.<queue-path>.acl_submit_jobs>>> | |
  216. | | The <ACL> which controls who can <submit> jobs to the given queue. |
  217. | | If the given user/group has necessary ACLs on the given queue or |
  218. | | <one of the parent queues in the hierarchy> they can submit jobs. |
  219. *--------------------------------------+--------------------------------------+
  220. | <<<yarn.scheduler.capacity.root.<queue-path>.acl_administer_jobs>>> | |
  221. | | The <ACL> which controls who can <administer> jobs on the given queue. |
  222. | | If the given user/group has necessary ACLs on the given queue or |
  223. | | <one of the parent queues in the hierarchy> they can administer jobs. |
  224. *--------------------------------------+--------------------------------------+
  225. <Note:> An <ACL> is of the form <user1>, <user2><space><group1>, <group2>.
  226. The special value of <<*>> implies <anyone>. The special value of <space>
  227. implies <no one>.
  228. * Reviewing the configuration of the CapacityScheduler
  229. Once the installation and configuration is completed, you can review it
  230. after starting the YARN cluster from the web-ui.
  231. * Start the YARN cluster in the normal manner.
  232. * Open the <<<ResourceManager>>> web UI.
  233. * The </scheduler> web-page should show the resource usages of individual
  234. queues.
  235. []
  236. * {Changing Queue Configuration}
  237. Changing queue properties and adding new queues is very simple. You need to
  238. edit <<conf/capacity-scheduler.xml>> and run <rmadmin -refreshQueues>.
  239. ----
  240. $ vi $HADOOP_CONF_DIR/capacity-scheduler.xml
  241. $ $YARN_HOME/bin/rmadmin -refreshQueues
  242. ----
  243. <Note:> Queues cannot be <deleted>, only addition of new queues is supported -
  244. the updated queue configuration should be a valid one i.e. queue-capacity at
  245. each <level> should be equal to 100%.