136
High Performance Web Applications [email protected] Dr. Matt Wood @mza

High Performance Web Applications

Embed Size (px)

DESCRIPTION

Building high performance web applications with Amazon Web Services.

Citation preview

Page 2: High Performance Web Applications

Hello

Page 3: High Performance Web Applications

Building blocks for wonderful applicationsStorage, compute, databases, managed services

Page 4: High Performance Web Applications
Page 5: High Performance Web Applications

Retail Merchantservices

Web services

Page 6: High Performance Web Applications

Retail Merchantservices

Web services

Page 7: High Performance Web Applications

Getting started withAmazon Web Services

quick review

H

Page 8: High Performance Web Applications

Utility computing

Available at the end of an API call.Metered billing.

H

Page 9: High Performance Web Applications

Family of 20 services

Adding new services and refinement weekly.Rapid rate of innovation.

H

Page 10: High Performance Web Applications

Undi!erentiated heavy lifting

Focus on your app, customers and business

H

Page 11: High Performance Web Applications

H

Page 12: High Performance Web Applications

aws.amazon.com

H

Free account. Free tier.

Page 13: High Performance Web Applications

Building High PerformanceWeb Applications

r

Page 14: High Performance Web Applications

Deliver a great experience toyour customers.

Responsive, fast web applications.

r

Page 15: High Performance Web Applications

g DECOUPLEDSCALE

OUT SOPTIMIZE COSTFOR

CAUTOMATE

vCALIBRATED FOR:

CPU performance vCALIBRATED FOR:

IO performance

5 patterns forperformance

Page 16: High Performance Web Applications

g DECOUPLED

Page 17: High Performance Web Applications

Monolithic Mega System v2

Page 18: High Performance Web Applications

Application

Assets

Analytics

Page 19: High Performance Web Applications

Application

Assets

Analytics

Page 20: High Performance Web Applications

Images, javascript, stylesheets, HTML pages

Deliver as fast as possible to customers

r

Page 21: High Performance Web Applications

Websites without the servers

Highly durable: 99.999999999%Zero config: fire and forget

r

Page 22: High Performance Web Applications
Page 23: High Performance Web Applications

Low latency delivery of assets

Local caching for fast downloadsAmazon CloudFront

r

Page 24: High Performance Web Applications

PP

Page 25: High Performance Web Applications

Create content distributions

From objects in S3Any custom originDynamic, streaming and static content

r

Page 26: High Performance Web Applications

PPP

Page 27: High Performance Web Applications

CNAME?

Map to any custom URLassets.domain.com, www.domain.com

r

Page 28: High Performance Web Applications

Application

Assets

Analytics

Page 29: High Performance Web Applications

Application

Assets

Analytics

Page 30: High Performance Web Applications

Application architecture

Small things, loosely coupled

r

Page 31: High Performance Web Applications

Application

Assets

Analytics

Page 32: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 33: High Performance Web Applications

Shared responsibility

Infrastructure by AWSOS, application and data by customersTools to help meet best practices

r

Page 34: High Performance Web Applications

Security groups

Customer controlled firewallsAll ports are closed by default

r

Page 35: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 36: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

x

Page 37: High Performance Web Applications

Decoupling provides an architectural framework for performance

Easier to separate concerns: assets, streaming, etc.Easier to manage and scale.

r

Page 38: High Performance Web Applications

SCALE

OUT

Page 39: High Performance Web Applications

Elasticity is a tenet of the cloud

Scale up when you need toScale down when you don’t

r

Page 40: High Performance Web Applications

Predictable peaksr

Time

Demand

Capacity

Page 41: High Performance Web Applications

Predictable peaksr

Time

Demand

Capacity

Page 42: High Performance Web Applications

Variable usager

Time

Demand

Capacity

Page 43: High Performance Web Applications

Variable usager

Time

Demand

Capacity

Page 44: High Performance Web Applications

Variable usager

Time

Demand

Page 45: High Performance Web Applications

Horizontal scaling drives performance up

...and costs down

r

Page 46: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 47: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 48: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 49: High Performance Web Applications

Amazon Machine Images encapsulate your app

Customize your virtual machines AMI can be the unit of deployment

r

Page 50: High Performance Web Applications

1. Spin up a new instance using your AMI

Configured to bootstrap the app.

r

Page 51: High Performance Web Applications

2. Pull down latest code base

From S3 or code repository

r

Page 52: High Performance Web Applications

3. Start up the app on the instance

Ready to receive requests

r

Page 53: High Performance Web Applications

4. Register with the load balancer

Job done.

r

Page 54: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 55: High Performance Web Applications

Horizontal scaling allows forfault tolerance

r

Page 56: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 57: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

:(

Application

Assets

Analytics

Page 58: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 59: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 60: High Performance Web Applications

Deploying and scaling a datastore

r

Follow the same patterns: horizontal scale, availability, automation.

Page 61: High Performance Web Applications

One question:

r

Does your application require a strict, controlled schema for query flexibility?

Page 62: High Performance Web Applications

Amazon Relational Database Service

r

Management systems: CRM, ERP, finance

Does your application require a strict, controlled schemafor query flexibility? Yes

Page 63: High Performance Web Applications

Focus on your app

r

Handles tedious database admin tasksDesigned for availability

Page 64: High Performance Web Applications

Multi-engine

r

MySQL, Oracle, Microsoft SQL ServerUp and running in six clicks

Page 65: High Performance Web Applications

Point in time snapshots

r

Automatic. Easy recovery.

Page 66: High Performance Web Applications

High availability

r

Deployed across multiple availability zones.Synchronous writes.

Page 67: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 68: High Performance Web Applications

Read replicas

r

Perfect for read heavy applications.Asynchronous writes. Replication metrics available.

Page 69: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 70: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 71: High Performance Web Applications

Amazon DynamoDB

r

Web apps, social apps, mobile apps, user generated content, unstructured data integration, lots of data.

Does your application require a strict, controlled schemafor query flexibility? No

Page 72: High Performance Web Applications

Focus on your app

r

Managed NoSQL database service.No schema.

Page 73: High Performance Web Applications

Unlimited scale

r

Unlimited storagePay as you go

Page 74: High Performance Web Applications

High performance

r

Single digit millisecond latencies

Page 75: High Performance Web Applications

Zero admin

r

No instances to manageTiny API, perfectly formed

Page 76: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 77: High Performance Web Applications

Asynchronous processing

r

Resize images. Transcode movies. Resample media.

Page 78: High Performance Web Applications

Follow the same best practices

r

Decouple. Stateless. Horizontal scale.

Page 79: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 80: High Performance Web Applications

CloudFront for dynamic content

r

Edge caching for dynamic contentCache by query string parametersMultiple origin serversPersistent connections to origin servers

Page 81: High Performance Web Applications

CAUTOMATE

Page 82: High Performance Web Applications

Automate everything

The tedious. The time consuming. The error prone.

r

Page 83: High Performance Web Applications

For example: when increasing capacity

Launch instance.Update application code.Register with load balancer.

r

Page 84: High Performance Web Applications

Auto-scaling

CloudWatchAuto-scaling serviceElastic Load Balancer

r

Page 85: High Performance Web Applications

Set operational thresholds

Network capacity > 80%Memory utilization > 75%CPU < 50%

r

Page 86: High Performance Web Applications

Automatically respond to operational alarms

r

Network capacity > 80%: add instancesMemory utilization > 75%: add instancesCPU < 50%: remove instances

Page 87: High Performance Web Applications

Set bounds

Step change configured by number or percentage of instances

r

Page 88: High Performance Web Applications

Custom metrics

Respond to custom metricsPage load timeDatabase query time

r

Page 89: High Performance Web Applications

Automatic load balancer configuration

Instances added/removed automaticallyHealth check for running application before routing tra"c

r

Page 90: High Performance Web Applications

Stateless operations are important

Decoupled, but statelessInstances are naive to other instances

r

Page 91: High Performance Web Applications

Treat your data as a royal garden

Backup to S3: high durabilityCompute is a disposable resource

r

Page 92: High Performance Web Applications

vCALIBRATED FOR:

CPU performance

Page 93: High Performance Web Applications

Range of resources

Choose the best instance type for performance

r

Page 94: High Performance Web Applications

r

t1.micro m1.small cc2.8xlarge

Page 95: High Performance Web Applications

r

t1.micro m1.small cc2.8xlarge

High memory

High CPU

High CPU + memory

Page 96: High Performance Web Applications

Load balancer

App servers

Database

Asynchronous processing

Application

Assets

Analytics

Page 97: High Performance Web Applications

1 instance for 100 hours=

100 instances for 1 hour

Page 98: High Performance Web Applications

Balance cost/performance

Mix instance types for application servers, databases, ancillary services, analytics etc.

r

Page 99: High Performance Web Applications

Migrate to large instance types

As your application grows Use 64 bit from the outset, if possible

r

Page 100: High Performance Web Applications

vCALIBRATED FOR:

IO performance

Page 101: High Performance Web Applications

IO bound web applications are more common

Application requires predictable, consistent IO

r

Page 102: High Performance Web Applications

Provisioned throughput with DynamoDB

No need to provision storageProvision IO requirements: reads and writes per second

r

Page 103: High Performance Web Applications
Page 104: High Performance Web Applications
Page 105: High Performance Web Applications
Page 106: High Performance Web Applications
Page 107: High Performance Web Applications

Scale up, and carry on

DynamoDB will manage resources to achieve and maintain throughput

r

Page 108: High Performance Web Applications

Low latency, unlimited scale

Writes acknowledged when saved to disk in multiple data centres. Backed on SSDs.

r

Page 109: High Performance Web Applications

...and SSDs for all

Page 110: High Performance Web Applications

hi1.4xlarge instances

High capacity, high performance storage2 x 1Tb SSD drives

r

Page 111: High Performance Web Applications

Perfect match for databases

Relational and NoSQL storage

r

Page 112: High Performance Web Applications

Perfect match for databases

Relational and NoSQL storage90k to 120k IOPS

r

Page 113: High Performance Web Applications

High performance network

10 gigabit ethernetPlacement groupsPerfect for distributed stores

r

Page 114: High Performance Web Applications

SOPTIMIZE COSTFOR

Page 115: High Performance Web Applications

Economies of scale

Drive down prices for customers20 price drops in past 6 years

r

Page 116: High Performance Web Applications

Maximize utilization

Greater utilization drives down cost

r

Page 117: High Performance Web Applications

Reserved capacity

Time

Utilization

Page 118: High Performance Web Applications

Reserved instances

Small upfront paymentGuaranteed capacity for 1 or 3 yearsLower hourly rate

r

Page 119: High Performance Web Applications

Reserved instance resale

Sell your reservations on the resale marketSellers set your own priceBuyers select and check out

r

Page 120: High Performance Web Applications

Reserved capacity

Time

Utilization

Page 121: High Performance Web Applications

Reserved capacity

On-demand

Time

Utilization

Page 122: High Performance Web Applications

Reserved capacity

On-demand

Time

Utilization

Page 123: High Performance Web Applications

Spot instances

Name your price computing

r

Page 124: High Performance Web Applications

Spot instances

Lower costs‘Overclock’ your app: more bang for your buck

r

Page 125: High Performance Web Applications

Load balancer

App servers

Database on SSDs

Asynchronous processing

Application

Assets

Analytics

Page 126: High Performance Web Applications

Load balancer

App servers

Database on SSDs

Asynchronous processing

Application

Assets

Analytics

Page 127: High Performance Web Applications

Load balancer

App servers

Database on SSDs

Asynchronous processing

Application

Assets

Analytics

Page 128: High Performance Web Applications

Become price aware

Price is a driver of your architecture

r

Page 129: High Performance Web Applications

Automated bidding

Automate bids based on on-demand priceRun on spot only when cost e!ective

r

Page 130: High Performance Web Applications

Continuous cost optimization

Evaluate your reserved instance/on-demand/spot mix regularly as app requirements change

r

Page 131: High Performance Web Applications

5 patterns forperformance

g DECOUPLED

Page 132: High Performance Web Applications

5 patterns forperformance

g DECOUPLEDSCALE

OUT

Page 133: High Performance Web Applications

5 patterns forperformance

g DECOUPLEDSCALE

OUT SOPTIMIZE COSTFOR

Page 134: High Performance Web Applications

5 patterns forperformance

g DECOUPLEDSCALE

OUT SOPTIMIZE COSTFOR

vCALIBRATED FOR:

CPU performance vCALIBRATED FOR:

IO performance

Page 135: High Performance Web Applications

5 patterns forperformance

g DECOUPLEDSCALE

OUT SOPTIMIZE COSTFOR

vCALIBRATED FOR:

CPU performance vCALIBRATED FOR:

IO performanceC

AUTOMATE