Beruflich Dokumente
Kultur Dokumente
Approaches to Sharing
FIFO : In FIFO scheduling, a JobTracker pulls jobs from a work queue, oldest
job first. This schedule had no concept of the priority or size of the job
Fair : Assign resources to jobs such that on average over time, each job gets
an equal share of the available resources. The result is that jobs that require
less time are able to access the CPU and finish intermixed with the execution
of jobs that require more time to execute. This behavior allows for some
interactivity among Hadoop jobs and permits greater responsiveness of the
Hadoop cluster to the variety of job types submitted.
Capacity : In capacity scheduling, instead of pools, several queues are
created, each with a configurable number of map and reduce slots. Each
queue is also assigned a guaranteed capacity (where the overall capacity of
the cluster is the sum of each queue's capacity). Queues are monitored; if a
queue is not consuming its allocated capacity, this excess capacity can be
temporarily allocated to other queues.
FIFO Scheduling
Job Queue
FIFO Scheduling
Job Queue
FIFO Scheduling
Job Queue
Separate clusters
Problem 1: poor utilization
Problem 2: costly data replication
Full replication across clusters nearly infeasible at
Facebook/Yahoo! scale
Partial replication prevents cross-dataset queries
Fair Scheduling
Job Queue
Fair Scheduling
Job Queue
Pools
Determined from a configurable job property
Default in 0.20: user.name (one pool per user)
emp1
emp2
emp6
finance
min share = 30
min share = 40
job 1
job 2
job 3
job 4
30 slots
15 slots
15 slots
40 slots
Scheduling Algorithm
Split each pools min share among its jobs
Split each pools total share among its jobs
When a slot needs to be assigned:
If there is any job below its min share, schedule it
Else schedule the job that weve been most unfair to
(based on deficit)
Scheduler Dashboard
Scheduler Dashboard
Change priority
Change pool
Additional Features
Weights for unequal sharing:
Job weights based on priority (each level = 2x)
Job weights based on size
Pool weights
ant package
Place it on the classpath:
cp
build/contrib/fairscheduler/*.jar
lib
Configuration Files
Hadoop config (conf/mapred-site.xml)
Contains scheduler options, pointer to pools file
Minimal hadoop-site.xml
<property>
<name>mapred.jobtracker.taskScheduler</name>
<value>org.apache.hadoop.mapred.FairScheduler</
value>
</property>
<property>
<name>mapred.fairscheduler.allocation.file</nam
e>
<value>/path/to/pools.xml</value>
</property>
Minimal pools.xml
<?xml version="1.0"?>
<allocations>
</allocations>
Configuring a Pool
<?xml version="1.0"?>
<allocations>
<pool name=emp4">
<minMaps>10</minMaps>
<minReduces>5</minReduces>
</pool>
</allocations>
Other Parameters
mapred.fairscheduler.assignmultiple:
Assign a map and a reduce on each heartbeat;
improves ramp-up speed and throughput;
recommendation: set to true
Other Parameters
mapred.fairscheduler.poolnameproperty:
Which JobConf property sets what pool a job is in
- Default: user.name (one pool per user)
- Can make up your own, e.g. pool.name, and pass in
JobConf with conf.set(pool.name, mypool)
Useful Setting
<property>
<name>mapred.fairscheduler.poolnameproperty</name>
<value>pool.name</value>
</property>
<property>
<name>pool.name</name>
<value>${user.name}</value>
</property>
The Problem
Master
Job 1
Job 2
Scheduling order
File 1:
File 2:
Task 2
Task 5
Task 3
Task 1
Task 7
Task 4
Slave
Slave
Slave
Slave
Slave
Slave
2
1
8
2
The Problem
Master
Job 2
Job 1
Scheduling order
File 1:
File 2:
Task 2
Task 5
1
Task 3
Task 1
2
Task 7
Task 4
3
Slave
Slave
Slave
Slave
Slave
Slave
2
1
8
2
Job 2
Job 1
Scheduling order
File 1:
File 2:
Task 2
1
Task 5
8
Task 3
Task 3
1
2
Task 7
Task 4
6
Slave
Slave
Slave
Slave
Slave
Slave
2
1
8
2
Capacity Scheduler
End of session
Day 1: Scheduling