autoscaler architecture of apache stratos 4.0.0

23
Autoscaler Architecture Lahiru Sandaruwan Apache Committer - Stratos(Incubating) , Software Engineer - WSO2 Inc

Upload: lahiru-sandaruwan

Post on 08-May-2015

2.999 views

Category:

Technology


1 download

DESCRIPTION

These are the slides used for explaining Autoscaler Architecture of brand new architecture for Apache Stratos 4.0.0

TRANSCRIPT

Page 1: Autoscaler architecture of apache stratos 4.0.0

Autoscaler Architecture

Lahiru Sandaruwan Apache Committer - Stratos(Incubating) , Software Engineer - WSO2 Inc

Page 2: Autoscaler architecture of apache stratos 4.0.0

Agenda • Introduction to Autoscaling

• Apache Stratos Autoscaler Architecture

• Component Architecture

• Event Flow

• Autoscale Policy

• Introduction to Autoscaler Policy

• Autoscaling Strategies

• Deployment Policy -

• Introduction to Deployment Policy

• Capacity Planning with Deployment Policy

• Partition Selection Algorithms

• Rules Engine

• Reasons for a Rule Engine

• Rules for Apache Stratos Autoscaler

1

Page 3: Autoscaler architecture of apache stratos 4.0.0

Introduction to Autoscaling • What is scalability

• Horizontal and vertical scaling

• What is high availability

• Proceedure

• Clustering

• Load balancing

• Autoscaling

• Automating the capacity planning

2

Page 4: Autoscaler architecture of apache stratos 4.0.0

Introduction to Autoscaling Contd. • Flexible cloud solution

• User-defined policies, health status checks, and schedules.

• Use case, cost, performance, and infrastructure.

• SLA(Service Level Agreement) aware elastic cloud • QoS , SLA aware services

• Daecision factors to consumers

• Solves performance, availability, and economic costs issues

• Capacity planning • Automated control of cloud: cost vs. Qos, find appropriate cloud model.

• Cost Factor • Reduce economic cost and energy footprint

• Proceedure • Online observation and monitoring the cloud

• Trigger an event if a SLA violation happened

• Use control theory and mathematical operations

• Handling seasonal patterns. E.g. Year ends/ Weekends patterns

3

Page 5: Autoscaler architecture of apache stratos 4.0.0

Autoscaler Component Architecture

4

Page 6: Autoscaler architecture of apache stratos 4.0.0

Event Flow

5

Page 7: Autoscaler architecture of apache stratos 4.0.0

Health Statistics as Events • CEP receives events

• Requests in flight from Load balancer

• Cartridge instance health statistics from Cartridge agent

• CPU consumption

• Memory consumption

• CEP summarize the Average, Gradient, and Second derivative events of,

• Requests in Flight

• CPU consumption

• Memory consumption

6

Page 8: Autoscaler architecture of apache stratos 4.0.0

Autoscale Policy

• Deployable Xml model

• Keeps Load thresholds for threshold based rules evaluation.

• Deployed by Dev-ops or similar role at start or later

• Hot Deployable.

• Users Selects an Autoscale Policy on His Preference at Subscription Time.

7

Page 9: Autoscaler architecture of apache stratos 4.0.0

Autoscale Policy contd. <autoscalePolicy id="economy-autoscale">

<loadThresholds>

<requestsInFlight>

<average value="40" />

<gradient value="1" />

<secondDerivative value="0" />

<scaleDownMarginOfGradient value="1.0" />

<scaleDownMarginOfSecondDerivative value="0.2" />

</requestsInFlight>

<memoryConsumption>

...

</memoryConsumption>

<loadAverage>

...

</loadAverage>

</loadThresholds>

</autoscalePolicy>

8

Page 10: Autoscaler architecture of apache stratos 4.0.0

Deployment Policy

• Deployable xml model

• Keeps the Capacity Planning.

• Deployed by Dev-ops or similar role at start or later

• Hot Deployable.

• Users Selects an Deployment Policy on His Preference at Subscription Time.

9

Page 11: Autoscaler architecture of apache stratos 4.0.0

Deployment Policy contd. <deploymentPolicy id =”economy-deployment”>

<partitionGroups>

<partitionGroup id=”group1” >

<partitionAlgo>OneAfterAnother</partitionAlgo>

<partition id="partition1" >

<max>3</max>

<min>1</min>

</partition>

<partition id="partition2" >

<max>5</max>

<min>1</min>

</partition>

<partition id="partition3">

<max>20</max>

<min>1</min>

</partition>

</partitionGroup>

...

</deploymentPolicy>

10

Page 12: Autoscaler architecture of apache stratos 4.0.0

Rules Engine

• Why a Rules Engine • Ease of use: No byte code and easy to modify

• Readable

• Performances and sclability

• Uses Drools engine as the default rules engine

• Rules

• Minimum Rule

• Scale Up Rule

• Scale Down Rule

• Terminate All Rule

11

Page 13: Autoscaler architecture of apache stratos 4.0.0

Autoscaling Rules: Sample in Drools

rule "Minimum Rule"

dialect "mvel"

when

$service : Service ()

$cluster : Cluster () from $service.getClusters()

$policy : AutoscalePolicy(id == $cluster.autoscalePolicyName ) from $manager.getPolicyList()

$partition : Partition () from $policy.getHAPolicy().getPartitions()

$clusterContext : ClusterContext() from $context.getClusterContext($cluster.getClusterId())

eval($clusterContext.getPartitionCount($partition.getId()) < $partition.getPartitionMembersMin() )

then

int memberCountToBeIncreased = 1;

if($evaluator.delegateSpawn($partition,$cluster.getClusterId(), memberCountToBeIncreased)){

$clusterContext.increaseMemberCountInPartition($partition.getId(), memberCountToBeIncreased);

}

end

12

Page 14: Autoscaler architecture of apache stratos 4.0.0

Minimum Rule • This runs when a “cluster created” event is received

• Scan through all the partitions of the cluster and find minimums

• Call CC for spawning required minimum instances

• This will be also run periodically(with a higher time interval than scale up/down rules) to assure that the minimum count is preserved

13

Page 15: Autoscaler architecture of apache stratos 4.0.0

Scale Up/Down Rule • These rules run periodically

• Evaluate load details(Received from CEP) against their thresholds(defined in Autoscale Policy).

• Decide whether to scale up, scale down, or do nothing

• Call CC for spawning instances in selected partitions

14

Page 16: Autoscaler architecture of apache stratos 4.0.0

Autoscaling Strategies • Threshold based autoscaling

• Predictive or proactive auto-scaling techniques

• Kalman Filter

• Control Theory

• Time series analysis

15

Page 17: Autoscaler architecture of apache stratos 4.0.0

Average of Requests In Flight at LB for a Specific Cluster

16

Page 18: Autoscaler architecture of apache stratos 4.0.0

Average of CPU/ Memory Consumption for a Specific Cluster

17

Page 19: Autoscaler architecture of apache stratos 4.0.0

Terminate All Rule • This runs when a “cluster removed” event is received

• Scan through all the partitions of the cluster and find member IDs to be terminated

• Call CC for terminating those instances

18

Page 20: Autoscaler architecture of apache stratos 4.0.0

Fault Handling Scenarios Process VM Decision flow

Down Up • Cartridge agent publish event to CC • CC updates instance status in topology • Autoscaler decides to kill it

Down Down(It can be that agent is crashed)

• CEP identify that & publish event to Autoscaler • Autoscaler calls CC to terminate(if available) and remove the instance from

topology • Autoscaler will spawn another to cover that

Up Up(but network issue)

• CEP sends statistics on fault requests to Autoscaler • Autoscaler keep monitoring it and takes a decision to terminate the instance • Autoscaler will spawn another in the same partition to cover that

19

Page 22: Autoscaler architecture of apache stratos 4.0.0

Website

http://stratos.incubator.apache.org

Mailing List

Subscribe: [email protected]

Post (After subscription): [email protected]

Social Media

Google+: https://plus.google.com/103515557134069849802

Twitter: https://twitter.com/ApacheStratos

Facebook: https://www.facebook.com/apache.stratos

LinkedIn: http://www.linkedin.com/groups?home=&gid=5131436

Join Us

21

Page 23: Autoscaler architecture of apache stratos 4.0.0

Thank you

22