10 tips to improve the performance of your aws application

61
© 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc. 10 Tips to Improve the Performance of Your AWS Application Ran Tessler, AWS Solutions Architect ([email protected]) September 17, 2014

Upload: amazon-web-services

Post on 02-Nov-2014

560 views

Category:

Technology


3 download

DESCRIPTION

As users of the AWS platform it is important that we don't re-invent the wheel and we eliminate the undifferentiated heavy lifting of IT to free up scarce engineering resources that can focus on truly adding value to business-related activities. In this technical session an AWS Solution Architect will take you through a few tip and trick gems, potentially something you didn't know existed, allowing you to more efficiently and securely deploy, utilise and manage the vast array of Amazon Web Services to support your business requirements.

TRANSCRIPT

Page 1: 10 tips to improve the performance of your AWS application

© 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc.

10 Tips to Improve the Performance of Your AWS Application

Ran Tessler, AWS Solutions Architect

([email protected])

September 17, 2014

Page 2: 10 tips to improve the performance of your AWS application

Agenda

• Why Performance Matters?

• Defining Performance Goals

• Identifying Performance Bottlenecks

• 10 Performance Tips

performance/pəˈfɔːm(ə)ns/

The capabilities of a machine, product, or vehicle…

Page 3: 10 tips to improve the performance of your AWS application

Why Performance Matters?

• Better user experience– E.g., Page load time, Report generation

• Meeting required performance threshold – E.g., Real Time Bidding, Online media

• Improve cost-performance ratio– TCO

– Business model validity

Page 4: 10 tips to improve the performance of your AWS application

Defining Performance Goals

Page 5: 10 tips to improve the performance of your AWS application

We need X to perform Y

given restriction Z

Page 6: 10 tips to improve the performance of your AWS application

We need our online video engine to generate videos

faster than being consumed

Page 7: 10 tips to improve the performance of your AWS application

We need our e-commerce websiteto handle up to 1,000 transactions

per second

Page 8: 10 tips to improve the performance of your AWS application

Identifying Performance Bottlenecks

Page 9: 10 tips to improve the performance of your AWS application

Is my workload bound by…

• CPU

• Memory

• Disk I/O

• Network I/O

• System architecture, design

Page 10: 10 tips to improve the performance of your AWS application

Use Amazon CloudWatch metrics

Bound by CPU

Bound by IOPS

Page 11: 10 tips to improve the performance of your AWS application

And finally for our …

10 TIPS

Page 12: 10 tips to improve the performance of your AWS application

Improving COMPUTE Performance

Page 13: 10 tips to improve the performance of your AWS application

Match EC2 instance type to workloadTIP #1

• Choose EC2 instance family– M3, T2 General Purpose

– C3 Compute Optimized

– R3 Memory Optimized

– G2 GPU

– I2, HS1 Storage Optimized

• Use current generation instances– Migrate previous generation instances.

– E.g., m1.large -> m3.large: 50% CPU performance, 20% price per hour

• Tune instance size– micro, small, medium, large, xlarge, 2xlarge, 4xlarge, 8xlarge

Page 14: 10 tips to improve the performance of your AWS application

Use burstable compute for burstable workload

• Need occasional bursts• Average CPU utilization is low

Web servers Developer environments Build servers Small databases …

Underutilized CPU

TIP #2

Page 15: 10 tips to improve the performance of your AWS application

Use burstable compute for burstable workloadTIP #2

T2 - New Low-Cost General Purpose EC2 instances

Jul 1, 2014

Baseline level of CPU performance

Ability to burst above the baseline

Page 16: 10 tips to improve the performance of your AWS application

Use burstable compute for burstable workloadTIP #2

• Hourly CPU Credit Allowance

• CPU Credit = 1 minute 100% Core

T2 - New Low-Cost General Purpose EC2 instances

Jul 1, 2014

Page 17: 10 tips to improve the performance of your AWS application

Use burstable compute for burstable workloadTIP #2

• Hourly CPU Credit Allowance

• CPU Credit = 1 minute 100% Core

• CPU Credit Balance:24 hour accumulation

T2 - New Low-Cost General Purpose EC2 instances

Jul 1, 2014

Page 18: 10 tips to improve the performance of your AWS application

Use burstable compute for burstable workloadTIP #2

T2 - New Low-Cost General Purpose EC2 instances

Jul 1, 2014 • Hourly CPU Credit

Allowance

• CPU Credit = 1 minute 100% Core

• CPU Credit Balance:24 hour accumulation

Page 19: 10 tips to improve the performance of your AWS application

Improving STORAGE Performance

Page 20: 10 tips to improve the performance of your AWS application

Use EBS General Purpose (SSD) by defaultTIP #3

Volume TypeEBS Magnetic

Storage Media Magnetic-backed

Max IOPS 40-200

Max Throughput 40-90 MBps

Latency (random read) 20-40 ms

API Name standard

Price* $.05 /GB - Month

$.10 /million I/O

* Prices shown in US East (N Virginia)

Page 21: 10 tips to improve the performance of your AWS application

Use EBS General Purpose (SSD) by defaultTIP #3

Volume TypeEBS Magnetic

EBSProvisioned IOPS (SSD)

Storage Media Magnetic-backed SSD-backed

Max IOPS 40-200 4,000

Max Throughput 40-90 MBps 128 MBps

Latency (random read) 20-40 ms 1-2 ms

API Name standard io1

Price* $.05 /GB - Month

$.10 /million I/O

$.125 /GB – Month

$.065 /provisioned IOPS

* Prices shown in US East (N Virginia)

Page 22: 10 tips to improve the performance of your AWS application

Use EBS General Purpose (SSD) by defaultTIP #3

Volume TypeEBS Magnetic

EBS General Purpose (SSD)

EBSProvisioned IOPS (SSD)

Storage Media Magnetic-backed SSD-backed SSD-backed

Max IOPS 40-200 3,000 (burst) 4,000

Max Throughput 40-90 MBps 128 MBps 128 MBps

Latency (random read) 20-40 ms 1-2 ms 1-2 ms

API Name standard gp2 io1

Price* $.05 /GB - Month

$.10 /million I/O

$.10 /GB - Month $.125 /GB – Month

$.065 /provisioned IOPS

* Prices shown in US East (N Virginia)

Page 23: 10 tips to improve the performance of your AWS application

Use EBS General Purpose (SSD) by defaultTIP #3

• 3 IOPS per GB per second• Unused IOPS accumulate up to 5.4M• Burst up to 3,000 IOPS• Initial credit of 5.4M IOPS = 30 minutes 3,000 IOPS

How It Works

Page 24: 10 tips to improve the performance of your AWS application

Use EBS General Purpose (SSD) by defaultTIP #3

• EBS Magnetic– 40-200 IOPS– $0.40+ IO /month

• General Purpose (SSD)– 3,000 IOPS for 30 minutes– 24 IOPS baseline (8 GB x 3)– $0.80 /month

8 GB - Boot Volumes

Faster boot time!

Page 25: 10 tips to improve the performance of your AWS application

Use EBS General Purpose (SSD) by defaultTIP #3

• Provisioned IOPS– 3,000 IOPS– $323 /month

• General Purpose (SSD)– 3,000 IOPS (1,024 GB * 3 > 3,000)– $102.4 per month

1 TB - Large Data Volumes

68% cost reduction

Page 26: 10 tips to improve the performance of your AWS application

Use Instance Store volumes for temporary data

• Temporary block-level storage • Physically attached to host machine• Available to most EC2 instance types• No additional cost

TIP #4

Temporary file storage Tmp folder Swap space …

Host Computer 1 Host Computer 2

Page 27: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

• Single OP bound by transfer rate• Parallel work

Page 28: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

• Single OP bound by transfer rate• Parallel work

• With Multiple Objects … Parallel GETs

Page 29: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

• Single OP bound by transfer rate• Parallel work

• With Multiple Objects … Parallel GETs Parallel PUTs

Page 30: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

?

• Single OP bound by transfer rate• Parallel work

• With Multiple Objects … Parallel GETs Parallel PUTs

• With Large Objects …

Page 31: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

• Single OP bound by transfer rate• Parallel work

• With Multiple Objects … Parallel GETs Parallel PUTs

• With Large Objects … Multipart Upload

Page 32: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

• Single OP bound by transfer rate• Parallel work

• With Multiple Objects … Parallel GETs Parallel PUTs

• With Large Objects … Multipart Upload Parallel range GETs

Page 33: 10 tips to improve the performance of your AWS application

With Amazon S3 – Think ParallelTIP #5

TransferManager tm = new TransferManager(new ProfileCredentialsProvider());

// TransferManager processes all transfers asynchronously.Upload upload = tm.upload(bucketName, keyName, new File(filePath));try {

// You can block and wait for the upload to finishupload.waitForCompletion();

} catch (AmazonClientException amazonClientException) {...

}

Use AWS CLI and SDKs

Page 34: 10 tips to improve the performance of your AWS application

Improving NETWORK Performance

Page 35: 10 tips to improve the performance of your AWS application

Use Enhanced Networking

• Single root I/O virtualization (SR-IOV)• Significantly higher Packets Per Second (PPS)• Lower network jitter• Lower latency

Requirements • R3, C3 & I2 instances• HVM instances• VPC

TIP #6

SR-IOV

Page 36: 10 tips to improve the performance of your AWS application

Use EBS Optimized instances for EBS dedicated throughput

• Network traffic and EBS throughput use same

bandwidth

TIP #7

web appserver

EBS

Page 37: 10 tips to improve the performance of your AWS application

Use EBS Optimized instances for EBS dedicated throughput

• Network traffic and EBS throughput use same

bandwidth

• Disk and Network intensive I/O workloads may lead to

contention

TIP #7

web appserver

EBS

Page 38: 10 tips to improve the performance of your AWS application

Use EBS Optimized instances for EBS dedicated throughput

• Network traffic and EBS throughput use same

bandwidth

• Disk and Network intensive I/O workloads may lead to

contention

• EBS Optimized EC2 instances deliver dedicated EBS

throughput

TIP #7

web appserver

EBS

Page 39: 10 tips to improve the performance of your AWS application

Improving SYSTEM WIDE Performance

Page 40: 10 tips to improve the performance of your AWS application

Website Performance

LONG DISTANCE + POOR NETWORK =

SLOW LOAD TIME

Page 41: 10 tips to improve the performance of your AWS application

TIP #8

Dynamic Content

or

Custom OriginElastic LoadBalancing

Amazon EC2

Static Content

or

Custom OriginAmazon S3

www.example.com/*.php

static.example.com/*.jpg

Accelerate Websites using Amazon CloudFront

Page 42: 10 tips to improve the performance of your AWS application

TIP #8

Dynamic Content

or

Custom OriginElastic LoadBalancing

Amazon EC2

Static Content

or

Custom OriginAmazon S3

www.example.com/*.php

cdn.example.com/*.jpg

Amazon CloudFront

Accelerate Websites using Amazon CloudFront

Page 43: 10 tips to improve the performance of your AWS application

TIP #8

Dynamic Content

or

Custom OriginElastic LoadBalancing

Amazon EC2

Static Content

or

Custom OriginAmazon S3

www.example.com

Amazon CloudFront

Accelerate Websites using Amazon CloudFront

Page 44: 10 tips to improve the performance of your AWS application

TIP #8

Dynamic Content

or

Custom OriginElastic LoadBalancing

Amazon EC2

Static Content

or

Custom OriginAmazon S3

www.example.com

Amazon CloudFront

Accelerate Websites using Amazon CloudFront

Lower Latency

Higher Throughput

Page 45: 10 tips to improve the performance of your AWS application

TIP #8

Dynamic Content

or

Custom OriginElastic LoadBalancing

Amazon EC2

Static Content

or

Custom OriginAmazon S3

www.example.com

Amazon CloudFront

Accelerate Websites using Amazon CloudFront

Persistent Connections Monitored Network Paths

Lower Latency

Higher Throughput

Page 46: 10 tips to improve the performance of your AWS application

TIP #8

Static Content

or

Custom OriginAmazon S3

Amazon CloudFront

Accelerate Websites using Amazon CloudFront

Persistent Connections Monitored Network Paths

Lower Latency

Higher Throughput

SHORT DISTANCE

Page 47: 10 tips to improve the performance of your AWS application

TIP #8 Accelerate Websites using Amazon CloudFront

Persistent Connections Monitored Network Paths

Lower Latency

Higher Throughput

SHORT DISTANCE

OPTIMIZED NETWORK

Page 48: 10 tips to improve the performance of your AWS application

TIP #8 Accelerate Websites using Amazon CloudFront

Persistent Connections Monitored Network Paths

Lower Latency

Higher Throughput

SHORT DISTANCE

OPTIMIZED NETWORK

= FASTER

LOAD TIME

Page 49: 10 tips to improve the performance of your AWS application

Offload SSL terminationTIP #9

Elastic LoadBalancing Amazon EC2

SSL

https://https://

Page 50: 10 tips to improve the performance of your AWS application

Offload SSL terminationTIP #9

Elastic LoadBalancing Amazon EC2

SSL

https://

Reduce load on EC2 instances Easier management

ELB SSL Termination

Page 51: 10 tips to improve the performance of your AWS application

Last but not least…

Page 52: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Optimize against performance goals• Optimize for most important use cases

TIP #10

Page 53: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Amazon Redshift for online reports

TIP #10

Example:

1 TB

Page 54: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Amazon Redshift for online reports• Data is growing fast

TIP #10

Example:

5 TB

Page 55: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Amazon Redshift for online reports• Data is growing fast• Over 10 TB of compressed data … and …

TIP #10

Example:

10 TB

Page 56: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Amazon Redshift for online reports• Data is growing fast• Over 10 TB of compressed data … and …

TIP #10

Example:

Dense StorageHDD

Fast

$1,000 / TB / Year

Dense ComputeSSD

Faster

$5,500 / TB / year?

* 3 Year Reserved Instance Pricing

Page 57: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Data goes back 3 years• 95% of queries are on last 1 month

TIP #10

Example:

Dense StorageHDD

Fast

$1,000 / TB / Year

Dense ComputeSSD

Faster

$5,500 / TB / year?

* 3 Year Reserved Instance Pricing

Page 58: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Data goes back 3 years• 95% of queries are on last 1 month

TIP #10

Example:

Hot Cluster Dense Compute

500 GB

Last month (95%)

Page 59: 10 tips to improve the performance of your AWS application

Optimize for what matters

• Data goes back 3 years• 95% of queries are on last 1 month

TIP #10

Example:

Hot Cluster Dense Compute

500 GB

Cold Cluster Dense Storage

10 TB

Over a months (5%)

Page 60: 10 tips to improve the performance of your AWS application

Key Takeaways• Match EC2 instance type to workload • Use burstable compute for burstable workload

• Use EBS General Purpose (SSD) by default • Use Instance Store volumes for temporary data• With Amazon S3 – Think Parallel

• Use Enhanced Networking• Use EBS Optimized instances for EBS dedicated throughput

• Accelerate Websites using Amazon CloudFront• Offload SSL termination• Optimize performance for what matters to your business

Compute

Storage

Network

Architecture

Page 61: 10 tips to improve the performance of your AWS application

Thank You!

Ran [email protected]