1 / 66

Optimizing for Cost in the Cloud

Optimizing for Cost in the Cloud. Jinesh Varia @ jinman Technology Evangelist. Multiple dimensions of optimizations. Cost Performance Response time Time to market High-availability Scalability Security Manageability ……. Optimizing for Cost.

banyan
Télécharger la présentation

Optimizing for Cost in the Cloud

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimizing for Cost in the Cloud Jinesh Varia @jinman Technology Evangelist

  2. Multiple dimensions of optimizations Cost Performance Response time Time to market High-availability Scalability Security Manageability …….

  3. Optimizing for Cost

  4. When you turn off your cloud resources, you actually stop paying for them

  5. Continuous optimization in your architecture results in recurring savings in your next month’s bill

  6. Elasticityis one of the fundamental properties of the cloud that drives many of its economic benefits

  7. Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db)

  8. Turn off what you don’t need (automatically)

  9. 25% Savings Optimize by the time of day

  10. www.MyWebSite.com (dynamic data) Amazon Route 53 (DNS) media.MyWebSite.com (static data) Elastic Load Balancer Availability Zone #1 Auto Scaling group : Web Tier Availability Zone #2 Amazon CloudFront Amazon EC2 Auto Scaling group : App Tier Amazon RDS Amazon S3 Amazon RDS

  11. 50% Savings Optimize during a year

  12. 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

  13. Auto scaling Best Practices • Use Auto Scaling Tags • Use Auto scaling Alarms and Email Notifications • Scale up and down symmetrically • Scale up quickly and scaling down slowly • Auto Scaling across Availability Zones • Leverage Suspend and Resume Processes

  14. Example: Scale up by 10% if CPU utilization is greater than 60% for 5 minutes, Scale down by 10% if CPU utilization is less than 30% for 20 minutes.

  15. Agg. CPU Instances

  16. 75% Savings Optimize during a month

  17. 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)

  18. Tip: Use “Reminder scripts” • Disassociate your unused EIPs • Delete unassociated EBS volumes • Delete older EBS snapshots • Leverage S3 Object Expiration

  19. Pick the Right Instance Type

  20. 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

  21. AWS Support – Trusted Advisor – Your personal cloud assistant

  22. Tip – Instance Optimizer Free Memory Free CPU Free HDD At 1-min intervals PUT 2 weeks 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”

  23. Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db) #2 Invest time in Reserved Pricing analysis (EC2, RDS)

  24. Your Best Option: Reserved + On-Demand

  25. Save more when you reserve

  26. m2.xlarge running Linux in US-East Region over 3 Year period Break-even point

  27. Recommendations • Steady State Usage Pattern • For 100% utilization • 3-Year Heavy RI (for maximum savings over on-demand) • Spiky Predictable Usage Pattern • Baseline • 3-Year Heavy RI (for maximum savings over on-demand) • 1-Year Light RI (for lowest upfront commitment) + savings over on-demand • Peak: On-Demand • Uncertain and unpredictable Usage Pattern • Start out small with On-Demand Instances (risk-free and commitment-free) • Switch to some combination of Reserved and On-Demand, if application is successful • If not successful, you walk away having spent a fraction of what you would pay to buy your own technology infrastructure

  28. Example: Simple 3-Tier Web Application

  29. Example: Simple 3-Tier Web Application

  30. Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db) #2 Invest time in Reserved Pricing analysis (EC2, RDS) #3 Architect for Spot Instances (bidding strategies)

  31. Optimize by using Spot Instances

  32. What are Spot Instances? Sold at 50% Discount! Sold at 54% Discount! Unused Unused Sold at 56% Discount! Sold at 59% Discount! Unused Unused Sold at 63% Discount! Sold at 66% Discount! Unused Unused Availability Zone Availability Zone Region

  33. What is the tradeoff? Unused Unused Unused Reclaimed Unused Unused Unused Reclaimed Availability Zone Availability Zone Region

  34. Spot Use cases

  35. Save more money by using Spot Instances Reserved Hourly Price >Spot Price < On-Demand Price

  36. Spot: Example Customers 57% 50% 63% 50% 56% 50% 66% 50%

  37. Typical Spot Bidding Strategies Bid near the Reserved Hourly Price Bid above the Spot Price History Bid near On-Demand Price Bid above the On-Demand Price

  38. 1. Bid Near the Reserved Hourly Price $ $ $$ $ $ $ $$$$$$ $ $ $ $ $ $ $ $$$ $ $ $$$$$$$$$ $ $$$$$ $ $ $ $ 66% Savings over On-Demand

  39. 2. Bid above the Spot Price History 50% Savings over On-Demand

  40. 3. Bid near the On-Demand Price 50% Savings over On-Demand

  41. 4. Bid above the On-Demand Price 57% Savings over On-Demand

  42. Managing Interruption

  43. Amazon EMR (Hadoop): Run Task Nodes on Spot Amazon S3 Upload large datasets or log files directly Input Data Amazon S3 Data Source OutputData Amazon Elastic MapReduce Hadoop Cluster • TaskNode Amazon Elastic MapReduce Amazon SimpleDB Metadata Mapper Reducer Service • NameNode Code/ Scripts • TaskNode HiveQL Pig Latin Cascading Runs multiple JobFlow Steps • Core Node HiveQL Pig Latin Query • CoreNode HDFS BI Apps JDBC/ODBC

  44. Amazon EMR: Reducing Cost with Spot #1: Cost without Spot 4 instances *14 hrs * $0.45 = $25.20 Job Flow Add 5 Spot Instances Scenario #2 Scenario #1 Allocate 4 instances Job Flow #2: Cost with Spot 4 instances *7 hrs * $0.45 = $12.60 + 5 instances * 7 hrs * $0.225 = $7.875 Total = $20.475 Duration: Duration: 14 Hours Time Savings: 50% Cost Savings: ~19% 7 Hours

  45. Made for each other: MapReduce + Spot • Use Case: Web crawling/Search using Hadoop type clusters. Use Reserved Instances for their DB workloads and Spot instances for their indexing clusters. Launch 100’s of instances. • Bidding Strategy: Bid a little above the On-Demand price to prevent interruption. • Interruption Strategy: Restart the cluster if interrupted 66% Savings over On-Demand

  46. Video Transcoding Application Example Amazon S3 Amazon S3 On-demand + Spot Amazon Elastic Compute Cloud Processed Data Output Bucket Input Bucket Raw Data Amazon EC2 Amazon SQS Amazon SQS Reports Website Job Completed Job Output Queue Input Queue Amazon EC2 Website (Job Manager) Metadata Status Logs Exceptions Amazon CloudWatch Amazon SimpleDB Amazon SimpleDB Amazon EC2 Intranet

  47. Use of Amazon SQS in Spot Architectures VisibilityTimeOut Amazon EC2 Spot Instance

  48. Optimizing Video Transcoding Workloads • Premium Offering • Optimized for Faster response times • No Delays Implementation • Invest in RIs • Use on-demand for Elasticity Maximum Bid Price >= On-demand Rate Get Instant Capacity for higher price • Free Offering • Optimize for reducing cost • Acceptable Delay Limits Implementation • Set Persistent Requests • Use on-demand Instances, if delay Maximum Bid Price < On-demand Rate Get your set reduced price for your workload

  49. Persistent Requests

  50. Architecting for Spot Instances : Best Practices • Manage interruption • Split up your work into small increments • Checkpointing: Save your work frequently and periodically • Test Your Application • Track when Spot Instances Start and Stop • Spot Requests • Use Persistent Requests for continuous tasks • Choose maximum price for your requests

More Related