D Dominant Resource Fairness (DRF) i t R F i (DRF) Fair - - PowerPoint PPT Presentation

d dominant resource fairness drf i t r f i drf
SMART_READER_LITE
LIVE PREVIEW

D Dominant Resource Fairness (DRF) i t R F i (DRF) Fair - - PowerPoint PPT Presentation

D Dominant Resource Fairness (DRF) i t R F i (DRF) Fair Allocation of Multiple Resource Types Ali Ghodsi , Matei Zaharia Benjamin Hindman, Andy Konwinski, B j i Hi d A d K i ki Scott Shenker, Ion Stoica University of California, Berkeley


slide-1
SLIDE 1

D i t R F i (DRF) Dominant Resource Fairness (DRF)

Fair Allocation of Multiple Resource Types

Ali Ghodsi, Matei Zaharia B j i Hi d A d K i ki Benjamin Hindman, Andy Konwinski, Scott Shenker, Ion Stoica University of California, Berkeley

alig@cs.berkeley.edu 1

slide-2
SLIDE 2

What is fair sharing?

CPU

1 0 0 %

  • n users want to share a resource (e.g. CPU)

– Solution:

1 0 0 % 5 0 %

33% 33%

Allocate each 1/n of the shared resource

0 %

33%

  • Generalized by max‐min fairness

– Handles if a user wants less than its fair share

1 0 0 % 5 0 %

20% 40%

– E.g. user 1 wants no more than 20%

G li d b i ht d i f i

5 0 % 0 %

40%

  • Generalized by weighted max‐min fairness

– Give weights to users according to importance User 1 gets weight 1 user 2 weight 2

1 0 0 % 5 0 %

33%

– User 1 gets weight 1, user 2 weight 2

alig@cs.berkeley.edu 2

5 0 % 0 %

66%

slide-3
SLIDE 3

Properties of max‐min fairness Properties of max min fairness

  • Share guarantee

– Each user can get at least 1/n of the resource – But will get less if her demand is less

  • Strategy‐proof

– Users are not better off by asking for more than they need – Users have no reason to lie

  • Max‐min fairness is the only ”reasonable” mechanism

with these two properties

alig@cs.berkeley.edu 3

slide-4
SLIDE 4

Why care about fairness? Why care about fairness?

  • Desirable properties of max‐min fairness

– Isolation policy: A user gets her fair share irrespective of the demands of

  • ther users
  • ther users

– Flexibility separates mechanism from policy: P i l h i i i i Proportional sharing, priority, reservation,...

  • Many schedulers use max‐min fairness

Many schedulers use max min fairness

– Datacenters: Hadoop’s fair sched, capacity, Quincy – OS: rr, prop sharing, lottery, linux cfs, ... – Networking: wfq, wf2q, sfq, drr, csfq, ...

alig@cs.berkeley.edu

slide-5
SLIDE 5

Why is max‐min fairness not enough? Why is max min fairness not enough?

  • Job scheduling in datacenters is not only

Job scheduling in datacenters is not only about CPUs

Jobs consume CPU memory disk and I/O – Jobs consume CPU, memory, disk, and I/O

D hi h ll ?

  • Does this pose any challenge?

alig@cs.berkeley.edu 5

slide-6
SLIDE 6

Heterogeneous Resource Demands

Some tasks are CPU‐intensive Most task need ~ <2 CPU, 2 GB RAM> Some tasks are memory‐intensive

alig@cs.berkeley.edu 6

2000‐node Hadoop Cluster at Facebook (Oct 2010)

slide-7
SLIDE 7

Problem Problem

Single resource example

1 0 0 % 50%

Single resource example

– 1 resource: CPU – User 1 wants <1 CPU> per task

5 0 % 50%

p – User 2 wants <3 CPU> per task

CPU 0 % 50%

Multi‐resource example

– 2 resources: CPUs & mem

1 0 0 %

– User 1 wants <1 CPU, 4 GB> per task – User 2 wants <3 CPU, 1 GB> per task

5 0 %

? ?

p – What’s a fair allocation?

alig@cs.berkeley.edu 7

CPU 0 % m em

slide-8
SLIDE 8

Problem definition

f i l h l i l h How to fairly share multiple resources when users have heterogenous demands on them?

alig@cs.berkeley.edu 8

slide-9
SLIDE 9

Talk Outline Talk Outline

  • What properties do we want?
  • How do we solve it (DRF)?
  • How would an economist solve this?
  • How well does this work in practice?

alig@cs.berkeley.edu 9

slide-10
SLIDE 10

Model Model

  • Users have tasks according to a demand vector

Users have tasks according to a demand vector

– e.g. <2, 3, 1> user’s tasks need 2 R1, 3 R2, 1 R3 Not needed in practice measure actual consumption – Not needed in practice, measure actual consumption

R i i lti l f d d t

  • Resources given in multiples of demand vectors
  • Assume divisible resources

10 alig@cs.berkeley.edu

slide-11
SLIDE 11

A Natural Policy

  • Asset Fairness

A Natural Policy

Asset Fairness

– Equalize each user’s sum of resource shares

  • Cluster with 70 CPUs, 70 GB RAM

– U1 needs <2 CPU, 2 GB RAM> per task

1

, p – U2 needs <1 CPU, 2 GB RAM> per task

alig@cs.berkeley.edu

slide-12
SLIDE 12

A Natural Policy

  • Asset Fairness

A Natural Policy

Asset Fairness

– Equalize each user’s sum of resource shares

User 1 User 2

  • Cluster with 70 CPUs, 70 GB RAM

– U1 needs <2 CPU, 2 GB RAM> per task

100% 43% 43%

Problem

User 1 has < 50% of both CPUs and RAM

1

, p – U2 needs <1 CPU, 2 GB RAM> per task

50% 57% 28%

Better off in a separate cluster with 50% of the resources

  • Asset fairness yields

– U1: 15 tasks: 30 CPUs, 30 GB (∑=60)

CPU 0% RAM

– U2: 20 tasks: 20 CPUs, 40 GB (∑=60)

alig@cs.berkeley.edu

slide-13
SLIDE 13

Share Guarantee Share Guarantee

  • Every user should get 1/n of at least one

Every user should get 1/n of at least one resource

  • Intuition:

– “You shouldn’t be worse off than if you ran your

  • wn cluster with 1/n of the resources”

13 alig@cs.berkeley.edu

slide-14
SLIDE 14

Cheating the Scheduler Cheating the Scheduler

  • Users willing to game the system to get more resources

g

g y g

  • Real‐life examples

– A cloud provider had quotas on map and reduce slots Some users found out that the map‐quota was low Users implemented maps in the reduce slots! – Users implemented maps in the reduce slots! – A search company provided dedicated machines to users p y p that could ensure certain level of utilization (e.g. 80%) – Users used busy‐loops to inflate utllization

alig@cs.berkeley.edu 14

slide-15
SLIDE 15

Strategy‐proofness Strategy proofness

  • A user should not be able to increase her

A user should not be able to increase her allocation by lying about her demand vector

  • Intuition:

– Users are incentivized to provide truthful resource requirements

15 alig@cs.berkeley.edu

slide-16
SLIDE 16

Challenge Challenge

  • Can we find a fair sharing policy that provides

Can we find a fair sharing policy that provides

– Strategy‐proofness Share guarantee – Share guarantee

M i f i f i l h d

  • Max‐min fairness for a single resource had

these properties

– Can we generalize max‐min fairness to multiple resources?

alig@cs.berkeley.edu 16

slide-17
SLIDE 17

Talk Outline Talk Outline

  • What properties do we want?
  • How do we solve it (DRF)?
  • How would an economist solve this?
  • How well does this work in practice?

alig@cs.berkeley.edu 17

slide-18
SLIDE 18

Dominant Resource Fairness Dominant Resource Fairness

  • A user’s dominant resource is the resource she

use s do a t esou ce s t e esou ce s e has the biggest share of

– Example: Total resources: <10 CPU, 4 GB> User 1’s allocation: <2 CPU, 1 GB> i i 1/4 2/10 (1/ ) Dominant resource is memory as 1/4 > 2/10 (1/5)

  • A user’s dominant share is the fraction of the
  • A user s dominant share is the fraction of the

dominant resource she is allocated

– User 1’s dominant share is 25% (1/4) User 1 s dominant share is 25% (1/4)

18 alig@cs.berkeley.edu

slide-19
SLIDE 19

Dominant Resource Fairness (2)

  • Apply max‐min fairness to dominant shares
  • Equalize the dominant share of the users

q

– Example: Total resources: <9 CPU, 18 GB> User 1 demand: <1 CPU, 4 GB> dom res: mem User 2 demand: <3 CPU, 1 GB> dom res: CPU

User 1 User 2 100% 3 CPUs 12 GB 66% 50% 66% 66%

19

0% CPU (9 total) mem (18 total) 6 CPUs 2 GB

slide-20
SLIDE 20

Online DRF Scheduler

Wh h il bl d k Whenever there are available resources and tasks to run: Schedule a task to the user with smallest dominant share

(l ) d b h

  • O(log n) time per decision using binary heaps

20 alig@cs.berkeley.edu

slide-21
SLIDE 21

Talk Outline Talk Outline

  • What properties do we want?
  • How do we solve it (DRF)?
  • How would an economist solve this?
  • How well does this work in practice?

alig@cs.berkeley.edu 21

slide-22
SLIDE 22

Why not use pricing? Why not use pricing?

  • Approach

Approach

– Set prices for each good Let users buy what they want – Let users buy what they want

P bl

  • Problem

– How do we determine the right prices for different d ? goods?

alig@cs.berkeley.edu 22

slide-23
SLIDE 23

How would an economist solve it? How would an economist solve it?

  • Let the market determine the prices

Let the market determine the prices C i i ilib i f l

  • Competitive Equilibrium from Equal Incomes

(CEEI)

– Give each user 1/n of every resource – Let users trade in a perfectly competitive market

  • Not strategy‐proof!

gy p

23 alig@cs.berkeley.edu

slide-24
SLIDE 24

DRF vs CEEI

  • User 1: <1 CPU, 4 GB> User 2: <3 CPU, 1 GB>

– DRF more fair, CEEI better utilization

Dominant Resource Fairness Competitive Equilibrium from Equal Incomes

user 1

100% 100%

q

66% 91%

user 2

50% 50%

66% 55% 91%

CPU mem

0%

CPU mem

0% 24 alig@cs.berkeley.edu

slide-25
SLIDE 25

DRF vs CEEI

  • User 1: <1 CPU, 4 GB> User 2: <3 CPU, 1 GB>

– DRF more fair, CEEI better utilization

Dominant Resource Fairness Competitive Equilibrium from Equal Incomes Dominant Resource Fairness Competitive Equilibrium from Equal Incomes

user 1

100% 100%

q

66% 91%

100% 100%

q

66% 80%

user 2

50% 50%

66% 55% 91%

50% 50%

66% 60% 80%

CPU mem

0%

CPU mem

0%

CPU mem

0%

CPU mem

0%

  • User 1: <1 CPU, 4 GB> User 2: <3 CPU, 2 GB>

– User 2 increased her share of both CPU and memory

25 alig@cs.berkeley.edu

slide-26
SLIDE 26

Gaming Utilization‐Optimal Schedulers Gaming Utilization Optimal Schedulers

  • Cluster with <100 CPU, 100 GB>

Cluster with 100 CPU, 100 GB

  • 2 users, each demanding <1 CPU, 2 GB> per task

100% User 1 User 2 100% 50%

50% 95%

50% 0%

50% 95%

CPU 0% mem

alig@cs.berkeley.edu 26

slide-27
SLIDE 27

Gaming Utilization‐Optimal Schedulers Gaming Utilization Optimal Schedulers

  • Cluster with <100 CPU, 100 GB>

Cluster with 100 CPU, 100 GB

  • 2 users, each demanding <1 CPU, 2 GB> per task

100% 100% User 1 User 2 100% 50% 100% 50%

50% 95%

50% 0% 50% 0%

50% 95%

  • User 1 lies and demands <2 CPU, 2 GB>

CPU 0% mem 0% CPU mem

alig@cs.berkeley.edu 27

  • Utilization‐Optimal scheduler prefers user 1
slide-28
SLIDE 28

Example of DRF vs Asset vs CEEI

  • Resources <1000 CPUs, 1000 GB>
  • 2 users A: <2 CPU, 3 GB> and B: <5 CPU, 1 GB>

100% 100% 00%

User A User B

100% 100% 100% 50% 50% 50% CPU M CPU M CPU M 0% 0% 0%

28

a) DRF b) Asset Fairness

CPU Mem CPU Mem CPU Mem

c) CEEI

slide-29
SLIDE 29

Properties of Policies Properties of Policies

Property Asset CEEI DRF p y Share guarantee ✔ ✔ Strategy‐proofness ✔ ✔ gy p Pareto efficiency ✔ ✔ ✔ Envy‐freeness ✔ ✔ ✔ Single resource fairness ✔ ✔ ✔ Bottleneck res. fairness ✔ ✔ Population monotonicity ✔ ✔ Resource monotonicity

alig@cs.berkeley.edu 29

slide-30
SLIDE 30

Talk Outline Talk Outline

  • What properties do we want?
  • How do we solve it (DRF)?
  • How would an economist solve this?
  • How well does this work in practice?

alig@cs.berkeley.edu 30

slide-31
SLIDE 31

Evaluation Methodology Evaluation Methodology

  • Micro‐experiments on EC2

Micro experiments on EC2

– Evaluate DRF’s dynamic behavior when demands change – Compare DRF with current Hadoop scheduler

  • Macro‐benchmark through simulations

– Simulate Facebook trace with DRF and current Hadoop scheduler

alig@cs.berkeley.edu 31

slide-32
SLIDE 32

DRF inside Mesos on EC2

User 1’s Shares User 2’s Shares

Dominant shares are equalized

Dominant Shares

equalized

slide-33
SLIDE 33

DRF inside Mesos on EC2

Dominant resource is memory

User 1’s Shares

Dominant resource Dominant resource is CPU

User 2’s Shares

Share guarantee: Share guarantee: ~70% dominant share

Dominant Shares

slide-34
SLIDE 34

DRF inside Mesos on EC2

Dominant resource is CPU

User 1’s Shares

Dominant resource Dominant resource is CPU

User 2’s Shares

Share guarantee: Share guarantee: ~50% dominant share

Dominant Shares

slide-35
SLIDE 35

How is fairness solved in datacenters today? How is fairness solved in datacenters today?

  • Hadoop Fair Scheduler/capacity/Quincy

– Each machine consists of k slots (e.g. k=14) ( g ) – Run at most one task per slot – Give jobs ”equal” number of slots, Give jobs equal number of slots, i.e., apply max‐min fairness to slot‐count

  • This is what we compare against

35

slide-36
SLIDE 36

Experiment: DRF vs Slots

Number of Type 1 Jobs Finished Number of Type 1 Jobs Finished

Th hi shed Thrashing

  • bs finis

Number of Type 2 Jobs Finished

J

yp

Low utilization Thrashing ished g Jobs fin Type 1 jobs <2 CPU, 2 GB> Type 2 jobs <1 CPU, 0.5GB>

slide-37
SLIDE 37

Experiment: DRF vs Slots

Completion Time of Type 1 Jobs p yp

Thrashing pletion e

  • b comp

time

Completion Time of Type 2 Jobs

Jo

Completion Time of Type 2 Jobs

Low utilization hurts performance Thrashing pletion e

  • b comp

time Type 1 job <2 CPU, 2 GB> Type 2 job <1 CPU, 0.5GB> Jo

slide-38
SLIDE 38

Reduction in Job Completion Time DRF vs slots DRF vs slots

  • Simulation of 1‐week Facebook traces

alig@cs.berkeley.edu 38

slide-39
SLIDE 39

Utilization of DRF vs slots

  • Simulation of Facebook workload

alig@cs.berkeley.edu 39

slide-40
SLIDE 40

Conclusion Conclusion

  • DRF provides multiple‐resource fairness in the

DRF provides multiple resource fairness in the presence of heterogenous demand

– First generalization of max min fairness to – First generalization of max‐min fairness to multiple‐resources

  • DRF’s properties

Sh t t l t 1/ f – Share guarantee, at least 1/n of one resource – Strategy‐proofness, lying can only hurt you P f b h h – Performs better than current approaches

40 alig@cs.berkeley.edu

slide-41
SLIDE 41

Conjecture

i h l ” bl ” li h i fi

  • DRF is the only ”reasonable” policy that satisfies

– Strategy‐proofness – Share guarantee

alig@cs.berkeley.edu 41

slide-42
SLIDE 42

Future Work Future Work

  • How to pack tasks to get high utilization

How to pack tasks to get high utilization

  • Use DRF as a OS scheduler

Use DRF as a OS scheduler

  • DRF with placement constraints

DRF with placement constraints

42 alig@cs.berkeley.edu

slide-43
SLIDE 43

How do we know the demand vectors? How do we know the demand vectors?

  • They can be measured

They can be measured

– Look at actual resource consumption of a user

  • They can be provided the by user

– What is done today

  • In both cases, strategy‐proofness incentivizes user to

consume resources wisely

alig@cs.berkeley.edu 43

slide-44
SLIDE 44

References References

  • [Gree09] A. Greenberg, J. Hamilton, D. Maltz, P. Patel, ”The

Cost of a Cloud: Research Problems in Data Center Networks”, Sigcomm CCR 39:1, 2009

  • [Bert92] D. Bertsekas, R. Gallager, ”Data Networks”,

Prentice Hall, 1992

  • [Varian74] H. Varian, ”Equity, envy, and efficiency”, Journal
  • f Economic Theory 9(1):63–91, 1974
  • [Young94] H. Peyton Young, ”Equity: in theory and

practise”, Princeton University, 1994

44 alig@cs.berkeley.edu

slide-45
SLIDE 45

Appendix Appendix

  • A user Ui has a bottleneck resource Rj in an

A user Ui has a bottleneck resource Rj in an allocation A iff Rj is saturated and all users using Rj have a smaller (or equal) dominant using Rj have a smaller (or equal) dominant share than Ui

  • Max/min Theorem for DRF

– An allocation A is max/min fair iff every user has a bottleneck resource

45 alig@cs.berkeley.edu

slide-46
SLIDE 46

Appendix 2 Appendix 2

  • Recall max/min fairness from networking

Recall max/min fairness from networking

– Maximize the bandwidth of the minimum flow [Bert92] [Bert92]

P i filli (PF) l ith

  • Progressive filling (PF) algorithm
  • 1. Allocate ε to every flow until some link saturated
  • 2. Freeze allocation of all flows on saturated link

and goto 1

46 alig@cs.berkeley.edu

slide-47
SLIDE 47

Appendix 3 Appendix 3

  • P1. Pareto Efficiency

. a eto ff c e cy

  • It should not be possible to allocate more resources to any user

without hurting others

  • P2. Single‐resource fairness
  • If there is only one resource, it should be allocated according to

y , g max/min fairness

  • P3 Bottleneck fairness
  • P3. Bottleneck fairness
  • If all users want most of one resource(s), that resource should

be shared according to max/min fairness

alig@cs.berkeley.edu 47

slide-48
SLIDE 48

Appendix C bl ( ) Desirable Fairness Properties (3)

  • Assume positive demands (Dij > 0 for all i and j)
  • DRF will allocate same dominant share to all users

– As soon as PF saturates a resource, allocation frozen

48 alig@cs.berkeley.edu

slide-49
SLIDE 49

Appendix C ( ) Datacenter Properties (1)

  • P4. Population Monotonicity

If l d li i h h – If a user leaves and relinquishes her resources, no other user’s allocation should get hurt – Can happen each time a job finishes

  • CEEI violates population monotonicity

49 alig@cs.berkeley.edu

slide-50
SLIDE 50

Appendix C ( ) Datacenter Properties (2)

  • DRF satisfies population monotonicity

A i iti d d – Assuming positive demands – Intuitively DRF gives the same dominant share to all users so all users would be hurt contradicting all users, so all users would be hurt contradicting Pareto efficiency

50 alig@cs.berkeley.edu

slide-51
SLIDE 51

Appendix C h h bl The unreachable

  • Resource Monotonicity (RM)

Resource Monotonicity (RM)

– If a resource is increased, no user’s allocation will decrease decrease

  • Impossible to satisfy together with Share
  • Impossible to satisfy together with Share

Guarante and Pareto Efficiency

51 alig@cs.berkeley.edu