Optimizing for Cost in the Cloud   Jinesh Varia
Multiple dimensions of optimizations  Cost  Performance  Response time  Time to market  High-availability  Scalability  Se...
Optimizing for Cost
When you turn off your cloud resources,  you actually stop paying for them
Continuous optimization inyour architecture results in recurring savingsin your next month’s bill
Elasticity is one of the fundamentalproperties of the cloud that drives many of its              economic benefits
Optimize based on demand Understand your usage patterns
Optimize by time of the day                                    Daily CPU Load        14        12        10         8 Load...
www.MyWebSite.com         (dynamic data)                       Amazon Route 53                                            ...
Optimize by seasonal cycles                                  Yearly CPU Load       12       10        8                   ...
Auto scaling : Types of Scaling Scaling by Schedule   Use Scheduled Actions in Auto Scaling Service      • Date      • Ti...
Optimize during the month                                     End of the Month Scaling                   3.5              ...
End of the month processing Expand the cluster at the end of the month   Expand/Shrink feature in Amazon Elastic MapReduc...
Choosing the right pricing model  On-demand Instances vs. Reserved Instances
Steady State Usage Total Cost for 1 Year-term of 2 application servers                      Usage Fee   One-time Fee   Tot...
450,000                          On Demand               1-year RI       3-year RI400,000350,000300,000250,000200,000     ...
Recommendations Steady State Usage : Use All Reserved   If you plan on running for at least 6 months, invest in RI    for...
Common Pattern: Reserved + On-Demand
Recommendations Steady State Usage : Use All Reserved   If you plan on running for at least 6 months, invest in RI    for...
Choosing the right pricing model   On-demand Instances vs. Spot Instances
Save more money by using Spot Instances
Spot Use cases  Use Case               Types of Applications  Batch Processing       Generic background processing (scale ...
Basic tactics for Spot Instances Try to launch Spot instances first and then on-demand instances if you don’t get the spot...
Video Transcoding Application Example                     Amazon S3                                               Amazon S...
Use of Amazon SQS in Spot Architectures         VisibilityTimeOut                             Amazon EC2                  ...
Best Practices for using Spot Instances Save Your Work Frequently Add Checkpoints Split up Your Work Test Your Application...
Case Study: Optimizing VideoTranscoding Workloads (On-demand + Spot + Reserved)  Free Offering                Premium Offe...
Optimize by choosing the RightInstance TypeM1.xlarge, c1.medium, multiple m1.small etc.
Basic recommendations on Instance Type Choose the EC2 instance type that best matches the resources required by the applic...
Tip – Instance Optimizer             Free Memory              Free CPU        PUT                       2 weeks           ...
Optimize using AWS Import ExportAWS Import Export vs. Amazon S3 Standard Upload
AWS Import/Export vs. S3 upload costs$1,200$1,000 $800 $600                                                             Im...
AWS Import/Export vs. S3 upload time savings       60       50       40Days       30                                      ...
Optimize by converting ancillaryinstances into servicesLeverage CloudWatch, SNS, SQS, SES, ELB
Load BalancingSoftware LB on EC2        Elastic Load BalancingPros                      Pros• Application-tier load   • El...
$0.028 per hour                   DNS   Elastic Load                                                      Web Servers     ...
Software v/s ServicesSoftware on EC2          SNS, SQS, SESPros                     Pros• Custom features        • Pay as ...
Consumers                          Producer     SQS queue$0.01 per10,000 Requests($0.000001 per Request)$0.095     per hou...
Optimize for performance andcost by page caching andedge-caching static contentAmazon EC2 vs. Amazon S3 vs. Amazon CF + S3
When am I charged?                                    Paris                                                               ...
When content is popular…                                    Paris                                                         ...
Architectural Recommendations We recommend using S3 + CF as it will reduce the cost as well as reduce latency for static d...
Optimize by using ‘Reminder scripts’Turn off your unused EIPs, unassociated EBSvolumes
Summary: Tips on how to further save cost Optimizing for the Cloud   Optimize based on demand      • Optimize by time of ...
Thank you!jvaria@amazon.com  Twitter: @jinman
http://aws.amazon.com
Optimize by Implementing ElasticityInfrastructureCost $             Large                            You just lost        ...
AWS Summit 2011: Optimizing for Cost in the AWS Cloud
Upcoming SlideShare
Loading in...5
×

AWS Summit 2011: Optimizing for Cost in the AWS Cloud

1,481

Published on

Published in: Technology, Travel, Business
1 Comment
4 Likes
Statistics
Notes
  • updated version - http://www.slideshare.net/AmazonWebServices/optimizing-for-cost-in-the-aws-cloud-5-ways-to-further-save-aws-summit-2012-nyc-jinesh-varia
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
1,481
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
35
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

AWS Summit 2011: Optimizing for Cost in the AWS Cloud

  1. 1. Optimizing for Cost in the Cloud Jinesh Varia
  2. 2. Multiple dimensions of optimizations Cost Performance Response time Time to market High-availability Scalability Security Manageability…….
  3. 3. Optimizing for Cost
  4. 4. When you turn off your cloud resources, you actually stop paying for them
  5. 5. Continuous optimization inyour architecture results in recurring savingsin your next month’s bill
  6. 6. Elasticity is one of the fundamentalproperties of the cloud that drives many of its economic benefits
  7. 7. Optimize based on demand Understand your usage patterns
  8. 8. Optimize by time of the day Daily CPU Load 14 12 10 8 Load 6 25% Savings 4 2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Hour
  9. 9. www.MyWebSite.com (dynamic data) Amazon Route 53 media.MyWebSite.com (DNS) (static data) Elastic Load Balancer Amazon Auto Scaling group : Web Tier CloudFront Amazon EC2 Auto Scaling group : App Tier Amazon RDS Amazon Amazon S3Availability Zone #1 RDS Availability Zone #2
  10. 10. Optimize by seasonal cycles Yearly CPU Load 12 10 8 50% SavingsLoad 6 4 2 0 1 5 9 13 17 21 25 29 33 37 41 45 49 Weeks of the Year
  11. 11. Auto scaling : Types of Scaling Scaling by Schedule  Use Scheduled Actions in Auto Scaling Service • Date • Time • Min and Max of Auto Scaling Group Size  You can create up to 125 actions, scheduled up to 31 days into the future, for each of your auto scaling groups. This gives you the ability to scale up to four times a day for a month. Scaling by Policy  Scaling up Policy - Double the group size  Scaling down Policy - Decrement by 1
  12. 12. Optimize during the month End of the Month Scaling 3.5 3DB Instance Type 2.5 2 1.5 75% Savings 1 0.5 0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 Days of the Month
  13. 13. End of the month processing Expand the cluster at the end of the month  Expand/Shrink feature in Amazon Elastic MapReduce Vertically Scale up at the end of the month  Modify-DB-Instance (in Amazon RDS) (or a New RDS DB Instance )  CloudFormation Script (in Amazon EC2)
  14. 14. Choosing the right pricing model On-demand Instances vs. Reserved Instances
  15. 15. Steady State Usage Total Cost for 1 Year-term of 2 application servers Usage Fee One-time Fee Total Savings Option 1 $1493 - $1493 - On-Demand only Option 2 On-Demand + $1008 $227 $1234 ~20% Reserved Option 3 All reserved $528 $455 $983 ~35% Total Cost for 3 Year-term of the same 2 application servers Usage Fee One-time Fee Total Savings Option 1 $4479 - $4479 - On-Demand only Option 2 On-Demand + $3024 $350 $3374 ~30% Reserved Option 3 All reserved $1584 $700 $2284 ~50%
  16. 16. 450,000 On Demand 1-year RI 3-year RI400,000350,000300,000250,000200,000 2150,000 3100,000 50,000 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1-year RI versus On Demand: 1 cost savings realized after first 6 months of usage 3-year RI versus On Demand: 2 cost savings realized after first 9 months of usage. 3-year RI versus 1-year RI: 3 Net savings of 3-year RI versus 1-year RI begin by month 13 and continue throughout the RI term (additional 23 months of savings)
  17. 17. Recommendations Steady State Usage : Use All Reserved  If you plan on running for at least 6 months, invest in RI for 1-year term  If you plan on running for at least 8.7 months, invest in RI for 3-year term
  18. 18. Common Pattern: Reserved + On-Demand
  19. 19. Recommendations Steady State Usage : Use All Reserved  If you plan on running for at least 6 months, invest in RI for 1-year term  If you plan on running for at least 8.7 months, invest in RI for 3-year term Unpredictable Demand : Use combination of Reserved + On-demand  With Reserved Instances, the costs average to an effective hourly rate 40% lower than the On-Demand rate.
  20. 20. Choosing the right pricing model On-demand Instances vs. Spot Instances
  21. 21. Save more money by using Spot Instances
  22. 22. Spot Use cases Use Case Types of Applications Batch Processing Generic background processing (scale out computing) Hadoop Hadoop/MapReduce processing type jobs (e.g. Search, Big Data, etc.) Scientific Computing Scientific trials/simulations/analysis in chemistry, physics, and biology Video and Image Transform videos into specific formats Processing/Rendering Testing Provide testing of software, web sites, etc Web/Data Crawling Analyzing data and processing it Financial Hedgefund analytics, energy trading, etc HPC Utilize HPC servers to do embarrassingly parallel jobs Cheap Compute Backend servers for Facebook games
  23. 23. Basic tactics for Spot Instances Try to launch Spot instances first and then on-demand instances if you don’t get the spot instances in under 15 minutes Use Spot and On-demand in Hybrid Fashion. Master Node in Cluster is on-demand instance, worker nodes are spot instances
  24. 24. Video Transcoding Application Example Amazon S3 Amazon S3 Amazon Elastic Compute Cloud Input Output Bucket BucketAmazon EC2 Amazon SQS Amazon SQS Job Completed Reports Job Website Input Output Website Queue Queue Amazon EC2 (Job Manager) On-demand + Spot Amazon Amazon SimpleDB CloudWatch Amazon SimpleDB Amazon EC2 Intranet
  25. 25. Use of Amazon SQS in Spot Architectures VisibilityTimeOut Amazon EC2 Spot Instance
  26. 26. Best Practices for using Spot Instances Save Your Work Frequently Add Checkpoints Split up Your Work Test Your Application Minimize Group Instance Launches Use Persistent Requests for Continuous Tasks Track when Spot Instances Start and Stop Access Large Pools of Compute Capacity
  27. 27. Case Study: Optimizing VideoTranscoding Workloads (On-demand + Spot + Reserved) Free Offering Premium Offering  Optimize for reducing  Optimized for Faster cost response times  Acceptable Delay Limits  No DelaysImplementation Implementation  Set Persistent Requests  Invest in RIs  Use on-demand  Use on-demand for Instances, if delay Elasticity Maximum Bid Price Maximum Bid Price < On-demand Rate >= On-demand Rate Get your set reduced Get Instant Capacity for price for your workload higher price
  28. 28. Optimize by choosing the RightInstance TypeM1.xlarge, c1.medium, multiple m1.small etc.
  29. 29. Basic recommendations on Instance Type Choose the EC2 instance type that best matches the resources required by the application  Start with memory requirements and architecture type (32bit or 64-bit)  Then choose the closest number of virtual cores required Scaling across AZs  Smaller sizes give more granularity for deploying to multiple AZs
  30. 30. Tip – Instance Optimizer Free Memory Free CPU PUT 2 weeks Free HDD At 1-min intervals Alarm Amazon CloudWatch Instance Custom Metrics “You could save a bunch of money by switching to a small instance, Click on CloudFormation Script to Save”
  31. 31. Optimize using AWS Import ExportAWS Import Export vs. Amazon S3 Standard Upload
  32. 32. AWS Import/Export vs. S3 upload costs$1,200$1,000 $800 $600 Import/Export S3 upload $400 $200 $0 100Gb 500Gb 1 Tb 2 Tb 3 Tb 5 Tb * 10 Tb **
  33. 33. AWS Import/Export vs. S3 upload time savings 60 50 40Days 30 Import/Export S3 upload 20 10 0 100 Gb 500 Gb 1 Tb 2 Tb 3 Tb 5 Tb
  34. 34. Optimize by converting ancillaryinstances into servicesLeverage CloudWatch, SNS, SQS, SES, ELB
  35. 35. Load BalancingSoftware LB on EC2 Elastic Load BalancingPros Pros• Application-tier load • Elastic and Fault-tolerant balancer • Auto scaling • Monitoring includedCons Cons• SPOF • For Internet-facing traffic• Elasticity has to be only implemented manually• Not as cost-effective
  36. 36. $0.028 per hour DNS Elastic Load Web Servers Balancer Availability Zone$0.095 per hour(small instance) EC2 instance DNS + software LB Web Servers Availability Zone
  37. 37. Software v/s ServicesSoftware on EC2 SNS, SQS, SESPros Pros• Custom features • Pay as you go • ScalabilityCons • Availability• Requires an instance • High performance• SPOF• Limited to one AZ• DIY administration
  38. 38. Consumers Producer SQS queue$0.01 per10,000 Requests($0.000001 per Request)$0.095 per hour (small instance) Producer EC2 instance Consumers + software queue
  39. 39. Optimize for performance andcost by page caching andedge-caching static contentAmazon EC2 vs. Amazon S3 vs. Amazon CF + S3
  40. 40. When am I charged? Paris Client Edge Location Client Amazon Simple Singapore Storage Service (S3) Edge Location London Edge Location Client
  41. 41. When content is popular… Paris Client Edge Location Client Amazon Simple Singapore Storage Service (S3) Edge Location London Edge Location Client
  42. 42. Architectural Recommendations We recommend using S3 + CF as it will reduce the cost as well as reduce latency for static data  Depends on cache-hit ratio For Video Streaming, use CF as there is no need of separate streaming server running Adobe FMS
  43. 43. Optimize by using ‘Reminder scripts’Turn off your unused EIPs, unassociated EBSvolumes
  44. 44. Summary: Tips on how to further save cost Optimizing for the Cloud  Optimize based on demand • Optimize by time of the day • Optimize during the month • Optimize by seasonal yearly cycles  Optimize by investing in Reserved Instances  Optimize using Spot instances  Choosing the right Instance Type  Optimize using AWS Import Export Service  Optimize by converting ancillary instances into services  Optimize for performance and cost by page caching and edge-caching static content  Optimize by turning off unused resources
  45. 45. Thank you!jvaria@amazon.com Twitter: @jinman
  46. 46. http://aws.amazon.com
  47. 47. Optimize by Implementing ElasticityInfrastructureCost $ Large You just lost Capital customers Expenditure Predicted Demand Opportunity Traditional Cost Hardware Wastage Actual Demand Cloud Automated Elasticity time

×