set it and forget it: auto scaling target tracking policies - aws online tech talks

26
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Andre Dufour, AWS Automation and Messaging November 6, 2017 Set it and Forget it: Auto Scaling Target Tracking Policies

Upload: amazon-web-services

Post on 21-Jan-2018

403 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Andre Dufour, AWS Automation and Messaging

November 6, 2017

Set it and Forget it: Auto Scaling Target Tracking Policies

Page 2: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Auto Scaling groupAuto Scaling group

Fleet management Dynamic Scaling

Elastic Load Balancing

EC2 instances

Elastic Load Balancing

EC2 instances

What is Auto Scaling?

CPU utilization

Page 3: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Dynamic scaling

Page 4: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Dynamic scaling policy types

Simple scaling — single scaling adjustment

Step scaling — adjustment depends on size of alarm breach

Target tracking scaling — target value for a specific metric

Page 5: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target tracking scaling policies

Set itand forget it

Simplicity

Speed

Page 6: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target tracking in action: scaling out

ELB

EC2 Instances

Traffic 5

10

15

20

25

30

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

Inst

ance

s

CP

U

Target Utilization CPU Utilization Instances

Traf

fic

Time

Page 7: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Setting up target tracking scaling policies

Page 8: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Horizontally scalable applications use cases

- Load balanced applications

- Batch data processing applications

Page 9: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Load-balanced applications

ELB

Auto Scaling group

AvailabilityZone A

AvailabilityZone B

Load Balancing Layer

Compute Layer

Data Layer DynamoDB

CPU

Page 10: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target tracking a load-balanced application:Step 1: Picking the metric

- Application Load Balancer Request Count per Target

- Average CPU Utilization

Page 11: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target tracking a load-balanced application:Step 2: Setting the target

How many requests can you handle per instance?

How quickly do your EC2 instances launch before they start receiving traffic?

How fast does the traffic ramp?

Page 12: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Batch data processing applications

AvailabilityZone A

AvailabilityZone B

Producer

Consumer

EC2 Instance

Queue Simple Queue Service

Requests

Auto Scaling group

Page 13: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

=𝑄𝑢𝑒𝑢𝑒 𝑆𝑖𝑧𝑒 (𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑁𝑢𝑚𝑏𝑒𝑟𝑂𝑓𝑀𝑒𝑠𝑠𝑎𝑔𝑒𝑠𝑉𝑖𝑠𝑖𝑏𝑙𝑒)

𝐹𝑙𝑒𝑒𝑡 𝑆𝑖𝑧𝑒 (𝑅𝑢𝑛𝑛𝑖𝑛𝑔 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 𝑜𝑓 𝑡ℎ𝑒 𝑓𝑙𝑒𝑒𝑡)Backlog Per Capacity Unit

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target tracking a batch data processing application:Step 1: Creating a custom metric

Page 14: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target tracking a batch data processing application:Step 2: Setting a target

=𝐴𝑐𝑐𝑒𝑝𝑡𝑎𝑏𝑙𝑒 𝑀𝑒𝑠𝑠𝑎𝑔𝑒 𝑃𝑟𝑜𝑐𝑒𝑠𝑠𝑖𝑛𝑔 𝐿𝑎𝑡𝑒𝑛𝑐𝑦

𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑇𝑖𝑚𝑒 𝑡𝑜 𝑃𝑟𝑜𝑐𝑒𝑠𝑠 𝑎 𝑀𝑒𝑠𝑠𝑎𝑔𝑒

Acceptable Backlog per Capacity Unit

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Page 15: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Processing SLA = 10 Seconds

Processing time per message = 0.1 seconds

Acceptable backlog = 10/0.1 = 100 messages

TARGET = 100 messages

Target tracking a batch data processing application:Example

Page 16: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target = 100 messages

Queue size = 1000

Fleet size = 10

Actual backlog per capacity unit = 1000/10 = 100

Target = Actual No scaling action

Target tracking a batch data processing application:Example continued

Page 17: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Target = 100 messages

Queue size = 1500

Fleet size = 10

Actual backlog per capacity unit = 1500/10 = 150

Target < Actual Auto Scaling adds 5 instances

Queue size = 1500

Fleet size (new) = 15

Actual backlog per capacity unit = 1500/15 = 100

Target = Actual No scaling action

Target tracking a batch data processing application:Example continued

Page 18: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Other best practices

Page 19: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Setting the min/max size of the Auto Scaling group

Max

Cost you’re willing to incur for the application

Enough capacity to support peak load

Min

2-3 EC2 instance per ASG balanced across AZs to ensure 100% up time

Page 20: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Auto Scaling group

EC2 instances have longer bootstrapping timesUse scheduled scaling

Recurring scaling events

Schedule individual events

ELB

EC2 instances

Scaling event

Scaling event

Page 21: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Onboarding with dynamic scaling

Analyze historical trends

Choose the lower end of the range

Adjust as the application becomes more mature

Page 22: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Application Auto Scaling for other services

Fleet

EMR Instance Group

Scalable Target Scalable Dimension

Service TasksECS

Spot Fleet Request Spot InstancesEC2 Spot Fleet

AppStream 2.0

EMRCore nodesTask nodes

AppStream Instances

Tables and Global Secondary Indices (GSI)

Provisioned CapacityDynamoDB

Page 23: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Demo

Page 24: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Questions?

Page 25: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

What are you Scaling? #smoothscaling

Twitter: @arwdufour

Page 26: Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Thank you!aws.amazon.com/autoscaling/getting-started