Your SlideShare is downloading. ×
Optimizing for Cost in the Cloud             Jinesh Varia               @jinman         Technology Evangelist
Multiple dimensions of optimizations                                  Cost                                  Performance   ...
Optimizing for Cost
When you turn off your cloud resources,     you actually stop paying for them
Continuous optimization in your architecture results       in recurring savings in your next month’s bill
Elasticity is one of the fundamentalproperties of the cloud that drives many of its                            economic be...
Optimizing for Cost…  #1 Use only what you need (use Auto Scaling Service, modify–db)
Turn off what you don’t need (automatically)
Daily CPU Load         14         12         10         8  Load         6                           25% Savings         4 ...
www.MyWebSite.com         (dynamic data)                       Amazon Route 53                                            ...
Web Servers           50% Savings                1   5    9   13   17   21   25   29   33   37   41   45   49             ...
Auto scaling : Types of ScalingScaling by Schedule• Use Scheduled Actions in Auto Scaling Service    • Date    • Time    •...
Auto scaling Best PracticesUse Auto Scaling TagsUse Auto scaling Alarms and Email NotificationsScale up and down symmetric...
Example:Scale up by 10%if CPU utilization is greater than 60%for 5 minutes,Scale down by 10%if CPU utilization is less tha...
Instances   Agg. CPU
RDS DB Servers                        75% Savings                 1   3   5   7   9   11   13   15   17   19   21   23   2...
End of the month processingExpand the cluster at the end of the month• Expand/Shrink feature in Amazon Elastic MapReduceVe...
Tip: Use “Reminder scripts”   Disassociate your unused EIPs   Delete unassociated EBS volumes   Delete older EBS snapsh...
Pick the Right Instance Type
Basic recommendations on Instance TypeChoose the EC2 instance type that best matches the resourcesrequired by the applicat...
AWS Support – Trusted Advisor –  Your personal cloud assistant
Tip – Instance Optimizer              Free Memory               Free CPU         PUT                       2 weeks        ...
Optimizing for Cost…  #1 Use only what you need (use Auto Scaling Service, modify–db)        #2 Invest time in Reserved Pr...
Your Best Option: Reserved + On-Demand
Save more when you reserve   On-demand           Reserved    Instances          Instances                          Heavy  ...
$14,000                     m2.xlarge running Linux in US-East Region          $12,000                     over 3 Year per...
RecommendationsSteady State Usage Pattern• For 100% utilization    • 3-Year Heavy RI (for maximum savings over on-demand)S...
Example: Simple 3-Tier Web Application Description Option 1 Option 2                  Option 3             Option 4    2 W...
Example: Simple 3-Tier Web ApplicationSavings                               Option 1         Option 2     Option 3     Opt...
Optimizing for Cost…  #1 Use only what you need (use Auto Scaling Service, modify–db)        #2 Invest time in Reserved Pr...
Optimize by using Spot Instances  On-demand                  Reserved                     Spot   Instances                ...
What are Spot Instances?             Sold at                                               Sold at               50%      ...
What is the tradeoff?            Unused                                             Unused                       Unused   ...
Spot Use casesUse Case               Types of ApplicationsBatch Processing       Generic background processing (scale out ...
Save more money by using Spot InstancesReserved Hourly Price > Spot Price < On-Demand Price
Spot: Example Customers                57%                           50%63%               50%                          56%...
Typical Spot Bidding Strategies                                        Bid Distribution (for last 3 months)               ...
1. Bid Near the Reserved Hourly Price$$$$$$$$$$$$$$$$$$ $$$        $   $       $   $                                      ...
2. Bid above the Spot Price History                                      50% Savings over                                 ...
3. Bid near the On-Demand Price                                  50% Savings over                                  On-Demand
4. Bid above the On-Demand Price                                   57% Savings over                                   On-D...
Managing Interruption
Amazon EMR (Hadoop): Run Task Nodes on Spot                                                            Amazon S3          ...
Amazon EMR: Reducing Cost with SpotScenario #1                    #1: Cost without Spot   Job Flow         4 instances *14...
Made for each other: MapReduce + Spot                           Use Case: Web crawling/Search                           us...
Video Transcoding Application Example                     Amazon S3                                               Amazon S...
Use of Amazon SQS in Spot ArchitecturesVisibilityTimeOut                     Amazon EC2                    Spot Instance
Optimizing Video Transcoding Workloads   Free Offering                          Premium Offering    • Optimize for reducin...
Persistent Requests
Architecting for Spot Instances : Best PracticesManage interruption• Split up your work into small increments• Checkpointi...
Optimizing for Cost…  #1 Use only what you need (use Auto Scaling Service, modify–db)        #2 Invest time in Reserved Pr...
Optimize by converting ancillary instances into                                       services                       Monit...
Elastic Load BalancingSoftware LB on EC2                   Elastic Load BalancingPros                                 Pros...
$0.025 per hour                   DNS   Elastic Load                                                      Web Servers     ...
Application ServicesSoftware on EC2                  SNS, SQS, SES, SWFPros                             Pros   Custom feat...
Consumers                          Producer     SQS queue$0.01 per10,000 Requests($0.000001 per Request)  $0.08     per ho...
Optimizing for Cost…  #1 Use only what you need (use Auto Scaling Service, modify–db)        #2 Invest time in Reserved Pr...
caching             Optimize for performance and costby page caching and edge-caching static content
When am I charged?                                                    Paris                                               ...
When content is popular…                                                    Paris                                         ...
Architectural RecommendationsUse Amazon S3 + CloudFront as it will reduce the cost as wellas reduce latency for static dat...
Number of ways to further save with AWS…  #1 Use only what you need (use Auto Scaling Service, modify–db)        #2 Invest...
Thank you!jvaria@amazon.com  Twitter: @jinman
http://aws.amazon.com
Web Application Usage Patterns       Steady State             Spiky Predictable    Uncertain unpredictable       Usage Pat...
www.MyWebSite.com                                  (dynamic data)     Example: TCO of a                          Amazon Ro...
Upcoming SlideShare
Loading in...5
×

Optimizing for Cost in the AWS Cloud - 5 Ways to Further Save - AWS Summit 2012 - NYC - Jinesh Varia

5,377

Published on

AWS Technology Evangelist Jinesh Varia discusses how you can optimize your costs in the cloud and further reduce you cost and save. He discusses a number of data points of how customers are saving money with AWS

Published in: Technology, Business
2 Comments
13 Likes
Statistics
Notes
No Downloads
Views
Total Views
5,377
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
2
Likes
13
Embeds 0
No embeds

No notes for slide
  • Cloud is highly cost-effective because you can turn off and stop paying for it when you don’t need it or your users are not accessing. Build websites that sleep at night
  • Only happens in the cloud
  • Cloud is highly cost-effective because you can turn off and stop paying for it when you don’t need it or your users are not accessing. Build websites that sleep at night
  • Our strategy of pricing each service independently gives you tremendous flexibility to choose the services you need for each project and to pay only for what you use
  • Build websites that sleep at night. Build machines only live when you need it
  • Shrink your server fleet from 6 to 2 at night and bring back
  • Perhaps you expect a lot of traffic as part of a planned announcement and you want to increase the size of your EC2 fleet just ahead of your press release. Maybe your site is busy once a day because you have a daily deal or a daily special, or only on weekends when people are at sporting events. Or maybe you run a college registration site and you want to scale up during day and evening hours for the four-day registration period.
  • Perhaps you expect a lot of traffic as part of a planned announcement and you want to increase the size of your EC2 fleet just ahead of your press release. Maybe your site is busy once a day because you have a daily deal or a daily special, or only on weekends when people are at sporting events. Or maybe you run a college registration site and you want to scale up during day and evening hours for the four-day registration period.
  • 80% of your desired threshold20
  • Perhaps you expect a lot of traffic as part of a planned announcement and you want to increase the size of your EC2 fleet just ahead of your press release. Maybe your site is busy once a day because you have a daily deal or a daily special, or only on weekends when people are at sporting events. Or maybe you run a college registration site and you want to scale up during day and evening hours for the four-day registration period.
  • For example, if the application always scales 2 larges in each AZ, there is pretty much no difference between this approach and 1 extra large in each AZ.  However it would be safer for the customer to scale 1 large in 2 AZs rather than 1 extra large in 1 AZ (and cheaper than 2 extra larges).
  • Personal Optimization Assistant
  • 1 or 3 years is our commitment to the customer not theirs to us.  Therefore, if a customer plans on running for at least 8 months the only sensible purchase is the 3 year.
  • Engineered application towards a costSet low maximum bid price to minimize costsWere comfortable if process ran longer or jobs were re-runDid not pay for hour if they are interrupted
  • Show graph – and add in the picsPrice Set 10% above Average Price Last HourMaximum price threshold of 80% of On-Demand PriceOne time spot requests; one instance per request; across all availability zonesNot more than 10 open Spot requests at any timeSpot requests expire in 10 minuteLaunch Spot instances first and then on-demand instances if you don’t get the spot instances in under 15 minutes
  • Bid around the On-Demand priceUse On-Demand instance when Spot Price exceeds On-Demand price (or slightly higher)May pay more some hours, but on average they pay significantly lessThis bidding strategy ensures a discount over On-Demand
  • Bid around the On-Demand priceUse On-Demand instance when Spot Price exceeds On-Demand price (or slightly higher)May pay more some hours, but on average they pay significantly lessThis bidding strategy ensures a discount over On-Demand
  • For Non-hadoop Grid computing (scientific modeling) Use Spot and On-demand in Hybrid Fashion. Master Node in Cluster is on-demand instance, worker nodes are spot instances
  • Batch Processing architecture using Amazon EC2, S3, SQS, SimpleDB
  • Vimeo is about to come out with a case study. We are pushing for by the Summit, but if not you can remove the name and just use it as an example. They have 2 offerings: free and premium. The free case they want to minimize cost. They have the ability to have some delay in the service while they transcode the data. So, they set a maximum of $x on the amount they would pay for an hour, and use Spot for the task. If they haven’t gotten capacity in a long time, they choose to start in On-Demand. The premium case they want the media encoding to happen immediately. So, they purchase Reserved Instances to optimize their expected level of demand (note breakeven is around 30% utilization, so buying more RIs may make sense). Then, they use On-Demand for elasticity. If they can’t get the On-Demand when they need it, they try in Spot (e.g. you can get capacity not available anywhere else). In all, they have optimized for their SLA for the premium offering, and minimized cost in their free offering. Both are legitimate scenarios, and AWS is the only provider to support the pricing models to allow them to do it.
  • Save Your Work Frequently: Because Spot Instances can be terminated with no warning, it is importantto build your applications in a way that allows you to make progress even if your application isinterrupted. There are many ways to accomplish this, two of which are adding checkpoints to yourapplication or splitting your work into small increments.Add Checkpoints: Depending on fluctuations in the Spot Price caused by changes in the supply ordemand for Spot capacity, Spot Instance requests may not be fulfilled immediately and may beterminated without warning. In order to protect your work from potential interruptions, werecommend inserting regular checkpoints to save your work periodically. One way to do this is by savingall of your data to an Amazon EBS volume. Another approach is to run your instances using Amazon EBS-backed AMIs. By setting theDeleteOnTermination flag to false as part of your launch request, the Amazon EBS volume used as theinstance’s root partition will persist after instance termination, and you can recover all of the data savedto that volume. You can read more details on the use of Amazon EBS-backed AMIs here.Note: When using this technique with a persistent request, bear in mind that a new EBS volumewill be created for each new Spot Instance.Split up Your Work: Another best practice is to split your workload into small increments if possible.Using Amazon SQS, you can queue up work increments and keep track of what work has already beendone (as in the example from the previous section). When using this approach, ensure that processing aunit of work is idempotent (can be safely processed multiple times) to ensure that resuming aninterrupted task doesn’t cause problems. You can do this by enqueuing a message to your Amazon SQS queue for each increment of work. Youcan then build an AMI that, when run, discovers the queue from which to pull its work. Discovery can bedone by building it into the AMI, passing in user data or by storing the configuration remotely (forexample in Amazon SimpleDB or Amazon S3), which will tell the AMI in which queue to look.More details on using Amazon SQS with Amazon EC2 and a detailed walkthrough on how to set up thistype of architecture can be found here.Test Your Application: When using Spot Instances, it is important to make sure that your application isfault tolerant and will correctly handle interruptions. While we attempt to cleanly terminate yourinstances, your application should be prepared to deal with sudden shutdowns. You can test yourapplication by running an On-Demand Instance and then terminating it. This can help you to determinewhether your application is sufficiently fault tolerant and is able to handle unexpected interruptions.18Minimize Group Instance Launches: There are two options for launching instances together in a cluster.The Launch Group is a request option that ensures your instances will be launched and terminatedsimultaneously. The Availability Zone Group is a second request option that ensures your instances willbe launched together in one Availability Zone. Although they may be necessary for some applications,avoiding these restrictions whenever possible will increase the chances of your request being fulfilled.When Launch Groups are required, try to minimize the group size because larger groups have a lowerchance of being fulfilled. Additionally whenever possible, try to avoid specifying a specific AvailabilityZone in order to increase your chances of successfully launching.Use Persistent Requests for Continuous Tasks: Spot Instance Requests can be one-time or persistent. Aone-time request will only be satisfied once; a persistent request will remain in consideration after eachinstance termination. This means that after your request has been satisfied and your instance has beenterminated—by you or by Amazon EC2—your request will be submitted again automatically with thesame parameters as your initial request. A persistent request will continue submitting the request untilyou cancel it. These requests can be helpful if you have continuous work that can be stopped andresumed, such as data processing or video rendering. We recommend that you revisit these requestsfrom time to time to examine whether or not you want to change your maximum price or the AMI.Changing parameters will require that you cancel your existing request and resubmit a new request.Note: Terminating your instance is not the same as cancelling a persistent request. If youterminate your instance without cancelling your persistent request, Amazon EC2 willautomatically launch a replacement Spot Instance given that your maximum price is above thecurrent Spot Price.Track when Spot Instances Start and Stop: The simplest way to know the current status of your SpotInstances is to either poll the DescribeSpotInstanceRequests API or view the status of your instance usingthe AWS Management Console. By polling the DescribeSpotInstanceRequests at whatever frequency youdesire (e.g. every ten minutes), you can look for state changes to your requests. This will tell you when arequest is successful, because it will change from “open” to “active” and it will have an associatedinstance ID. You can use this same approach to detect terminations by checking to see if the “instanceid” field disappears.You can also use Amazon SQS to create your own notifications. One way of doing this is to create an AMIthat has a start-up script that enqueues a message on an Amazon SQS queue. You can take the sameapproach to detect when a Spot Instance begins the process of shutting down.For instructions on how to build your own AMI, please see the Amazon EC2 User Guide located here.Access Large Pools of Compute Capacity: Spot Instances can be used to help you meet occasional needsfor large amounts of compute capacity (note that the default limit for Spot Instances is 100 versus thedefault limit of 20 for On-Demand Instances.) If your needs are urgent, you can specify a high maximumprice (possibly even higher than the On-Demand price), which will raise your request’s relative priorityand allow you to gain access to as much immediate capacity as possible given other requests and the19Spot Instance capacity available at the time. While Spot Instances are generally not suitable for steadystatetasks such as serving web content, they can be used as a valuable source of instance capacity evenfor steady state applications when applications have urgent computing needs due to unanticipated orshort-term demand spikes.
  • Transcript of "Optimizing for Cost in the AWS Cloud - 5 Ways to Further Save - AWS Summit 2012 - NYC - Jinesh Varia"

    1. 1. Optimizing for Cost in the Cloud Jinesh Varia @jinman Technology Evangelist
    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 in your architecture results in recurring savings in 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. Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db)
    8. 8. Turn off what you don’t need (automatically)
    9. 9. 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 HourOptimize by the time of day
    10. 10. 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 S3 AmazonAvailability Zone #1 RDS Availability Zone #2
    11. 11. Web Servers 50% Savings 1 5 9 13 17 21 25 29 33 37 41 45 49 WeekOptimize during a year
    12. 12. Auto scaling : Types of ScalingScaling 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. 13. Auto scaling Best PracticesUse Auto Scaling TagsUse Auto scaling Alarms and Email NotificationsScale up and down symmetricallyScale up quickly and scaling down slowlyAuto Scaling across Availability ZonesLeverage Suspend and Resume Processes
    14. 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. 15. Instances Agg. CPU
    16. 16. RDS DB Servers 75% Savings 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 Days of the MonthOptimize during a month
    17. 17. End of the month processingExpand the cluster at the end of the month• Expand/Shrink feature in Amazon Elastic MapReduceVertically 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. 18. Tip: Use “Reminder scripts” Disassociate your unused EIPs Delete unassociated EBS volumes Delete older EBS snapshots Leverage S3 Object Expiration
    19. 19. Pick the Right Instance Type
    20. 20. Basic recommendations on Instance TypeChoose the EC2 instance type that best matches the resourcesrequired by the application• Start with memory requirements and architecture type (32bit or 64- bit)• Then choose the closest number of virtual cores requiredScaling across AZs• Smaller sizes give more granularity for deploying to multiple AZs
    21. 21. AWS Support – Trusted Advisor – Your personal cloud assistant
    22. 22. Tip – Instance Optimizer Free Memory Free CPU PUT 2 weeks Free HDD At 1-min intervals Alarm Amazon CloudWatchInstance Custom Metrics “You could save a bunch of money by switching to a small instance, Click on CloudFormation Script to Save”
    23. 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. 24. Your Best Option: Reserved + On-Demand
    25. 25. Save more when you reserve On-demand Reserved Instances Instances Heavy Utilization RI• Pay as you go • One time low upfront fee + 1-year and 3- Medium Pay as you go year terms Utilization RI• Starts from • $23 for 1 year term and Light $0.02/Hour Utilization RI $0.01/Hour
    26. 26. $14,000 m2.xlarge running Linux in US-East Region $12,000 over 3 Year period Break-even $10,000 point $8,000 Cost Heavy Utilization $6,000 Medium Utilization $4,000 Light Utilization On-Demand $2,000 $- UtilizationUtilization Sweet Spot Feature Savings over On-Demand<10% On-Demand No Upfront Commitment10% - 40% Light Utilization RI Ideal for Disaster Recovery Up to 56% (3-Year)40% - 75% Medium Utilization RI Standard Reserved Capacity Up to 66% (3-Year)>75% Heavy Utilization RI Lowest Total Cost Up to 71% (3-Year) Ideal for Baseline Servers
    27. 27. RecommendationsSteady 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-DemandUncertain 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. 28. Example: Simple 3-Tier Web Application Description Option 1 Option 2 Option 3 Option 4 2 Web servers 2 On-Demand 2 On-Demand 1 On-Demand and 1 On-Demand and 1 Reserved Medium 1 Reserved Light Utilization Utilization 2 App servers 2 On-Demand 2 On-Demand 1 On-Demand and 1 On-Demand and 1 Reserved Medium 1 Reserved Light Utilization Utilization2 Database servers 2 On-Demand 2 Reserved 2 Reserved Medium 2 Reserved Heavy Medium Utilization Utilization Utilization
    29. 29. Example: Simple 3-Tier Web ApplicationSavings Option 1 Option 2 Option 3 Option 4 Calculator Calculator Calculator CalculatorMonthly Cost $702.72 $374.78 $256.20 $238.63One-Time Cost 1 Year Term - $1280.00 $1600.00 $1698.00 3 Year Term - $2000.00 $2500.00 $2612..60Total Cost 1 Year Term (x12) $8432.64 $5777.36 $4674.40 $4561.56 3 Year Term (x36) $25297.92 $15492.08 $11723.20 $11203.28Savings 1 Year Term n/a 32% 44% 45%(Over Option 1) 3 Year Term n/a 39% 54% 54%
    30. 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. 31. Optimize by using Spot Instances On-demand Reserved Spot Instances Instances Instances• Pay as you go • One time low • Requested Bid upfront fee + Price and Pay Pay as you go as you go• Starts from • $23 for 1 year • $0.005/Hour $0.02/Hour term and as of today at $0.01/Hour 9 AM 1-year and 3- year terms Heavy Medium Light Utilization Utilization RI Utilization RI RI
    32. 32. What are Spot Instances? Sold at Sold at 50% Unused 54% Unused Discount! Discount! Sold at Sold at 56% Unused 59% Unused Discount! Discount! Sold at Sold at 66% Unused 63% UnusedDiscount! Discount! Availability Zone Availability Zone Region
    33. 33. What is the tradeoff? Unused Unused Unused Reclaimed Unused UnusedReclaimed Unused Availability Zone Availability Zone Region
    34. 34. Spot Use casesUse Case Types of ApplicationsBatch 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 biologyVideo and Image Transform videos into specific formatsProcessing/RenderingTesting Provide testing of software, web sites, etcWeb/Data Crawling Analyzing data and processing itFinancial Hedgefund analytics, energy trading, etcHPC Utilize HPC servers to do embarrassingly parallel jobsCheap Compute Backend servers for Facebook games
    35. 35. Save more money by using Spot InstancesReserved Hourly Price > Spot Price < On-Demand Price
    36. 36. Spot: Example Customers 57% 50%63% 50% 56%50% 66% 50%
    37. 37. Typical Spot Bidding Strategies Bid Distribution (for last 3 months) 20% 1. Bid near the 18% Reserved Hourly PricePercentage of the Distribution 16% 14% 2. Bid above the 12% Spot Price 10% History 8% 6% 3. Bid near On- 4% Demand Price 2% 4. Bid above the 0% On-Demand Price Bid Price as Percentage of the On-Demand Price
    38. 38. 1. Bid Near the Reserved Hourly Price$$$$$$$$$$$$$$$$$$ $$$ $ $ $ $ 66% Savings over On-Demand
    39. 39. 2. Bid above the Spot Price History 50% Savings over On-Demand
    40. 40. 3. Bid near the On-Demand Price 50% Savings over On-Demand
    41. 41. 4. Bid above the On-Demand Price 57% Savings over On-Demand
    42. 42. Managing Interruption
    43. 43. Amazon EMR (Hadoop): Run Task Nodes on Spot Amazon S3 Upload large datasets or log Amazon S3 Data files directly Input Source Data Outpu tData Task Amazon Elastic Node MapReduce Amazon SimpleDB Mapper Code/ Reducer Name Task Service Metadata Scripts HiveQL Node Node Pig Latin Cascading Runs multiple JobFlow Steps Core HiveQL Node Pig Latin Query Core Node HDFS BI Apps Amazon Elastic MapReduce JDBC/ODB C Hadoop Cluster
    44. 44. Amazon EMR: Reducing Cost with SpotScenario #1 #1: Cost without Spot Job Flow 4 instances *14 hrs * $0.45 = $25.20 Duration: 14 Hours #2: Cost with Spot 4 instances *7 hrs * $0.45 = $12.60 + 5 instances * 7 hrs * $0.225 = $7.875Scenario #2 Total = $20.475 Job Flow Time Savings: 50% Duration: Cost Savings: ~19% 7 Hours
    45. 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. 46. 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
    47. 47. Use of Amazon SQS in Spot ArchitecturesVisibilityTimeOut Amazon EC2 Spot Instance
    48. 48. Optimizing Video Transcoding Workloads Free Offering Premium Offering • Optimize for reducing cost  Optimized for Faster response times • Acceptable Delay Limits  No DelaysImplementation Implementation • Set Persistent Requests  Invest in RIs • Use on-demand Instances, if  Use on-demand for Elasticity delay Maximum Bid Price Maximum Bid Price < On-demand Rate >= On-demand Rate Get your set reduced price for Get Instant Capacity for higher price your workload
    49. 49. Persistent Requests
    50. 50. Architecting for Spot Instances : Best PracticesManage interruption• Split up your work into small increments• Checkpointing: Save your work frequently and periodicallyTest Your ApplicationTrack when Spot Instances Start and StopSpot Requests• Use Persistent Requests for continuous tasks• Choose maximum price for your requests
    51. 51. 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)#4 Leverage Application Services (ELB, SNS, SQS, SWF, SES)
    52. 52. Optimize by converting ancillary instances into services Monitoring: CloudWatch Notifications: SNS Queuing: SQS SendMail: SES Load Balancing: ELB Workflow: SWF Search: CloudSearch
    53. 53. Elastic Load BalancingSoftware LB on EC2 Elastic Load BalancingPros Pros Application-tier load Elastic and Fault-tolerant balancer Auto scaling Monitoring includedCons SPOF Cons Elasticity has to be For Internet-facing traffic implemented manually only Not as cost-effective
    54. 54. $0.025 per hour DNS Elastic Load Web Servers Balancer Availability Zone$0.08 per hour(small instance) EC2 instance DNS + software LB Web Servers Availability Zone
    55. 55. Application ServicesSoftware on EC2 SNS, SQS, SES, SWFPros Pros Custom features Pay as you go ScalabilityCons Availability Requires an instance High performance SPOF Limited to one AZ DIY administration
    56. 56. Consumers Producer SQS queue$0.01 per10,000 Requests($0.000001 per Request) $0.08 per hour (small instance) Producer EC2 instance Consumers + software queue
    57. 57. 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)#4 Leverage Application Services (ELB, SNS, SQS, SWF, SES) #5 Implement Caching (ElastiCache, CloudFront)
    58. 58. caching Optimize for performance and costby page caching and edge-caching static content
    59. 59. When am I charged? Paris Client Edge Location Amazon Simple Storage Service (S3) Client Singapore Amazon Elastic Compute Cloud (EC2) Edge Location London Edge Location Client
    60. 60. When content is popular… Paris Client Edge Location Amazon Simple Storage Service (S3) Client Singapore Amazon Elastic Compute Cloud (EC2) Edge Location London Edge Location Client
    61. 61. Architectural RecommendationsUse Amazon S3 + CloudFront as it will reduce the cost as wellas reduce latency for static data• Depends on cache-hit ratioFor Video Streaming, use CloudFront as there is no need of aseparate streaming server running Adobe FMSUse managed caching service (Amazon ElastiCache)
    62. 62. Number of ways to further save with AWS… #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)#4 Leverage Application Services (ELB SNS, SQS, SWF, SES) #5 Implement Caching (ElastiCache, CloudFront)
    63. 63. Thank you!jvaria@amazon.com Twitter: @jinman
    64. 64. http://aws.amazon.com
    65. 65. Web Application Usage Patterns Steady State Spiky Predictable Uncertain unpredictable Usage Pattern Usage Pattern Usage Pattern(Example: Corporate Website) (Example: Marketing (Example: Social game or Promotions Website) Mobile Website)
    66. 66. www.MyWebSite.com (dynamic data) Example: TCO of a Amazon Route 53 media.MyWebSite.com (DNS)3-tier Web Application Elastic Load (static data) Balancer Amazon Auto Scaling group : Web Tier CloudFront Amazon EC2 Auto Scaling group : App Tier Amazon RDS Amazon Amazon S3 Availability Zone #1 RDS Availability Zone #2

    ×