10 tips to improve the performance of your aws application
Post on 02-Nov-2014
560 Views
Preview:
DESCRIPTION
TRANSCRIPT
© 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
(tesslerr@amazon.com)
September 17, 2014
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…
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
Defining Performance Goals
We need X to perform Y
given restriction Z
We need our online video engine to generate videos
faster than being consumed
We need our e-commerce websiteto handle up to 1,000 transactions
per second
Identifying Performance Bottlenecks
Is my workload bound by…
• CPU
• Memory
• Disk I/O
• Network I/O
• System architecture, design
Use Amazon CloudWatch metrics
Bound by CPU
Bound by IOPS
And finally for our …
10 TIPS
Improving COMPUTE Performance
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
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
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
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
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
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
Improving STORAGE Performance
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)
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)
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)
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
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!
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
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
With Amazon S3 – Think ParallelTIP #5
• Single OP bound by transfer rate• Parallel work
With Amazon S3 – Think ParallelTIP #5
• Single OP bound by transfer rate• Parallel work
• With Multiple Objects … Parallel GETs
With Amazon S3 – Think ParallelTIP #5
• Single OP bound by transfer rate• Parallel work
• With Multiple Objects … Parallel GETs Parallel PUTs
With Amazon S3 – Think ParallelTIP #5
?
• Single OP bound by transfer rate• Parallel work
• With Multiple Objects … Parallel GETs Parallel PUTs
• With Large Objects …
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
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
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
Improving NETWORK Performance
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
Use EBS Optimized instances for EBS dedicated throughput
• Network traffic and EBS throughput use same
bandwidth
TIP #7
web appserver
EBS
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
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
Improving SYSTEM WIDE Performance
Website Performance
LONG DISTANCE + POOR NETWORK =
SLOW LOAD TIME
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
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
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
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
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
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
TIP #8 Accelerate Websites using Amazon CloudFront
Persistent Connections Monitored Network Paths
Lower Latency
Higher Throughput
SHORT DISTANCE
OPTIMIZED NETWORK
TIP #8 Accelerate Websites using Amazon CloudFront
Persistent Connections Monitored Network Paths
Lower Latency
Higher Throughput
SHORT DISTANCE
OPTIMIZED NETWORK
= FASTER
LOAD TIME
Offload SSL terminationTIP #9
Elastic LoadBalancing Amazon EC2
SSL
https://https://
Offload SSL terminationTIP #9
Elastic LoadBalancing Amazon EC2
SSL
https://
Reduce load on EC2 instances Easier management
ELB SSL Termination
Last but not least…
Optimize for what matters
• Optimize against performance goals• Optimize for most important use cases
TIP #10
Optimize for what matters
• Amazon Redshift for online reports
TIP #10
Example:
1 TB
Optimize for what matters
• Amazon Redshift for online reports• Data is growing fast
TIP #10
Example:
5 TB
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
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
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
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%)
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%)
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
Thank You!
Ran Tesslertesslerr@amazon.com
top related