Deep Dive on Elastic Load Balancing

61
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Mariano Vecchioli – AWS Technical Account Manager Ben Doyle, Senior Infrastructure Engineer, Ensighten July 2016 Deep Dive on Elastic Load Balancing

Transcript of Deep Dive on Elastic Load Balancing

Page 1: Deep Dive on Elastic Load Balancing

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

Mariano Vecchioli – AWS Technical Account ManagerBen Doyle, Senior Infrastructure Engineer, Ensighten

July 2016

Deep Dive onElastic Load Balancing

Page 2: Deep Dive on Elastic Load Balancing

Elastic Load Balancing

Security Scalability Availability

Page 3: Deep Dive on Elastic Load Balancing

Security

Page 4: Deep Dive on Elastic Load Balancing

SSL/TLS SSL Security Policies

• Same-day mitigation for POODLE

• Same-day mitigation for LogJam

• Same-day mitigation for Heartbleed

• RC4 removed in advance of ratings and compliance changes

Page 5: Deep Dive on Elastic Load Balancing

SSL/TLS Management

https://github.com/awslabs/s2n

Page 6: Deep Dive on Elastic Load Balancing

SSL/TLS Management

Page 7: Deep Dive on Elastic Load Balancing

SSL/TLS Cipher Suites

• Always prefer perfect forward secrecy.

• Prefer AES over 3DES over RC4.

• Prefer GCM over CBC + HMAC.

• Compare against billions of connections from real-world clients.

Page 8: Deep Dive on Elastic Load Balancing

SSL/TLS Cipher Suites

• Legacy clients can cause compatibility issues• Old firmware in embedded systems• TVs, controllers, web scrapers…

• ELB defaults strike a balance

• Access log gap analysis

• We recommend ELBSecurityPolicy-2015-05

Page 9: Deep Dive on Elastic Load Balancing

Elastic Load Balancing

2015-05-13T23:39:43.945958Z my-loadbalancer192.168.131.39:2817 10.0.0.1:80 0.000086 0.001048 0.001337 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1” "curl/7.38.0" DHE-RSA-AES128-SHA TLSv1.2

S3

Page 10: Deep Dive on Elastic Load Balancing

Elastic Load Balancing

2015-05-13T23:39:43.945958Z my-loadbalancer192.168.131.39:2817 10.0.0.1:80 0.000086 0.001048 0.001337 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1” "curl/7.38.0" DHE-RSA-AES128-SHA TLSv1.2

Page 11: Deep Dive on Elastic Load Balancing

Elastic Load Balancing

2015-05-13T23:39:43.945958Z my-loadbalancer192.168.131.39:2817 10.0.0.1:80 0.000086 0.001048 0.001337 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1” "curl/7.38.0" DHE-RSA-AES128-SHA TLSv1.2

Page 12: Deep Dive on Elastic Load Balancing

ELB and Security Compartmentalization

Public subnet

Private subnet

Page 13: Deep Dive on Elastic Load Balancing

ELB and Security Compartmentalization

Public subnet

Private subnet

Page 14: Deep Dive on Elastic Load Balancing

ELB and Security Compartmentalization

Public subnet

Private subnet

Page 15: Deep Dive on Elastic Load Balancing

ELB and Security Compartmentalization

Public subnet

Private subnet

Page 16: Deep Dive on Elastic Load Balancing

ELB and Security Compartmentalization

Public subnet

Private subnet

Page 17: Deep Dive on Elastic Load Balancing

ELB and Security Compartmentalization

Public subnet

Private subnet

Page 18: Deep Dive on Elastic Load Balancing

Threat Modeling

Page 19: Deep Dive on Elastic Load Balancing

Scalability

Page 20: Deep Dive on Elastic Load Balancing

Scalability

Latency = Load / Throughput

Page 21: Deep Dive on Elastic Load Balancing

Scalability

Memory Latency

Page 22: Deep Dive on Elastic Load Balancing

Scalability

Caching and cache misses

Page 23: Deep Dive on Elastic Load Balancing

Scalability

Processing time

Cou

nt

Page 24: Deep Dive on Elastic Load Balancing

Scalability

GET / HTTP/1.1

GET /monthly_report/ HTTP/1.1

Page 25: Deep Dive on Elastic Load Balancing

Scalability

Processing time

Cou

nt

Page 26: Deep Dive on Elastic Load Balancing

Scalability

Wait time

Cou

nt

Page 27: Deep Dive on Elastic Load Balancing

Scalability

Page 28: Deep Dive on Elastic Load Balancing

Scalability

Wait time

Cou

ntWeighed round robinSingle server

Page 29: Deep Dive on Elastic Load Balancing

Scalability

Page 30: Deep Dive on Elastic Load Balancing

Scalability

Wait time

Cou

ntWeighed round robinSingle server

Least connections

Page 31: Deep Dive on Elastic Load Balancing

Scalability

Wait time

Cou

nt

Beware of blackholing

traffic

Weighed round robinSingle server

Least connections

Page 32: Deep Dive on Elastic Load Balancing

ELB’s own scaling is a mix of pre-emptive, based on the instance capacity you add, and reactive,

based on the load you receive.

Page 33: Deep Dive on Elastic Load Balancing

CloudWatch and Auto Scaling

All load balancer metrics can be used for Auto Scaling.

Allow you to scale dynamically based on the loadbalancers' view of the application.

Important to consider all metrics when using Auto Scaling; may not be aware of resource contention on another metric.

You may be at peak multiple times a day.

Page 34: Deep Dive on Elastic Load Balancing

13 CloudWatch metrics provided for each load balancer.

Provide detailed insight into the health of the load balancer and application stack.

CloudWatch alarms can be configured to notify or take action, in case any metric goes outside of the acceptable range.

All metrics provided at 1-minute granularity.

Amazon CloudWatch metrics

Page 35: Deep Dive on Elastic Load Balancing

Latency

Measures the time elapsed in seconds after the request leaves the load balancer until the response is received.

Test by sending requests to the back-end instance from another instance.

Using minimum, average, and maximum, CloudWatch stats provide upper and lower bounds for latency.

Debug individual requests using access logs.

Page 36: Deep Dive on Elastic Load Balancing

SurgeQueue and Spillovers

Count of the number of requests that could not be sent to back-end instances.

Queue up to 1,024 requests per load balancernode, after which 503 errors will be returned.

Often caused by not being able to open connections to the back-end instance.

Normally a sign of an underscaled application.

Page 37: Deep Dive on Elastic Load Balancing

• timestamp• elb name• client:port• backend:port• request_processing_time• backend_processing_time• response_processing_time• elb_status_code

• backend_state_code• received_bytes• sent_bytes• “request”• “User-Agent”• Ciphersuite• SSL/TLS protocol version

Access Logs

2015-05-13T23:39:43.945958Z my-loadbalancer 192.168.131.39:2817 10.0.0.1:80 0.000086 0.001048 0.001337 200 200 0 57 "GET https://www.example.com:443/ HTTP/1.1” "curl/7.38.0" DHE-RSA-AES128-SHA TLSv1.2

Page 38: Deep Dive on Elastic Load Balancing

Global Scalability

ELB integrates with Amazon Route 53 latency–based routing and geo-based routing.

Useful for applications where latency is critical.

Online advertising bidding.

Trading 53

Page 39: Deep Dive on Elastic Load Balancing

Availability

Page 40: Deep Dive on Elastic Load Balancing

Ben DoyleSenior Infrastructure Engineer

Digital analytics company with 2 types of products:

- Data collection and analysis of web traffic- Website content (tag) management

Multiple global platforms for both

Page 41: Deep Dive on Elastic Load Balancing

Seamless and graceful replacement of instances

with no downtime

Page 42: Deep Dive on Elastic Load Balancing

Health Checks

ELB

EC2instance

EC2instance

EC2instance

Page 43: Deep Dive on Elastic Load Balancing

Health Checks

Support for TCP and HTTP health checks.

Customize frequency and failure thresholds.

Must return a 200 response.

Think hard about health check “depth”.

Page 44: Deep Dive on Elastic Load Balancing

Idle timeouts allow for connections to be closed by the load balancer when no

longer in use.

Page 45: Deep Dive on Elastic Load Balancing

Length of time that an idle connection should be kept open

For both client and back-end connections

Defaults to 60 seconds but can be set between 1 and 3,600 seconds

Timeouts should decrease as you go up the stack

Idle Timeouts

Page 46: Deep Dive on Elastic Load Balancing

15s

3s

3sELB

15sEC2instances

Amazon S3

Amazon RDS

Amazon SWF3s

9s

Idle Timeouts

Page 47: Deep Dive on Elastic Load Balancing

Multiple Availability Zones

VPC

EC2instanceELB

ELB EC2instance

us-w

est-1

aus

-wes

t-1b

AmazonRoute 53

Page 48: Deep Dive on Elastic Load Balancing

Protected by Route 53 Health Checks

All load balancers scaled to handle theloss of a single Availability Zone.

Amazon Route 53 health checks shift traffic away from the failed Availability Zone.

Completed within 150 seconds.

No other external or control plane dependencies.

Page 49: Deep Dive on Elastic Load Balancing

Health checkers and edge locations perform the same volume of activity,whether endpoints are healthy or unhealthy.

Constant work

time

System activityTime to react

When nothing is failing, the volume of API calls is zero. When failure occurs, the volume of API calls spikes.

time

System activityTime to react

Work on failure

Page 50: Deep Dive on Elastic Load Balancing

Always associate two or more subnets in

different zones with the load balancer

Page 51: Deep Dive on Elastic Load Balancing

Using multiple Availability Zones does bring a few challenges

Page 52: Deep Dive on Elastic Load Balancing

Req

uest

cou

nt

Time

Traffic Imbalances

Page 53: Deep Dive on Elastic Load Balancing

DNS Caching and Spreading

DNS TTLs are generally honored.

But sometimes there simply are not enough DNS servers to spread load around fairly.

Mobile networks typically have a dozen or so top-level resolvers.

Enterprise networks may have as few as one.

Page 54: Deep Dive on Elastic Load Balancing

Multiple Availability Zones

VPC

EC2instanceELB

ELB EC2instance

us-w

est-1

aus

-wes

t-1b

AmazonRoute 53

Page 55: Deep Dive on Elastic Load Balancing

Multiple Availability Zones

EC2instanceELB

ELB

us-w

est-1

aus

-wes

t-1b

AmazonRoute 53

VPC

Page 56: Deep Dive on Elastic Load Balancing

Req

uest

cou

nt

Time

Traffic Imbalances

Cross-zone enabled

Page 57: Deep Dive on Elastic Load Balancing

Load balancer absorbs impact of DNS caching.

Eliminates imbalances in back-end instance utilization.

Requests distributed evenly across multipleAvailability Zones.

Check connection limits before enabling.

No additional bandwidth charge for cross-zone traffic.

Cross-zone Load Balancing

Page 58: Deep Dive on Elastic Load Balancing

Integrated with AWS CloudFormation, AWS OpsWorks, AWS Elastic Beanstalk, Amazon ECS, Amazon API Gateway, and Asgard.

Load balancers are a common gateway for blue/green deployments.

Load balancers can be managed programmatically for immutable Deployments.

ELB and DevOps

Page 59: Deep Dive on Elastic Load Balancing

Recap

Fully Managed SSL/TLS StackAWS Certificate ManagerCompartmentalisation

CloudWatch MetricsAccess LogsGlobal Scalability

Minimal DowntimeRoute53 Health ChecksCross-zone Load Balancing

Page 60: Deep Dive on Elastic Load Balancing

Please remember to rate this session under My Agenda on

awssummit.london

Page 61: Deep Dive on Elastic Load Balancing

Mariano VecchioliAWS Technical Account Manager

[email protected]@

Ben DoyleSenior Infrastructure Engineer

[email protected]__Doyle