John Kubiatowicz and Anthony D. Joseph Electrical Engineering and Computer Sciences - PowerPoint PPT Presentation

vevina
eecs 262a advanced topics in computer systems lecture 13 m cbs con t and drf october 10 th 2012 n.
Skip this Video
Loading SlideShow in 5 Seconds..
John Kubiatowicz and Anthony D. Joseph Electrical Engineering and Computer Sciences PowerPoint Presentation
Download Presentation
John Kubiatowicz and Anthony D. Joseph Electrical Engineering and Computer Sciences

play fullscreen
1 / 59
Download Presentation
John Kubiatowicz and Anthony D. Joseph Electrical Engineering and Computer Sciences
94 Views
Download Presentation

John Kubiatowicz and Anthony D. Joseph Electrical Engineering and Computer Sciences

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. EECS 262a Advanced Topics in Computer SystemsLecture 13M-CBS(Con’t) and DRFOctober 10th, 2012 John Kubiatowicz and Anthony D. Joseph Electrical Engineering and Computer Sciences University of California, Berkeley http://www.eecs.berkeley.edu/~kubitron/cs262

  2. Online Scheduling for Realtime

  3. Schedulability Test • Test to determine whether a feasible schedule exists • Sufficient Test • If test is passed, then tasks are definitely schedulable • If test is not passed, tasks may be schedulable, but not necessarily • Necessary Test • If test is passed, tasks may be schedulable, but not necessarily • If test is not passed, tasks are definitely not schedulable • Exact Test (= Necessary + Sufficient) • The task set is schedulable if and only if it passes the test.

  4. Rate Monotonic Analysis: Assumptions A1: Tasks are periodic (activated at a constant rate). Period = Intervall between two consequtive activations of task A2: All instances of a periodic task have the same computation time A3: All instances of a periodic task have the same relative deadline, which is equal to the period A4: All tasks are independent (i.e., no precedence constraints and no resource constraints) Implicit assumptions: A5: Tasks are preemptable A6: No task can suspend itself A7: All tasks are released as soon as they arrive A8: All overhead in the kernel is assumed to be zero (or part of )

  5. Rate Monotonic Scheduling: Principle • Principle: Each process is assigned a (unique) priority based on its period (rate); always execute active job with highest priority • The shorter the period the higher the priority • ( 1 = low priority) • W.l.o.g. number the tasks in reverse order of priority

  6. Example: Rate Monotonic Scheduling • Example instance • RMA - Gant chart

  7. Example: Rate Monotonic Scheduling Deadline Miss 0 5 10 15 response time of job

  8. Utilization 0 5 10 15

  9. RMS: SchedulabilityTest Theorem (Utilization-based Schedulability Test): A periodic task set with is schedulable by the rate monotonic scheduling algorithm if This schedulability test is “sufficient”! • For harmonic periods ( evenly divides ), the utilization bound is 100%

  10. RMS Example The schedulability test requires Hence, we get does not satisfy schedulability condition

  11. EDF: Assumptions A1: Tasks are periodic or aperiodic. Period = Interval between two consequtive activations of task A2: All instances of a periodic task have the same computation time A3: All instances of a periodic task have the same relative deadline, which is equal to the period A4: All tasks are independent (i.e., no precedence constraints and no resource constraints) Implicit assumptions: A5: Tasks are preemptable A6: No task can suspend itself A7: All tasks are released as soon as they arrive A8: All overhead in the kernel is assumed to be zero (or part of )

  12. EDF Scheduling: Principle • Preemptive priority-based dynamic scheduling • Each task is assigned a (current) priority based on how close the absolute deadline is. • The scheduler always schedules the active task with the closest absolute deadline. 0 5 10 15

  13. EDF: Schedulability Test Theorem (Utilization-based Schedulability Test): A task set with is schedulable by the earliest deadline first (EDF) scheduling algorithm if Exact schedulability test (necessary + sufficient) Proof: [Liu and Layland, 1973]

  14. EDF Optimality EDF Properties • EDF is optimal with respect to feasibility (i.e., schedulability) • EDF is optimal with respect to minimizing the maximum lateness

  15. Real-Time Systems EDF Example: Domino Effect EDF minimizes lateness of the “most tardy task” [Dertouzos, 1974]

  16. Constant Bandwidth Server • Intuition: give fixed share of CPU to certain of jobs • Good for tasks with probabilistic resource requirements • Basic approach: Slots (called “servers”) scheduled with EDF, rather than jobs • CBS Server defined by two parameters: Qs and Ts • Mechanism for tracking processor usage so that no more than Qs CPU seconds used every Ts seconds (or whatever measurement you like) when there is demand. Otherwise get to use processor as you like • Since using EDF, can mix hard-realtime and soft realtime:

  17. Today’s Papers • Implementing Constant-Bandwidth Servers upon Multiprocessor PlatformsSanjoyBaruah, JoelGoossens, and Giuseppe Lipari . Appears in Proceedings of Real-Time and Embedded Technology and Applications Symposium, (RTAS), 2002. (From Last Time!) • Dominant Resource Fairness: Fair Allocation of Multiple Resources Types, A. Ghodsi, M. Zaharia, B. Hindman, A. Konwinski, S. Shenker, and I. Stoica, Usenix NSDI 2011, Boston, MA, March 2011 • Thoughts?

  18. CBS on multiprocessors • Basic problem: EDF not all that efficient on multiprocessors. • Schedulability constraint considerably less good than for uniprocessors. Need: • Key idea of paper: send highest-utilization jobs to specific processors, use EDF for rest • Minimizes number of processors required • New acceptance test:

  19. Is this a good paper? • What were the authors’ goals? • What about the evaluation/metrics? • Did they convince you that this was a good system/approach? • Were there any red-flags? • What mistakes did they make? • Does the system/approach meet the “Test of Time” challenge? • How would you review this paper today?

  20. What is Fair Sharing? CPU 100% 100% • n users want to share a resource (e.g., CPU) • Solution: Allocate each 1/n of the shared resource • Generalized by max-min fairness • Handles if a user wants less than its fair share • E.g. user 1 wants no more than 20% • Generalized by weighted max-min fairness • Give weights to users according to importance • User 1 gets weight 1, user 2 weight 2 33% 33% 33% 50% 50% 66% 33% 0% 0% 100% 20% 40% 50% 40% 0%

  21. Why is Fair Sharing Useful? 100% • Weighted Fair Sharing / Proportional Shares • User 1 gets weight 2, user 2 weight 1 • Priorities • Give user 1 weight 1000, user 2 weight 1 • Revervations • Ensure user 1 gets 10% of a resource • Give user 1 weight 10, sum weights ≤ 100 • Isolation Policy • Users cannot affect others beyond their fair share 50% 100% 66% 0% CPU 50% 33% 0% CPU 10% 50% 40%

  22. 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

  23. Why Care about Fairness? • Desirable properties of max-min fairness • Isolation policy: A user gets her fair share irrespective of the demands of other users • Flexibilityseparates mechanism from policy: Proportional sharing, priority, reservation,... • 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, ...

  24. When is Max-Min Fairness not Enough? • Need to schedule multiple,heterogeneous resources • Example: Task scheduling in datacenters • Tasks consume more than just CPU – CPU, memory, disk, and I/O • What are today’s datacenter task demands?

  25. Heterogeneous Resource Demands Some tasks are CPU-intensive Most task need ~ <2 CPU, 2 GB RAM> Some tasks are memory-intensive 2000-node Hadoop Cluster at Facebook (Oct 2010)

  26. Problem 100% Single resource example • 1 resource: CPU • User 1 wants <1 CPU> per task • User 2 wants <3 CPU> per task Multi-resource example • 2 resources: CPUs & memory • User 1 wants <1 CPU, 4 GB> per task • User 2 wants <3 CPU, 1 GB> per task • What is a fair allocation? 50% 50% 50% 0% CPU 100% ? ? 50% 0% CPU mem

  27. Problem definition How to fairly share multiple resources when users have heterogeneous demands on them?

  28. Demands at Facebook

  29. Model • Users have tasksaccording to a demand vector • e.g. <2, 3, 1> user’s tasks need 2 R1, 3 R2, 1 R3 • Not needed in practice, can simply measure actual consumption • Resources given in multiples of demand vectors • Assume divisible resources

  30. A Natural Policy: Asset Fairness • 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 • U2 needs <1 CPU, 2 GB RAM> per task • Asset fairness yields • U1: 15 tasks: 30 CPUs, 30 GB (∑=60) • U2: 20 tasks: 20 CPUs, 40 GB (∑=60) Problem User 1 has < 50% of both CPUs and RAM Better off in a separate cluster with 50% of the resources 43% 43% User 1 User 2 100% 57% 28% 50% 0% RAM CPU

  31. Share Guarantee • Every user should get 1/n of at least one resource • Intuition: • “You shouldn’t be worse off than if you ran your own cluster with 1/n of the resources”

  32. Desirable Fair Sharing Properties • Many desirable properties • Share Guarantee • Strategy proofness • Envy-freeness • Pareto efficiency • Single-resource fairness • Bottleneck fairness • Population monotonicity • Resource monotonicity DRF focuses on these properties

  33. Cheating the Scheduler • Some users will gamethe system to get more resources • 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! • A search company provided dedicated machines to users that could ensure certain level of utilization (e.g. 80%) • Users used busy-loops to inflate utilization

  34. Two Important Properties • Strategy-proofness • A user should not be able to increase her allocation by lying about her demand vector • Intuition: • Users are incentivized to make truthful resource requirements • Envy-freeness • No user would ever strictly prefer another user’s lot in an allocation • Intuition: • Don’t want to trade places with any other user

  35. Challenge • A fair sharing policy that provides • Strategy-proofness • Share guarantee • Max-min fairness for a single resource had these properties • Generalize max-min fairness to multiple resources

  36. Dominant Resource Fairness • A user’s dominant resource is the resource she has the biggest share of • Example: Total resources: <10 CPU, 4 GB> User 1’s allocation: <2 CPU, 1 GB> Dominant resource is memory as 1/4 > 2/10 (1/5) • A user’s dominant share is the fraction of the dominant resource she is allocated • User 1’s dominant share is 25% (1/4)

  37. Dominant Resource Fairness (2) • Apply max-min fairness to dominant shares • Equalize the dominant share of the users • Example: Total resources: <9 CPU, 18 GB> User 1 demand: <1 CPU, 4 GB> dominant res: mem User 2 demand: <3 CPU, 1 GB> dominant res: CPU 100% 12 GB User 1 3 CPUs User 2 66% 50% 66% 6 CPUs 2 GB 0% CPU (9 total) mem (18 total)

  38. DRF is Fair • DRF is strategy-proof • DRF satisfies the share guarantee • DRF allocations are envy-free See DRF paper for proofs

  39. Online DRF Scheduler • O(log n) time per decision using binary heaps • Need to determine demand vectors • Whenever there are available resources and tasks to run: • Schedule a task to the user with smallest dominant share

  40. Alternative: Use an Economic Model • Approach • Set prices for each good • Let users buy what they want • How do we determine the right prices for different goods? • Let the market determine the prices • 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!

  41. Determining Demand Vectors • They can be measured • Look at actual resource consumption of a user • They can be providedthe by user • What is done today • In both cases, strategy-proofness incentivizes user to consume resources wisely

  42. DRF vs CEEI • User 1: <1 CPU, 4 GB> User 2: <3 CPU, 1 GB> • DRF more fair, CEEI better utilization • User 1: <1 CPU, 4 GB> User 2: <3 CPU, 2 GB> • User 2 increased her share of both CPU and memory Competitive Equilibrium from Equal Incomes Dominant Resource Fairness Dominant Resource Fairness Competitive Equilibrium from Equal Incomes 100% 100% 100% 100% 66% 66% user 1 80% 91% 50% 50% 50% 50% user 2 66% 66% 60% 55% 0% 0% 0% 0% CPU mem CPU mem CPU mem CPU mem

  43. Gaming Utilization-Optimal Schedulers • Cluster with <100 CPU, 100 GB> • 2 users, each demanding <1 CPU, 2 GB> per task • User 1 lies and demands <2 CPU, 2 GB> • Utilization-Optimal scheduler prefers user 1 100% 100% User 2 User 1 50% 50% 50% 95% 0% 0% 50% CPU mem CPU mem

  44. 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% 100% User A 50% 50% 50% User B 0% 0% 0% CPU CPU Mem CPU Mem Mem a) DRF b) Asset Fairness c) CEEI

  45. Max/min Theorem for DRF • A user Ui has a bottleneck resource Rjin an allocation AiffRj is saturated and all users using Rjhave 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

  46. Desirable Fairness Properties (1) • Recall max/min fairness from networking • Maximize the bandwidth of the minimum flow [Bert92] • Progressive filling (PF) algorithm • Allocate ε to every flow until some link saturated • Freeze allocation of all flows on saturated link and goto 1

  47. Desirable Fairness Properties (2) • P1. Pareto Efficiency • 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 max/min fairness • P3. Bottleneck fairness • If all users want most of one resource(s), that resource should be shared according to max/min fairness

  48. 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

  49. Desirable Fairness Properties (4) • P4. Population Monotonicity • 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 • DRF satisfies population monotonicity • Assuming positive demands • Intuitively DRF gives the same dominant share to all users, so all users would be hurt contradicting Pareto efficiency

  50. Properties of Policies