+ All Categories
Home > Technology > Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Date post: 06-May-2015
Category:
Upload: kanak-biscuitwala
View: 714 times
Download: 3 times
Share this document with a friend
Description:
Talk from ApacheCon 2014. How Helix can integrate with provisioners like YARN or Mesos to manage the entire lifecycle of a distributed system.
111
Fine-Grained Scheduling with Helix Kanak Biscuitwala Jason Zhang Apache Helix Committers @ LinkedIn helix.apache.org @apachehelix
Transcript
Page 1: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Fine-Grained Scheduling with Helix

Kanak Biscuitwala Jason Zhang

Apache Helix Committers @ LinkedIn helix.apache.org

@apachehelix

Page 2: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

About Helix

Helix automates assignment of partitioned and replicated distributed tasks in the face of node

failure and recovery, cluster expansion, and reconfiguration.

Page 3: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix at LinkedIn

OracleOracleOracleDB

Change Capture

Change Consumers

Index Search Index

User Writes

Data Replicator

Backup/Restore

In Production

ETL

HDFS

Analytics

Page 4: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix at LinkedInIn Production

Over 1000 instances covering over 30000 database partitions

Over 1000 instances for change capture consumers

As many as 500 instances in a single Helix cluster

(all numbers are per-datacenter)

Page 5: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Others Using Helix

Page 6: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Datacenter Diversity

Page 7: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Intersection of Job Types

OracleDB OracleDB

Page 8: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Intersection of Job Types

OracleDB OracleDB

BackupBackup

Page 9: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Intersection of Job Types

OracleDB OracleDB

BackupBackup

HDFS

ETL ETL

Page 10: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Intersection of Job Types

OracleDB OracleDB

BackupBackup

HDFS

ETL ETL

Long-running and batch jobs running together!

Page 11: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Cloud Deployment

A

B

online

nearline

C batch

A1 A1

A2 A3B1

C1 C2

C3

B2 B3

C2

B4 B5

C2 C4

Applications with diverse requirements running together in a datacenter

Page 12: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Cloud Deployment

A

B

C

A1 A1

A2 A3B1

C1 C2

C3

B2 B3

C2

B4 B5

C2 C4

Applications with diverse requirements running together in a datacenter

DB

Backup

ETL

Page 13: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Processes on Machines

Machine ContainerProcess VM

Page 14: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Processes on Machines

TaskTaskProcess

No Isolation

Machine ContainerProcess VM

Page 15: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Processes on Machines

TaskTaskProcess

128 MB

128 MB

128 MB

Process

Process

Process

No Isolation VM-based Isolation

Machine ContainerProcess VM

Page 16: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Processes on Machines

TaskTaskProcess

256 MB

64 MB

128 MB

128 MB

128 MB

Process

Process

Process Process

Process

No Isolation VM-based Isolation Container-based Isolation

Machine ContainerProcess VM

Page 17: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

• Run as individual processes – Poor isolation or poor utilization

• Virtual machines – Better isolation – Xen, Hyper-V, ESX, KVM

• Containers – cgroup – YARN, Mesos – Super lightweight, dynamic based on application

requirements

Processes on Machines

Page 18: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Processes on Machines

Virtualization and containerization significantly improve process isolation and open up possibilities for efficient

utilization of physical resources

Page 19: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based Solution

Page 20: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionSystem Requirements

A

B

C

64 MB 64 MB 64 MB

128 MB 128 MB

256 MB

Page 21: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionAllocation

64 MB

64 MB

128 MB

256 MB

128 MB

64 MB

Machine

Container

Page 22: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionAllocation

64 MB

64 MB

128 MB

256 MB

128 MB

64 MB

Machine

Container

A

A

A

B

B

C

Process

Page 23: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionAllocation

64 MB

64 MB

128 MB

256 MB

128 MB

64 MB

Containerization is powerful!

Machine

Container

A

A

A

B

B

C

Process

Page 24: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionAllocation

64 MB

64 MB

128 MB

256 MB

128 MB

64 MB

Containerization is powerful!

Machine

Container

A

A

A

B

B

C

Process

But do processes always fit so nicely?

Page 25: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-Utilization

256 MB

Container-Based Solution Machine

ContainerProcess

Page 26: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-Utilization

256 MBProcess 1

Container-Based Solution Machine

ContainerProcess

Page 27: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-Utilization

Outcome: Preemption and relaunch

256 MBProcess 1

Container-Based Solution Machine

ContainerProcess

Page 28: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-Utilization

Outcome: Preemption and relaunch

Container-Based Solution

384 MB

Machine

ContainerProcess

Page 29: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-Utilization

Outcome: Preemption and relaunch

Container-Based Solution

384 MBProcess 1

Machine

ContainerProcess

Page 30: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Under-Utilization

384 MB

128 MB

Container-Based Solution Machine

ContainerProcess

Page 31: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Under-Utilization

Outcome: Over-provisioned until restart

384 MBProcess 1

128 MB

Container-Based Solution Machine

ContainerProcess

Process 2

Page 32: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionFailure

64 MB

64 MB

128 MB

256 MB

128 MB

64 MB

Machine

Container

A

A

A

B

B

C

Process

Page 33: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionFailure

64 MB

64 MB

128 MB

128 MB

Machine

Container

A

A

B

B

Process

Page 34: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionFailure

64 MB

64 MB

128 MB

128 MB

Outcome: Launch containers elsewhere

Machine

Container

A

A

B

B

Process

256 MBC64 MBA

What about stateful systems?

Page 35: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionFailure

64 MB

64 MB

128 MB

256 MB

128 MB

64 MB

Machine

Container

SLAVE

SLAVE

MASTER

B

B

C

Process

Page 36: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based SolutionFailure

64 MB

64 MB

128 MB

128 MB

Without additional information, the master is unavailable until restart

Machine

Container

SLAVE

SLAVE

B

B

Process

Page 37: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingContainer-Based Solution Machine

ContainerProcess

256 MB50% 256 MB50%

Page 38: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingContainer-Based Solution Machine

ContainerProcess

Page 39: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingContainer-Based Solution Machine

ContainerProcess

128 MB33% 128 MB33% 128 MB33%

Outcome: Relaunch with new sharding

Page 40: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based Solution

Container-Based Solution

Utilization Application requirements define container size

Fault Tolerance New container is started

Scaling Workload is repartitioned and new containers are brought up

Discovery Existence

Page 41: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Container-Based Solution

We need something finer-grained

The container model provides flexibility within machines, but assumes homogeneity of tasks within containers

Page 42: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based Solution

Page 43: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionSystem Requirements

A

B

C

complete in less than 5 hours

always have 2 containers running

response time should be less than 50 ms

Page 44: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionAllocation

Machine

Container

A A

B

Task

B

C

C

Page 45: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-UtilizationTask-Based Solution Machine

ContainerTask

Page 46: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-UtilizationTask-Based Solution

Task 1

Machine

ContainerTask

Page 47: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-UtilizationTask-Based Solution

Task 1

Machine

ContainerTask

Page 48: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-UtilizationTask-Based Solution

Task 1

Machine

ContainerTask

Task 1

Page 49: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Over-UtilizationTask-Based Solution

Hide the overhead of a container restart

Machine

ContainerTask

Task 1

Page 50: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Under-Utilization

384 MB

128 MB

Task-Based Solution Machine

ContainerTask

Page 51: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Under-Utilization

384 MBTask 1

128 MBTask 2

Task-Based Solution Machine

ContainerTask

Page 52: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Under-Utilization

Optimize container allocations based on usage

384 MBTask 1

Task 2

Task-Based Solution Machine

ContainerTask

Page 53: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionFailure

Task 1 Leader

Task 2 Leader

Task 3 Leader

Task 2 Standby

Task 3 Standby

Task 1 Standby

Task 2 Standby

Task 1 Standby

Task 3 Standby

Machine

Container

Page 54: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionFailure

Task 1 Leader

Task 2 Leader

Task 2 Standby

Task 3 Standby

Task 1 Standby

Task 3 StandbyTask 3 Leader

Machine

Container

Page 55: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionFailure

Some systems cannot wait for new containers to start

Task 1 Leader

Task 2 Leader

Task 2 Standby

Task 3 Standby

Task 1 Standby

Task 3 StandbyTask 3 Leader

Machine

Container

Page 56: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionDiscovery

Task 1 Leader

Task 2 Leader

Task 2 Standby

Machine

Container

Task 1:!Leader at N1 Standby at N2

Task 1 Standby

Task 2:!Leader at N2 Standby at N1

N1 N2

Page 57: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task-Based SolutionDiscovery

Task 1 Leader

Task 2 Leader

Task 2 Standby

Machine

Container

Learn where everything runs, and what state each task is in

Task 1:!Leader at N1 Standby at N2

Task 1 Standby

Task 2:!Leader at N2 Standby at N1

N1 N2

Page 58: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingTask-Based Solution

T4

T5

T6

T1

T2

T3

Machine

ContainerTask

Page 59: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingTask-Based Solution

T4

T5

T6

T1

T2

T3

Machine

ContainerTask

Page 60: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingTask-Based Solution

T4

T5

T6

T1

T2

T3

Machine

ContainerTask

Page 61: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

ScalingTask-Based Solution

T4

T5T6

T1

T2

T3

Machine

ContainerTask

Page 62: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Comparing Solutions

Container Solution Task + Container Solution

Utilization Application requirements define container size

Tasks are distributed as needed to a minimal

container set as per SLA

Fault Tolerance New container is startedExisting task can assume a new state while waiting for

new container

ScalingWorkload is repartitioned and new containers are

brought up

Tasks are moved across containers

Discovery Existence Existence and state

Page 63: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Benefits of a Task-Based SolutionComparing Solutions

Container reuseMinimize overhead of container relaunch

Fine-grained scheduling

Page 64: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Benefits of a Task-Based SolutionComparing Solutions

Container reuseMinimize overhead of container relaunch

Fine-grained scheduling

Task : Container :: Thread : ProcessTask is the right level of abstraction

Page 65: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Working at task granularity is powerful

We need a performance-centric approach to resource assignment

Comparing Solutions

Page 66: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Working at task granularity is powerful

How can Helix help?

We need a performance-centric approach to resource assignment

Comparing Solutions

Page 67: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Working at task granularity is powerful

How can Helix help?

We need a performance-centric approach to resource assignment

Comparing Solutions

YARN/Mesos: containers bring flexibility in a machineHelix: tasks bring flexibility in a container

Page 68: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task Management with Helix

Page 69: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Application Lifecycle

Capacity Planning

Provisioning

Fault Tolerance

State Management

Allocating physical resources for your load

Deploying and launching tasks

Staying available, ensuring success

Determining what code should be running and where

Page 70: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Resource

Partition PartitionPartition

Helix OverviewResources (Task Groups)

master

slave

offline

All partitions can be replicated.

All resources can be partitioned (these are tasks).

Each replica is in a state.

Page 71: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Offline Master

Slave

State Model and ConstraintsHelix Overview

State Constraints

Transition Constraints

Partition Master: [1, 1] Slave: [0, 2]

Max T1 transitions in parallel

Resource - Max T2 transitions in parallel

Node No more than 10 partitions

Max T3 transitions in parallel

Cluster - Max T4 transitions in parallel

StateCount=2

StateCount=1

Page 72: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Offline Master

Slave

State Model and ConstraintsHelix Overview

State Constraints

Transition Constraints

Partition Master: [1, 1] Slave: [0, 2]

Max T1 transitions in parallel

Resource - Max T2 transitions in parallel

Node No more than 10 partitions

Max T3 transitions in parallel

Cluster - Max T4 transitions in parallel

StateCount=2

StateCount=1

Helix manages task state

Page 73: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Controller PARTICIPANTS

Spectators

ControllerController

ManageTASKS

Helix OverviewCluster Roles

Page 74: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerHigh-Level Overview

Rebalancer

Task Assignment

Constraints

Nodes

“single master” “no more than 3 tasks

per instance”

Page 75: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerRebalancer

ResourceAssignment computeResourceMapping( RebalancerConfig rebalancerConfig, ResourceAssignment prevAssignment, Cluster cluster, ResourceCurrentState currentState);

Based on the current nodes in the cluster and constraints, find an assignment of task to node

Page 76: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerRebalancer

ResourceAssignment computeResourceMapping( RebalancerConfig rebalancerConfig, ResourceAssignment prevAssignment, Cluster cluster, ResourceCurrentState currentState);

Based on the current nodes in the cluster and constraints, find an assignment of task to node

What else do we need?

Page 77: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerWhat is Missing?

Dynamic Container Allocation

Container Isolation

Automated Service Deployment

Resource Utilization Monitoring

Page 78: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerTarget Provider

Based on some constraints, determine how many containers are required in this system

Fixed

CPU

Memory

Bin Packing

We’re working on integrating with monitoring systems in order to query for usage information

Page 79: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerTarget Provider

Based on some constraints, determine how many containers are required in this system

TargetProviderResponse evaluateExistingContainers( Cluster cluster, ResourceId resourceId, Collection<Participant> participants);

class TargetProviderResponse { List<ContainerSpec> containersToAcquire; List<Participant> containersToRelease; List<Participant> containersToStop; List<Participant> containersToStart;}

Fixed

CPU

Memory

Bin Packing

We’re working on integrating with monitoring systems in order to query for usage information

Page 80: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerAdding a Target Provider

Rebalancer

Task Assignment

Constraints

Nodes

Target Provider

Page 81: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerAdding a Target Provider

Rebalancer

Task Assignment

Constraints

Nodes

Target Provider

How do we use the target provider response?

Page 82: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerContainer Provider

Given the container requirements, ensure that number of containers are running

YARN

Mesos

Logical

Page 83: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerContainer Provider

Given the container requirements, ensure that number of containers are running

ListenableFuture<ContainerId> allocateContainer(ContainerSpec spec);!ListenableFuture<Boolean> deallocateContainer(ContainerId containerId);!ListenableFuture<Boolean> startContainer(ContainerId containerId, Participant participant);!ListenableFuture<Boolean> stopContainer(ContainerId containerId);

YARN

Mesos

Logical

Page 84: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerLogical Container Provider

Page 85: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerLogical Container Provider

use

use

startContainer

Page 86: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Helix ControllerAdding a Container Provider

Rebalancer

Task Assignment

Constraints

Nodes

Target Provider

Container Provider

Target Provider + Container Provider = Provisioner

Page 87: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Application Lifecycle

Capacity Planning

Provisioning

Fault Tolerance

State Management

Target Provider

Container Provider

Existing Helix Controller (enhanced by Provisioner)

Existing Helix Controller (enhanced by Provisioner)

With Helix and the Task Abstraction

Page 88: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

Page 89: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

Resource Provider

Page 90: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

submit jobResource ProviderClient

Page 91: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

submit jobResource Provider

Controller Container

Provisioner

Rebalancer

Client

App Launcher

Page 92: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

submit jobResource Provider

Controller Container

Provisioner

Rebalancer

Client

container request

App Launcher

Page 93: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

submit jobResource Provider

Controller Container

Provisioner

Rebalancer

Client

container request

Participant Container

Participant Launcher

Helix Participant

App

App Launcher

Page 94: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

System Architecture

submit jobResource Provider

Controller Container

Provisioner

Rebalancer

Client

container request

Participant Container

Participant Launcher

Helix Participant

App

App Launcher

assign tasks

Page 95: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

HDFS/Common Area

Helix + YARNYARN Architecture

ClientResource Manager

Application Master Container

Node Manager Node Manager

submit job

node statusnode statuscontainer request

assign work

status

App Package

grab package

Page 96: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

HDFS/Common Area

Helix + YARNHelix + YARN Architecture

ClientResource Manager

Application Master Container

Node Manager Node Manager

submit job

node statusnode statuscontainer request

assign tasks

status

Helix Controller

Rebalancer

Helix Participant

App

App Package

grab package

Page 97: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

HDFS/Common Area

Scheduler Slave

Helix + MesosMesos Architecture

SchedulerMesos Master

Slave Machine Slave Machine

Mesos SlaveMesos Slave

offer resources

node statusnode status

Mesos Executor

grab executor

Executor Package

offer response

Page 98: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Scheduler SlaveHelix Controller

Helix + MesosHelix + Mesos Architecture

SchedulerMesos Master

Slave Machine Slave Machine

Mesos Slave

Mesos Slave

offer resources

node statusnode status

assign tasks

HDFS/Common Area

Mesos Executor

grab executor

Helix Executor Package

offer response

ParticipantParticipant

Page 99: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Example

Page 100: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Distributed Document StoreOverview

OraclePartition 0 Partition 1 Partition 2 Oracle

Partition 0 Partition 1 Partition 2

P1 BackupP2 Backup

HDFS

ETL ETL

Master Slave

OraclePartition 0 Partition 1 Partition 2

P0 Backup

ETL

Page 101: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Distributed Document StoreOverview

OraclePartition 0 Partition 1 Partition 2 Oracle

Partition 0 Partition 1 Partition 2

P1 BackupP2 Backup

HDFS

ETL ETL

Master Slave

P0 Backup

Partition 0 Partition 1 Partition 2

Page 102: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Distributed Document StoreYARN Example

ClientResource Managersubmit job

container request

assign work

status

node status

Application Master

Node Manager

Helix Controller

Rebalancer

Container

Node Manager

node status

Helix Participant

OraclePartition 0 Partition 1

P1 Backup ETL

Page 103: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

YAML SpecificationappConfig: { config: { k1: v1 } }appPackageUri: 'file://path/to/myApp-pkg.tar'appName: myAppservices: [DB, ETL] # the task containersserviceConfigMap: {DB: { num_containers: 3, memory: 1024 }, ... ETL: { time_to_complete: 5h, ... }, ...}servicePackageURIMap: { DB: ‘file://path/to/db-service-pkg.tar', ...}...

Distributed Document Store

Page 104: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

YAML SpecificationappConfig: { config: { k1: v1 } }appPackageUri: 'file://path/to/myApp-pkg.tar'appName: myAppservices: [DB, ETL] # the task containersserviceConfigMap: {DB: { num_containers: 3, memory: 1024 }, ... ETL: { time_to_complete: 5h, ... }, ...}servicePackageURIMap: { DB: ‘file://path/to/db-service-pkg.tar', ...}...

Distributed Document Store

TargetProvider specification

Page 105: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Service/Container Implementation

public class MyQueuerService extends StatelessParticipantService { @Override public void init() { ... }! @Override public void onOnline() { ... }! @Override public void onOffline() { ... }}

Distributed Document Store

Page 106: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Task Implementation

public class BackupTask extends Task { @Override public ListenableFuture<Status> start() { ... }! @Override public ListenableFuture<Status> cancel() { ... }! @Override public ListenableFuture<Status> pause() { ... }! @Override public ListenableFuture<Status> resume() { ... }}

Distributed Document Store

Page 107: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Distributed Document StoreState Model-Style Callbacks

public class StoreStateModel extends StateModel { public void onBecomeMasterFromSlave() { ... }! public void onBecomeSlaveFromMaster() { ... }! public void onBecomeSlaveFromOffline() { ... }! public void onBecomeOfflineFromSlave() { ... }}

Page 108: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

class  RoutingLogic  {        public  void  write(Request  request)  {            partition  =  getPartition(request.key);            List<Participant>  nodes  =                    routingTableProvider.getInstance(                            partition,  “MASTER”);            nodes.get(0).write(request);        }  !      public  void  read(Request  request)  {            partition  =  getPartition(request.key);            List<Participant>  nodes  =                    routingTableProvider.getInstance(partition);            random(nodes).read(request);        }  }

Spectator (for Discovery)Distributed Document Store

Page 109: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Recap

•Container abstraction has become a huge win • With Helix, we can go a step further and make

tasks the unit of work • With the TargetProvider and ContainerProvider

abstractions, any popular provisioner can be plugged in

Page 111: Fine-Grained Scheduling with Helix (ApacheCon NA 2014)

Recommended