FIFO 调度:
此方式是 Hadoop 最早的调度方式, 实现方式简单, 同一时刻只允许一个作业运行, 按照作业的提交顺序来运行, 让其享有集群的全部资源, 优势是实现简单, 劣势是让当运行某些大作业时, 小作业难以得到及时的处理.
Capacity 调度(2.X的默认调度策略):
官方介绍:
The CapacityScheduler is designed to allow sharing a large cluster while giving each organization capacity guarantees. The central idea is that the available resources in the Hadoop cluster are shared among multiple organizations who collectively fund the cluster based on their computing needs. There is an added benefit that an organization can access any excess capacity not being used by others. This provides elasticity for the organizations in a cost-effective manner.
明确的可以看到, 容量调度设计的初衷是用来在不同组织之间共享集群资源的.
容量调度策略的粒度是基于组织的, 将集群资源分配成几个队列,给某个组织使用, 一个组织内的用户共享着一个组织所分配到的队列资源, 队列之间的资源是可以抢占的, 当一个队列空闲时, 其资源会被其他较忙的队列使用.
此外, 一个队列内的调度方式为 FIFO 调度.
更多:
详细博文
官方文档
Fair 调度:
官方介绍:
Fair scheduling is a method of assigning resources to applications such that all apps get, on average, an equal share of resources over time.
公平调度粒度是在用户之间的不同队列的, 如有 A , B 两个用户, 分别使用 A , B 两个队列, A 用户在 A 队列中提交的所有任务会共享 A 队列的资源, 如果此时 B 用户无任务运行, A 队列可以使用集群全部资源, 但是 A 用户在 A 队列中提交的任务会同时运行, 并共享资源.
官方文档阅读记录:
-
公平调度可以让小作业及时得到相应, 大作业也不会导致其饥饿.
-
公平调度默认只有一个root父队列, default 子队列, 且所有的 leaf queen 只能在 root 父队列下
-
公平调度队列中的每一个队列可以单独配置调度方式, 也可以自定义实现调度类, 预定义的有 fifo, fair, drf(主导资源公平共享) 这三种.
-
公平调度默认只是基于 memory 来进行公平决策, 可以通过配置同时使用 内存和cpu
-
公平调度策略还可以使用自动队列放置策略, 即 cluster 中同时存在多个队列, 对于即将到来的 application 可以让 schedules 自动选择将其放置到哪一个 queen 去执行.
-
公平调度配置文件: fair-scheduler.xml , 该文件 10 秒加载一次.