Download - Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah [email protected] KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Transcript
Page 1: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Resource ManagementMesos and YARN

Amir H. [email protected]

KTH Royal Institute of Technology

Amir H. Payberah (KTH) Resource Management 2016/10/14 1 / 49

Page 2: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Motivation

I Rapid innovation in cloud computing.

I No single framework optimal for all applications.

Amir H. Payberah (KTH) Resource Management 2016/10/14 2 / 49

Page 3: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Motivation

I Rapid innovation in cloud computing.

I No single framework optimal for all applications.

I Running each framework on its dedicated cluster:• Expensive• Hard to share data

Amir H. Payberah (KTH) Resource Management 2016/10/14 2 / 49

Page 4: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Proposed Solution

I Running multiple frameworks on a single cluster.

I Maximize utilization and share data between frameworks.

I Two resource management systems:• Mesos• YARN

Amir H. Payberah (KTH) Resource Management 2016/10/14 3 / 49

Page 5: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos

Amir H. Payberah (KTH) Resource Management 2016/10/14 4 / 49

Page 6: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos

Mesos

A common resource sharing layer, over which diverseframeworks can run

Amir H. Payberah (KTH) Resource Management 2016/10/14 5 / 49

Page 7: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos

Mesos

A common resource sharing layer, over which diverseframeworks can run

Amir H. Payberah (KTH) Resource Management 2016/10/14 5 / 49

Page 8: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos Goals

I High utilization of resources

I Support diverse frameworks (current and future)

I Scalability to 10,000’s of nodes

I Reliability in face of failures

Amir H. Payberah (KTH) Resource Management 2016/10/14 6 / 49

Page 9: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Computation Model

I A framework (e.g., Hadoop, Spark) manages and runs one or morejobs.

I A job consists of one or more tasks.

I A task (e.g., map, reduce) consists of one or more processes runningon same machine.

Amir H. Payberah (KTH) Resource Management 2016/10/14 7 / 49

Page 10: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Computation Model

I A framework (e.g., Hadoop, Spark) manages and runs one or morejobs.

I A job consists of one or more tasks.

I A task (e.g., map, reduce) consists of one or more processes runningon same machine.

Amir H. Payberah (KTH) Resource Management 2016/10/14 7 / 49

Page 11: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Computation Model

I A framework (e.g., Hadoop, Spark) manages and runs one or morejobs.

I A job consists of one or more tasks.

I A task (e.g., map, reduce) consists of one or more processes runningon same machine.

Amir H. Payberah (KTH) Resource Management 2016/10/14 7 / 49

Page 12: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Computation Model

I A framework (e.g., Hadoop, Spark) manages and runs one or morejobs.

I A job consists of one or more tasks.

I A task (e.g., map, reduce) consists of one or more processes runningon same machine.

Amir H. Payberah (KTH) Resource Management 2016/10/14 7 / 49

Page 13: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos Design Elements

I Fine-grained sharing

I Resource offers

Amir H. Payberah (KTH) Resource Management 2016/10/14 8 / 49

Page 14: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Fine-Grained Sharing

I Allocation at the level of tasks within a job.

I Improves utilization, latency, and data locality.

Coarse-grained sharing Fine-grained sharing

Amir H. Payberah (KTH) Resource Management 2016/10/14 9 / 49

Page 15: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Resource Offer

I Offer available resources to frameworks, let them pick which re-sources to use and which tasks to launch.

I Keeps Mesos simple, lets it support future frameworks.

Amir H. Payberah (KTH) Resource Management 2016/10/14 10 / 49

Page 16: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Question?

How to schedule resource offering among frameworks?

Amir H. Payberah (KTH) Resource Management 2016/10/14 11 / 49

Page 17: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Schedule Frameworks

I Global scheduler

I Distributed scheduler

Amir H. Payberah (KTH) Resource Management 2016/10/14 12 / 49

Page 18: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Global Scheduler (1/2)

I Job requirements• Response time• Throughput• Availability

I Job execution plan• Task DAG• Inputs/outputs

I Estimates• Task duration• Input sizes• Transfer sizes

Amir H. Payberah (KTH) Resource Management 2016/10/14 13 / 49

Page 19: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Global Scheduler (2/2)

I Advantages• Can achieve optimal schedule.

I Disadvantages• Complexity: hard to scale and ensure resilience.• Hard to anticipate future frameworks requirements.• Need to refactor existing frameworks.

Amir H. Payberah (KTH) Resource Management 2016/10/14 14 / 49

Page 20: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Distributed Scheduler (1/3)

Amir H. Payberah (KTH) Resource Management 2016/10/14 15 / 49

Page 21: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Distributed Scheduler (2/3)

I Unit of allocation: resource offer• Vector of available resources on a node• For example, node1: 〈1CPU, 1GB〉, node2: 〈4CPU, 16GB〉

I Master sends resource offers to frameworks.

I Frameworks select which offers to accept and which tasks to run.

Amir H. Payberah (KTH) Resource Management 2016/10/14 16 / 49

Page 22: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Distributed Scheduler (3/3)

I Advantages• Simple: easier to scale and make resilient.• Easy to port existing frameworks, support new ones.

I Disadvantages• Distributed scheduling decision: not optimal.

Amir H. Payberah (KTH) Resource Management 2016/10/14 17 / 49

Page 23: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos Architecture (1/4)

I Slaves continuously send status updates about resources to the Master.

Amir H. Payberah (KTH) Resource Management 2016/10/14 18 / 49

Page 24: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos Architecture (2/4)

I Pluggable scheduler picks framework to send an offer to.

Amir H. Payberah (KTH) Resource Management 2016/10/14 19 / 49

Page 25: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos Architecture (3/4)

I Framework scheduler selects resources and provides tasks.

Amir H. Payberah (KTH) Resource Management 2016/10/14 20 / 49

Page 26: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Mesos Architecture (4/4)

I Framework executors launch tasks.

Amir H. Payberah (KTH) Resource Management 2016/10/14 21 / 49

Page 27: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Question?

How to allocate resources of different types?

Amir H. Payberah (KTH) Resource Management 2016/10/14 22 / 49

Page 28: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Single Resource: Fair Sharing

I n users want to share a resource, e.g., CPU.• Solution: allocate each 1

n of the shared resource.

CPU

I Generalized by max-min fairness.• Handles if a user wants less than its fair share.• E.g., user 1 wants no more than 20%.

I Generalized by weighted max-min fairness.• Give weights to users according to importance.• E.g., user 1 gets weight 1, user 2 weight 2.

Amir H. Payberah (KTH) Resource Management 2016/10/14 23 / 49

Page 29: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Single Resource: Fair Sharing

I n users want to share a resource, e.g., CPU.• Solution: allocate each 1

n of the shared resource.

CPU

I Generalized by max-min fairness.• Handles if a user wants less than its fair share.• E.g., user 1 wants no more than 20%.

I Generalized by weighted max-min fairness.• Give weights to users according to importance.• E.g., user 1 gets weight 1, user 2 weight 2.

Amir H. Payberah (KTH) Resource Management 2016/10/14 23 / 49

Page 30: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Single Resource: Fair Sharing

I n users want to share a resource, e.g., CPU.• Solution: allocate each 1

n of the shared resource.

CPU

I Generalized by max-min fairness.• Handles if a user wants less than its fair share.• E.g., user 1 wants no more than 20%.

I Generalized by weighted max-min fairness.• Give weights to users according to importance.• E.g., user 1 gets weight 1, user 2 weight 2.

Amir H. Payberah (KTH) Resource Management 2016/10/14 23 / 49

Page 31: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Max-Min Fairness

I 1 resource: CPU

I Total resources: 20 CPU

I User 1 has x tasks and wants 〈1CPU〉 per task

I User 2 has y tasks and wants 〈2CPU〉 per task

max(x, y) (maximize allocation)subject tox+ 2y ≤ 20 (CPU constraint)x = 2y

sox = 10

y = 5

Amir H. Payberah (KTH) Resource Management 2016/10/14 24 / 49

Page 32: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Max-Min Fairness

I 1 resource: CPU

I Total resources: 20 CPU

I User 1 has x tasks and wants 〈1CPU〉 per task

I User 2 has y tasks and wants 〈2CPU〉 per task

max(x, y) (maximize allocation)

subject tox+ 2y ≤ 20 (CPU constraint)x = 2y

sox = 10

y = 5

Amir H. Payberah (KTH) Resource Management 2016/10/14 24 / 49

Page 33: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Max-Min Fairness

I 1 resource: CPU

I Total resources: 20 CPU

I User 1 has x tasks and wants 〈1CPU〉 per task

I User 2 has y tasks and wants 〈2CPU〉 per task

max(x, y) (maximize allocation)subject tox+ 2y ≤ 20 (CPU constraint)x = 2y

sox = 10

y = 5

Amir H. Payberah (KTH) Resource Management 2016/10/14 24 / 49

Page 34: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Max-Min Fairness

I 1 resource: CPU

I Total resources: 20 CPU

I User 1 has x tasks and wants 〈1CPU〉 per task

I User 2 has y tasks and wants 〈2CPU〉 per task

max(x, y) (maximize allocation)subject tox+ 2y ≤ 20 (CPU constraint)x = 2y

sox = 10

y = 5

Amir H. Payberah (KTH) Resource Management 2016/10/14 24 / 49

Page 35: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Why is Fair Sharing Useful?

I Proportional allocation: user 1 gets weight 2, user 2 weight 1.

I Priorities: give user 1 weight 1000, user 2 weight 1.

I Reservations: ensure user 1 gets 10% of a resource, so give user 1weight 10, sum weights ≤ 100.

I Isolation policy: users cannot affect others beyond their fair share.

Amir H. Payberah (KTH) Resource Management 2016/10/14 25 / 49

Page 36: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Properties of Max-Min Fairness

I Share guarantee• Each user can get at least 1

n of the resource.• But will get less if her demand is less.

I Strategy proof• Users are not better off by asking for more than they need.• Users have no reason to lie.

I Max-Min fairness is the only reasonable mechanism with these twoproperties.

I Widely used: OS, networking, datacenters, ...

Amir H. Payberah (KTH) Resource Management 2016/10/14 26 / 49

Page 37: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Properties of Max-Min Fairness

I Share guarantee• Each user can get at least 1

n of the resource.• But will get less if her demand is less.

I Strategy proof• Users are not better off by asking for more than they need.• Users have no reason to lie.

I Max-Min fairness is the only reasonable mechanism with these twoproperties.

I Widely used: OS, networking, datacenters, ...

Amir H. Payberah (KTH) Resource Management 2016/10/14 26 / 49

Page 38: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Question?

When is Max-Min Fairness NOT Enough?

Need to schedule multiple, heterogeneous resources, e.g.,CPU, memory, etc.

Amir H. Payberah (KTH) Resource Management 2016/10/14 27 / 49

Page 39: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Question?

When is Max-Min Fairness NOT Enough?

Need to schedule multiple, heterogeneous resources, e.g.,CPU, memory, etc.

Amir H. Payberah (KTH) Resource Management 2016/10/14 27 / 49

Page 40: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Problem

I Single resource example• 1 resource: CPU• User 1 wants 〈1CPU〉 per task• User 2 wants 〈2CPU〉 per task

I Multi-resource example• 2 resources: CPUs and mem• User 1 wants 〈1CPU, 4GB〉 per task• User 2 wants 〈2CPU, 1GB〉 per task

• What is a fair allocation?

Amir H. Payberah (KTH) Resource Management 2016/10/14 28 / 49

Page 41: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Problem

I Single resource example• 1 resource: CPU• User 1 wants 〈1CPU〉 per task• User 2 wants 〈2CPU〉 per task

I Multi-resource example• 2 resources: CPUs and mem• User 1 wants 〈1CPU, 4GB〉 per task• User 2 wants 〈2CPU, 1GB〉 per task

• What is a fair allocation?

Amir H. Payberah (KTH) Resource Management 2016/10/14 28 / 49

Page 42: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Problem

I Single resource example• 1 resource: CPU• User 1 wants 〈1CPU〉 per task• User 2 wants 〈2CPU〉 per task

I Multi-resource example• 2 resources: CPUs and mem• User 1 wants 〈1CPU, 4GB〉 per task• User 2 wants 〈2CPU, 1GB〉 per task

• What is a fair allocation?

Amir H. Payberah (KTH) Resource Management 2016/10/14 28 / 49

Page 43: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

A Natural Policy (1/2)

I Asset fairness: give weights to resources (e.g., 1 CPU = 1 GB) andequalize total value given to each user.

I Total resources: 28 CPU and 56GB RAM (e.g., 1 CPU = 2 GB)• User 1 has x tasks and wants 〈1CPU, 2GB〉 per task• User 2 has y tasks and wants 〈1CPU, 4GB〉 per task

I Asset fairness yields:

max(x, y)x+ y ≤ 28

2x+ 4y ≤ 56

4x = 6y

User 1: x = 12: 〈43%CPU, 43%GB〉 (∑

= 86%)User 2: y = 8: 〈28%CPU, 57%GB〉 (

∑= 86%)

Amir H. Payberah (KTH) Resource Management 2016/10/14 29 / 49

Page 44: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

A Natural Policy (1/2)

I Asset fairness: give weights to resources (e.g., 1 CPU = 1 GB) andequalize total value given to each user.

I Total resources: 28 CPU and 56GB RAM (e.g., 1 CPU = 2 GB)• User 1 has x tasks and wants 〈1CPU, 2GB〉 per task• User 2 has y tasks and wants 〈1CPU, 4GB〉 per task

I Asset fairness yields:

max(x, y)x+ y ≤ 28

2x+ 4y ≤ 56

4x = 6y

User 1: x = 12: 〈43%CPU, 43%GB〉 (∑

= 86%)User 2: y = 8: 〈28%CPU, 57%GB〉 (

∑= 86%)

Amir H. Payberah (KTH) Resource Management 2016/10/14 29 / 49

Page 45: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

A Natural Policy (1/2)

I Asset fairness: give weights to resources (e.g., 1 CPU = 1 GB) andequalize total value given to each user.

I Total resources: 28 CPU and 56GB RAM (e.g., 1 CPU = 2 GB)• User 1 has x tasks and wants 〈1CPU, 2GB〉 per task• User 2 has y tasks and wants 〈1CPU, 4GB〉 per task

I Asset fairness yields:

max(x, y)x+ y ≤ 28

2x+ 4y ≤ 56

4x = 6y

User 1: x = 12: 〈43%CPU, 43%GB〉 (∑

= 86%)User 2: y = 8: 〈28%CPU, 57%GB〉 (

∑= 86%)

Amir H. Payberah (KTH) Resource Management 2016/10/14 29 / 49

Page 46: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

A Natural Policy (2/2)

I Problem: violates share grantee.

I User 1 gets less than 50% of both CPU and RAM.

I Better off in a separate cluster with half the resources.

Amir H. Payberah (KTH) Resource Management 2016/10/14 30 / 49

Page 47: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Challenge

I Can we find a fair sharing policy that provides:• Share guarantee• Strategy-proofness

I Can we generalize max-min fairness to multiple resources?

Amir H. Payberah (KTH) Resource Management 2016/10/14 31 / 49

Page 48: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Proposed Solution

Dominant Resource Fairness (DRF)

Amir H. Payberah (KTH) Resource Management 2016/10/14 32 / 49

Page 49: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Dominant Resource Fairness (DRF) (1/2)

I Dominant resource of a user: the resource that user has the biggestshare of.

• Total resources: 〈8CPU, 5GB〉• User 1 allocation: 〈2CPU, 1GB〉

28= 25%CPU and 1

5= 20%RAM

• Dominant resource of User 1 is CPU (25% > 20%)

I Dominant share of a user: the fraction of the dominant resource sheis allocated.

• User 1 dominant share is 25%.

Amir H. Payberah (KTH) Resource Management 2016/10/14 33 / 49

Page 50: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Dominant Resource Fairness (DRF) (1/2)

I Dominant resource of a user: the resource that user has the biggestshare of.

• Total resources: 〈8CPU, 5GB〉• User 1 allocation: 〈2CPU, 1GB〉

28= 25%CPU and 1

5= 20%RAM

• Dominant resource of User 1 is CPU (25% > 20%)

I Dominant share of a user: the fraction of the dominant resource sheis allocated.

• User 1 dominant share is 25%.

Amir H. Payberah (KTH) Resource Management 2016/10/14 33 / 49

Page 51: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Dominant Resource Fairness (DRF) (2/2)

I Apply max-min fairness to dominant shares: give every user an equalshare of her dominant resource.

I Equalize the dominant share of the users.• Total resources: 〈9CPU, 18GB〉• User 1 wants 〈1CPU, 4GB〉; Dominant resource: RAM 1

9< 4

18• User 2 wants 〈3CPU, 1GB〉; Dominant resource: CPU 3

9> 1

18

I max(x, y)x+ 3y ≤ 9

4x+ y ≤ 184x18

= 3y9

User 1: x = 3: 〈33%CPU, 66%GB〉User 2: y = 2: 〈66%CPU, 16%GB〉

Amir H. Payberah (KTH) Resource Management 2016/10/14 34 / 49

Page 52: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Dominant Resource Fairness (DRF) (2/2)

I Apply max-min fairness to dominant shares: give every user an equalshare of her dominant resource.

I Equalize the dominant share of the users.• Total resources: 〈9CPU, 18GB〉• User 1 wants 〈1CPU, 4GB〉; Dominant resource: RAM 1

9< 4

18• User 2 wants 〈3CPU, 1GB〉; Dominant resource: CPU 3

9> 1

18

I max(x, y)x+ 3y ≤ 9

4x+ y ≤ 184x18

= 3y9

User 1: x = 3: 〈33%CPU, 66%GB〉User 2: y = 2: 〈66%CPU, 16%GB〉

Amir H. Payberah (KTH) Resource Management 2016/10/14 34 / 49

Page 53: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Dominant Resource Fairness (DRF) (2/2)

I Apply max-min fairness to dominant shares: give every user an equalshare of her dominant resource.

I Equalize the dominant share of the users.• Total resources: 〈9CPU, 18GB〉• User 1 wants 〈1CPU, 4GB〉; Dominant resource: RAM 1

9< 4

18• User 2 wants 〈3CPU, 1GB〉; Dominant resource: CPU 3

9> 1

18

I max(x, y)x+ 3y ≤ 9

4x+ y ≤ 184x18

= 3y9

User 1: x = 3: 〈33%CPU, 66%GB〉User 2: y = 2: 〈66%CPU, 16%GB〉

Amir H. Payberah (KTH) Resource Management 2016/10/14 34 / 49

Page 54: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Online DRF Scheduler

I Whenever there are available resources and tasks to run:Schedule a task to the user with the smallest dominant share.

Amir H. Payberah (KTH) Resource Management 2016/10/14 35 / 49

Page 55: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN

Amir H. Payberah (KTH) Resource Management 2016/10/14 36 / 49

Page 56: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN

YARN

Yet Another Resource Negotiator

Amir H. Payberah (KTH) Resource Management 2016/10/14 37 / 49

Page 57: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture

I Resource Manager (RM)

I Application Master (AM)

I Node Manager (NM)

Amir H. Payberah (KTH) Resource Management 2016/10/14 38 / 49

Page 58: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture - Resource Manager (1/2)

I One per cluster• Central: global view• Enable global properties• Fairness, capacity, locality

I Job requests are submitted to RM.• To start a job (application), RM finds a container to spawn AM.

I Container• Logical bundle of resources (CPU/memory).

I No static resource partitioning.

Amir H. Payberah (KTH) Resource Management 2016/10/14 39 / 49

Page 59: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture - Resource Manager (2/2)

I Only handles an overall resource profile for each application.• Local optimization is up to the application.

I Preemption• Request resources back from an application.• Checkpoint snapshot instead of explicitly killing jobs / migrate

computation to other containers.

Amir H. Payberah (KTH) Resource Management 2016/10/14 40 / 49

Page 60: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture - Application Manager (1/2)

I The head of a job.

I Runs as a container.

I Request resources from RM.• # of containers/resource per container/locality ...

I Dynamically changing resource consumption,based on the containers it receives from the RM.

Amir H. Payberah (KTH) Resource Management 2016/10/14 41 / 49

Page 61: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture - Application Manager (2/2)

I Requests are late-binding.• The process spawned is not bound to the request, but to the lease.• The conditions that caused the AM to issue the request may not

remain true when it receives its resources.

I Can run any user code, e.g., MapReduce, Spark, etc.

I AM determines the semantics of the success or failure of the con-tainer.

Amir H. Payberah (KTH) Resource Management 2016/10/14 42 / 49

Page 62: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture - Node Manager (1/2)

I The worker daemon.

I Registers with RM.

I One per node.

I Report resources to RM: memory, CPU, ...

I Containers are described by a Container Launch Context (CLC).• The command necessary to create the process• Environment variables• Security tokens• ...

Amir H. Payberah (KTH) Resource Management 2016/10/14 43 / 49

Page 63: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Architecture - Node Manager (2/2)

I Configure the environment for task execution.

I Garbage collection.

I Auxiliary services.• A process may produce data that persist beyond the life of the

container.• Output intermediate data between map and reduce tasks.

Amir H. Payberah (KTH) Resource Management 2016/10/14 44 / 49

Page 64: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Framework (1/2)

I Submitting the application: passing a CLC for the AM to the RM.

I When RM starts the AM, it should register with the RM.• Periodically advertise its liveness and requirements over the

heartbeat protocol.

Amir H. Payberah (KTH) Resource Management 2016/10/14 45 / 49

Page 65: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

YARN Framework (2/2)

I Once the RM allocates a container, AM can construct a CLC tolaunch the container on the corresponding NM.

• It monitors the status of the running container and stop it when theresource should be reclaimed.

I Once the AM is done with its work, it should unregister from theRM and exit cleanly.

Amir H. Payberah (KTH) Resource Management 2016/10/14 46 / 49

Page 66: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Summary

Amir H. Payberah (KTH) Resource Management 2016/10/14 47 / 49

Page 67: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Summary

I Mesos• Offered-based• Max-Min fairness: DRF

I YARN• Request-based• RM, AM, NM

Amir H. Payberah (KTH) Resource Management 2016/10/14 48 / 49

Page 68: Resource Management Mesos and YARN...Resource Management Mesos and YARN Amir H. Payberah amir@sics.se KTH Royal Institute of Technology Amir H. Payberah (KTH) Resource Management 2016/10/14

Questions?

Acknowledgements

Some slides were derived from Ion Stoica and Ali Ghodsi slides(Berkeley University), and Wei-Chiu Chuang slides (Purdue University).

Amir H. Payberah (KTH) Resource Management 2016/10/14 49 / 49