80
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. David Brown, General Manager, Elastic Load Balancing December 1, 2016 Elastic Load Balancing Deep Dive & Best Practices NET403

AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Embed Size (px)

Citation preview

Page 1: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

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

David Brown, General Manager, Elastic Load Balancing

December 1, 2016

Elastic Load Balancing

Deep Dive & Best Practices

NET403

Page 2: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

EC2

Instance

Page 3: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load Balancer used to

route incoming requests

to multiple EC2

instances.

ELB

EC2

Instance

EC2

Instance

EC2

Instance

Page 4: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Elastic Load Balancing automatically distributes

incoming application traffic across multiple

applications, microservices and containers hosted on

Amazon EC2 instances.

Page 5: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

SecureElastic Integrated Cost Effective

Page 6: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Elastic Load Balancing provides

high availability by utilizing multiple

Availability Zones

Page 7: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Customer VPC

EC2

Instance

EC2

Instance

us-w

est-

1a

us-w

est-

1b

Amazon

Route 53

ELB VPC

ELB

ELB

Page 8: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Layer 7 (application)Layer 4 (network)

Supports TCP and SSL

Incoming client connection bound to

server connection

No header modification

Proxy Protocol prepends source

and destination IP and ports to

request

Supports HTTP and HTTPS

Connection terminated at the load

balancer and pooled to the server

Headers may be modified

X-Forwarded-For header contains

client IP address

Page 9: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load BalancerAdvanced request routing with support for

microservices and container-based applications.

Page 10: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Classic Application

Protocol TCP, SSL, HTTP, HTTPS HTTP, HTTPS

Platforms EC2-Classic, EC2-VPC EC2-VPC

Health checks ✔ Improved

CloudWatch metrics ✔ Improved

Path-based routing ✔

Container support ✔

WebSockets & HTTP/2 ✔

Page 11: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

New, feature rich, layer 7 load balancing

platform

Fully-managed, scalable and highly

available load balancing platform

Content-based routing allows requests to

be routed to different applications behind a

single load balancer

Application Load Balancer

Page 12: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load Balancer allows for

multiple applications to be hosted

behind a single load balancer

Page 13: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

EC2 instances

registered behind a

Classic Load Balancer

ELB

EC2

Instance

EC2

Instance

EC2

Instance

Page 14: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Running two separate

applications with

Classic Load Balancer

requires multiple load

balancers

ELB

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

ELB

EC2

Instance

orders.example.com

images.example.com

Page 15: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

ELB

/orders

example.com

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance/images

Application Load

Balancer allows for

multiple applications to

be hosted behind a

single load balancer

Page 16: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Multiple applications behind a single load

balancer provides a significant cost saving

Page 17: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Consider blast radius and isolation when

grouping applications behind a

single load balancer

Page 18: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load Balancer provides

native support for microservice and

container-based architectures

Page 19: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Instances can be registered with multiple ports,

allowing for requests to be routed to multiple

containers on a single instance

Amazon ECS will automatically register tasks with

the load balancer using a dynamic port mapping

Can also be used with other container

technologies

Application Load Balancer

Page 20: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

ELB

/orders

example.com

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance/images

Application Load

Balancer allows for

multiple applications to

be hosted behind a

single load balancer

Page 21: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

ELB

/orders

example.com

EC2

Instance

EC2

Instance

EC2

Instance

/images

Application Load

Balancer allows

containers to be

registered with the load

balancerECS

Container

ECS

Container

ECS

Container

Page 22: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Microservice and container-based

architectures provide further cost savings by

improving resource utilization

Page 23: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

New API version provided for creating,

configuring and managing Application Load

Balancers

Follows latest AWS best practices for

resource identifiers and API design

Provides several new resource types,

including target groups, targets and rules

Application Load Balancer

Page 24: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load Balancer

Listener Listener

Page 25: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Define the protocol and port on which the

load balancer listens for incoming

connections

Each load balancer needs at least one

listener to accept incoming traffic, and can

support up to 10 listeners

Routing rules are defined on listeners

Listeners

Page 26: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load Balancer

Listener Listener

Target Group #1

Health Check Health Check Health Check

Target Group #2 Target Group #3

Page 27: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Logical grouping of targets

behind a load balancer

Target groups can be exist independently

from the load balancer, and be associated

with a load balancer when needed

Regional construct that can be associated

with Auto Scaling group

Target Groups

Page 28: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load Balancer

Target Group #1

Health Check Health Check Health Check

EC2 EC2 EC2 EC2 EC2 EC2 ECS ECS ECS

Listener Listener

Target Group #2 Target Group #3

Page 29: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Logical load balancing target, which can be

an EC2 instance, microservice, or

container-based application

EC2 instances can be registered with the

same target group using multiple ports

A single target can be registered with

multiple target groups

Targets

Page 30: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load Balancer

Target Group #1

Health Check Health Check Health Check

EC2 EC2 EC2 EC2 EC2 EC2 ECS ECS ECS

Listener Listener

Target Group #2 Target Group #3

Rule (default) Rule (*/img/*) Rule (default)

Page 31: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Provide the link between listeners and

target groups and consist of conditions and

actions

When a request meets the condition of the

rule, the associated action is taken

Today, rules can forward requests to a

specified target group

Rules

Page 32: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Conditions can be specified in path pattern format

A path pattern is case sensitive, can be up to 128

characters in length, and can contain any of the

following characters:

• A-Z, a-z, 0-9

• _ - . $ / ~ " ' @ : +

• & (using &)

• * (matches 0 or more characters)

• ? (matches exactly 1 character)

Rules (continued)

Page 33: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load Balancer

Target Group #1

Health Check Health Check Health Check

EC2 EC2 EC2 EC2 EC2 EC2 ECS ECS ECS

Listener

Rule (default) Rule (*/img/*)

Listener

Rule (default)

Target Group #2 Target Group #3

Page 34: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Today, load balancers support

up to 10 rules

Page 35: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Support for up to 100 rules coming soon to

Application Load Balancers

Page 36: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Use API deletion protection to prevent a load

balancer from being erroneously deleted

Page 37: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load Balancer provides

improved performance for

Internet applications

Page 38: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Native support for WebSockets, supporting

full-duplex communication channels

over a single TCP connection

Support for HTTP/2 provides improved

page load times from most

of today’s browsers

Improved performance for

real-time and streaming applications

Application Load Balancer

Page 39: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

No additional configuration is required to

enable WebSockets or HTTP/2

Page 40: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Classic Load Balancers have offered IPv6

support for some time

Page 41: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Native support for IPv6 coming soon to

Application Load Balancers

Page 42: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Improvements to application

availability and scalability

Page 43: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

EC2

Instance

Page 44: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Health checks allow for traffic to be shifted

away from impaired or failed instances

Page 45: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

ELB

EC2

Instance

EC2

Instance

EC2

Instance

Health checks ensure

that request traffic is

shifted away from a

failed instance.

Page 46: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

HTTP and HTTPS health checks

Customize the frequency, failure

thresholds, and list of successful

response codes

Detailed reasons for health check failures

are now returned via the API and

displayed in the AWS Management

Console

Health Checks

Page 47: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load Balancer will fail open

should all back-ends fail the health check

Page 48: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Always use

multiple Availability Zones

Page 49: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

ELB VPC Customer VPC

EC2

InstanceELB

ELBEC2

Instance

us-w

est-

1a

us-w

est-

1b

Amazon

Route 53

Page 50: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

ELB VPC Customer VPC

EC2

InstanceELB

ELB

us-w

est-

1a

us-w

est-

1b

Amazon

Route 53

Page 51: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

6

1 Available Zone

Risks Availability

2 Available Zones

6 6

100% Extra Capacity

3 Available Zones

3 3 3

50% Extra Capacity

Page 52: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Using multiple Availability Zones

can bring a few challenges …

Page 53: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Imbalanced Instance Capacity

ELB VPC Customer VPC

EC2

InstanceELB

ELB

us-w

est-

1a

us-w

est-

1b

Amazon

Route 53

EC2

Instances

Page 54: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Cross-Zone Load BalancingELB VPC Customer VPC

EC2

InstanceELB

ELB

us-w

est-

1a

us-w

est-

1b

Amazon

Route 53

EC2

Instances

Page 55: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Distributes requests evenly across

multiple Availability Zones

Absorbs impact of DNS caching and

eliminates imbalances in backend

instance utilization

No additional bandwidth charge for

cross-zone traffic

Cross-Zone Load Balancing

Page 56: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Cross Zone Load Balancing enabled by

default on all Application Load Balancers

Page 57: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Auto Scaling now supports the scaling of

applications at the target group level

Page 58: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load

Balancer integrates

with Auto Scaling to

manage the scaling of

each target group

independently

ELB

/orders

example.com

EC2

Instance

EC2

Instance

EC2

Instance

EC2

Instance

/images

EC2

Instance

Page 59: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

When using Auto Scaling, keep in mind that

your application may be under load

during quiet times

Page 60: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Continued support for advanced

application security features

Page 61: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

SSL Negotiation Policies provide

selection of ciphers and protocols

that adhere to the latest industry best

practices

Optimized for balance between

security and client connectivity, as

tested with Amazon.com traffic

SSL Offloading

Page 62: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load Balancer supports security

groups to limit access to specified ranges

Page 63: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Web Application Firewall support coming

soon to Application Load Balancers

Page 64: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Monitors requests and protects web applications from malicious

activities at the load balancer level

Block, allow, or count web requests based

on WAF rules and conditions

Preconfigured rules available for

common protections: SQL-injection,

cross-site scripting, bad-actor IPs,

bad bots, and HTTP flood attacks

Website Application Firewall

Page 65: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Improved load balancer and

application monitoring

Page 66: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

CloudWatch metrics provided for each

load balancer

Provide detailed insight into the health of

the load balancer and application stack

All metrics provided at 1-minute

granularity

Amazon CloudWatch Metrics

Page 67: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Metrics provided at both the load

balancer and target group level

CloudWatch alarms can be configured to

notify or take action should any metric go

outside of the acceptable range

Auto Scaling can use these metrics for

scaling of the back-end fleet

Amazon CloudWatch Metrics

Page 68: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

HealthyHostCount

The count of the number of healthy instances

in each Availability Zone

Most common cause of unhealthy hosts is

health check exceeding the allocated timeout

Test by making repeated requests to the

backend instance from another EC2 instance

View at the zonal dimension

Page 69: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Latency

Measures the elapsed time, in seconds, from when the request leaves the

load balancer until the response is received

Test by sending requests to the backend instance from another instance

Using min, average, and max CloudWatch stats,

provide upper and lower bounds for latency

Debug individual requests using access logs

Page 70: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Rejected Connection Count

The number of connections that were rejected because the load balancer

could not establish a connection with a healthy target in order to route the

request

This replaces surge queue metrics which are used

by the Classic Load Balancer

Surge queues often impact client applications,

which fast request rejection improves

Normally a sign of an under-scaled application

Page 71: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Target Group Metrics

The following metrics are now provided at the target group level, allowing

for individual applications to be closely monitored:

• RequestCount

• HTTPCode_Target_2XX_Count

• HTTPCode_Target_3XX_Count

• HTTPCode_Target_4XX_Count

• HTTPCode_Target_5XX_Count

• TargetResponseTime (Latency)

• UnHealthyHostCount

• HealthyHostCount

Page 72: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Load balancer request response times

are now provided with percentile

dimensions

Provides visibility into the 90th, 95th, 99th,

or 99.9th percentile of response times

Allows for more meaningful, and

aggressive, performance targets for

applications

CloudWatch Percentiles

Page 73: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

CloudWatch Percentiles

Page 74: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Provide detailed information on each

request processed by the load balancer

Includes request time, client IP address,

latencies, request path, server

responses, ciphers and protocols, and

user-agents

Delivered to an Amazon S3 bucket every

5 or 60 minutes

Access Logs

Page 75: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Application Load Balancers insert a unique

trace identifier into each request using a

custom header: X-Amzn-Trace-ID

Trace identifiers are preserved through the

request chain to allow for request tracing

Trace identifiers are included in access logs

and can also be logged by applications

themselves

Request Tracing

Page 76: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

When should I use

Application Load Balancer?

Page 77: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Classic Application

Protocol TCP, SSL, HTTP, HTTPS HTTP, HTTPS

Platforms EC2-Classic, EC2-VPC EC2-VPC

Health checks ✔ Improved

CloudWatch metrics ✔ Improved

Path-based routing ✔

Container support ✔

WebSockets & HTTP/2 ✔

Page 78: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

For TCP/SSL or EC2-Classic,

use Classic Load Balancer

For all other use-cases,

use Application Load Balancer

Page 79: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Thank you!

Page 80: AWS re:Invent 2016: Elastic Load Balancing Deep Dive and Best Practices (NET403)

Remember to complete

your evaluations!