AWS Sydney Summit 2013 - Optimizing AWS Applications and Usage to Reduce Costs


Published on

Session 1, Presentation 5 from the AWS Sydney Summit

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • How is this possible? In simple terms, Use only what you need (and pay only for what you use)We provide the tools to define how you measure and respond (or preempt) demand in real-time.Common Customer Questions: How do you …1) know the demand pattern2) know the exchange rate of demand and capacity3) automate how you follow demand with capacityYou still have to figure out how to track demand and design to scale when it grows, but at least with the cloud you can focus on the short-term without having to make an uncertain investment in the future.Later in this presentation we’ll talk to you about Auto Scaling tools to make it easier to respond to changing demand.
  • Explains the slides as a sequential process of decisions, and why they help.
  • In addition, Only Use What You Need to Use.
  • 1 trillion S3 objectsUnlimited capacityS3 costs as low as 5.5c per GB/month99.999999999% durability: if you store 10,000 objects with Amazon S3, you can on average expect to incur a loss of a single object once every 10,000,000 yearsGlacier$120 per TB/year3-5 hour data retrieval
  • As low as $0.037 per GB per month if you only need reduced redundancy – 99.99% durability vs. 99.999999999% durability
  • OD/RI: Can get guaranteed availabilitySpot:Unpredicatable availability, but costs are often much lower (80-90% savings off of OD) and quantity available can be much higher (1,000s) than you can get in On Demand
  • An RI isn’t a rigid hardware sunk costWhat about when you just don't need it anymore? Closing up shop, etc.It's not a great message but for startups especially it's a risk that is always top of mind. We might as well be honest about it.
  • You should use Consolidated Billing for any of the following scenarios:You have multiple accounts today and want to get a single bill and track each account's charges (e.g., you might have multiple projects, each with its own AWS account).You have multiple cost centers to track.You've acquired a project or company that has its own existing AWS account and you want to consolidate it on the same bill with your other AWS accounts.
  • mention the practical application of CW - you can find out when:1) you're using the wrong instance type; time to switch!2) you left some of your instances running unused; time to shut them down!
  • Review avg daily CPU utilization
  • Batch Processing: Generic batch processing (scale out computing)Hadoop: MapReduce processing (e.g., Search, Big Data)Scientific Computing: Scientific trials, simulations, analysisVideo/Image Processing: Encoding, transcoding, renderingTesting: Continuous testing, load testing websites, etc.Web/Data Crawling: Analyzing data and processing itFinancial: Hedge fund analytics, energy trading, etc.HPC/HTC: Embarrassingly parallel jobsCheap Compute: Backend servers for Facebook games, MineCraft
  • 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
  • Pay Only for What You Use: Right-size your cloud resourcesYour job manager may not need a lot of memory, but maybe your worker nodes doChoose the right data store: for frequently accessed data, S3 is the obvious choice, but maybe you auto migrate old records to GlacierMonitor and Manage key performance metrics of your system (job queue length, worker node utilization) with CloudWatchy, use billing alerts so you’re not caught by surprise, and use Trusted Advisor if you’re an enterprise customerScale OpportunisticallyAuto Scale your worker nodes based on demand (e.g., size of input queue)
  • AWS Sydney Summit 2013 - Optimizing AWS Applications and Usage to Reduce Costs

    1. 1. Adrian WhiteOptimizing Your AW2 Applications and Usage to Reduce CostsSolutions Architect, AWSDavid HarrisonVP of Engineering, Freelancer.comGuest presenter:
    2. 2. Agenda• Objective– Review the spectrum of ways to save money on your AWS application• Tenet: Fit the cloud to your product and business model– Use Only What You Need (and pay only for what you use!)– Measure and Manage– Scale Opportunistically• Customer Case Study–
    3. 3. Use Only What You NeedAnd pay only for what you use!
    4. 4. Scale on demandRigid On-Premise ResourcesWasteCustomerDissatisfactionActual demandPredicted DemandCapacityTimeElastic Cloud ResourcesActual demandResources scaled to demandCapacityTimeVS
    5. 5. Use only what you need: AWS cost savings opportunities• Right-size your cloud resources– Use resources that suit your needs (instance types, storage options, etc.)– Improve performance: reduce churn, underutilization, bottlenecks– Lower costs: maximize your output per dollar, don’t pay for performance you don’trequire• Fit your payment model to your business model– Do you value flexibility or predictability?– Use a portfolio of payment models• Measure and manage your application and cloud resources– Monitor your applications to identify new savings opportunities
    6. 6. Right-size your cloud resources: broad EC2 selection• An instance type forevery purpose• Assess your memory& CPU requirements– Fit your applicationto the resource– Fit the resource toyour application• Only use a largerinstance whenneeded
    7. 7. Optimize your storage choice too: S3 & Glacier• S3 and Glacier are both:– Secure– Flexible– Low-cost– Scalable: over 2 trillion customer objects– Durable: 99.999999999% (11 “9”s)AmazonGlacier
    8. 8. Choosing between S3 and Glacier• Simple Storage Service (S3)– Designed to serve static content at high volumes, low latency, frequent access– Low cost: as low as 5.5¢ per GB-month (or 3.7¢ for reduced redundancy)• Glacier– Designed for long-term cold storage: infrequent access, long retrieval times (3-5hrs)– Extremely low-cost: 1¢ per GB-month• Tips:– Optimize access: Reduce payload size, # of accesses (e.g., consolidated logs)– Monitor for unexpected access/growth patterns: e.g., misconfigured log archiving– Set Lifecycle Policies: object expiration dates; auto-move S3 files to GlacierIllumina, the leading provider of DNA sequencinginstruments, uses Glacier to store large blocks ofgenomic data all over the world
    9. 9. Fit your payment model to your business model: EC2 pricing plansOn-DemandInstancesReservedInstancesSpotInstancesPay as you go for computingpowerFlat hourly rate, no up-frontcommitmentsPay an up-front fee for acapacity reservation and a lowerhourly rate (up to 72% savings)1- or 3-year termsRI Marketplace: sell RIs you nolonger need; buy RIs at adiscountPay what you want for spare EC2capacity: your instances run ifyour bid exceeds the Spot pricePotential for large scale at lowcost: When they’re available,take advantage of 1,000s of SpotInstances at up to 90% savings10:0010:0510:1010:15
    10. 10. Use a spectrum of payment modelsFor example:Frontend Applicationson On-Demand/Reserved Instances+Backend Applications*on Spot Instances* e.g., batch video transcoding
    11. 11. Reserved Instance Marketplace: Buy and Sell Your RIs• Benefits for Buyers:– Same underlying EC2 hardware– Buy RIs at a discount from AWS price– Increased selection of term lengths &prices• Benefits for Sellers:– Moving to a new AWS region– Changing your instance type– Switching operating systems– Selling capacity when project ends
    12. 12. Measure and Manage“If you cannot measure it, you cannot improve it.”- Lord Kelvin
    13. 13. Overview of AWS Monitoring and Management Services• AWS provides detailed cloud monitoring and management– Consolidated Billing (see “Account Activity” navigation panel)– CloudWatch (see AWS Management Console)– Billing Alerts (see “Account Activity” navigation panel)– Trusted Advisor (see “Support Center”)– Other APIs: tags, programmatic access, etc.• 3rd party services are also available
    14. 14. Consolidated Billing: Single payer for a group of accounts• One Bill for multiple accounts• Easy Tracking of account charges(e.g., download CSV of cost data)• Group Activities by PayingAccount (e.g., Dev, Stage, Test,Prod)• Volume Discounts can be reachedfaster with combined usage• Reserved Instances are sharedacross accounts (including RDSReserved DBs)• AWS Credits are combined tominimize your bill
    15. 15. Consolidated Billing Demo (1/3)• Get an overall summary totalfor all your users andaccounts:
    16. 16. Consolidated Billing Demo (2/3)• From your payment accountlogin, view details of eachlinked account in one place
    17. 17. Consolidated Billing Demo (3/3)• Drill down into detail’s of eachaccount• Download a CSV file for lineitem details, then analyze viaspreadsheet, pivot tables, etc.
    18. 18. Amazon CloudWatch• Overview– Monitoring for AWS cloud resources and applications• AWS Resources: EC2, RDS, EBS, ELB, SQS, SNS, DynamoDB, EMR, Auto Scaling…• Custom metrics from your application (use Put API call)– Gain insight, set alarms and notifications, react immediately– Start using within minutes, auto-scale with your application• Sophisticated Automation– Use CloudWatch metrics with Auto Scaling to dynamically scale EC2 instances
    19. 19. Use CloudWatch to monitor & manage resource usage• Monitor your resource utilization– Are you using the right instance type?– Have you left instances idle?– Is your instance usage level or bursty?• Manage your resource utilization– Move bursty workloads to other instances– Rebalance your worker nodes– Scale nodes automatically with Auto Scaling
    20. 20. Use CloudWatch to create Billing Alerts• Billing Alerts notify you when estimated charges reach a given threshold• Use Billing Alerts to track an individual developer, or your whole business• Easily setup your billing alarm and actions
    21. 21. Trusted Advisor: Enterprise Strength Monitoring/Optimization• Monitors and recommendsoptimizations for:– Cost– Security– Fault Tolerance– Performance• Available to customers withBusiness and Enterprise-level support
    22. 22. Trusted Advisor: Cost Optimization Tips
    23. 23. Trusted Advisor: Performance Tips
    24. 24. 3rd party services to optimize your AWS usage
    25. 25. Scale OpportunisticallyOpportunity favors the prepared application
    26. 26. Time-to-Result Case 1: Value of result quickly diminishesExample:EngineeringsimulationDelay  Loss ofproductivity,project slips
    27. 27. Time-to-Result Case 2: Result is valuable…until it’s notExample:Weekendregression testsDelay  Minimalimpact until8:00AM Monday
    28. 28. Consider Spot Instances for greater savings and scale• Spot in a nutshell– Spot instances run when Your Bid ≥ Spot Price– Spot instances = Spare EC2 instances– Spot instances might be interrupted at any time• Benefits– Savings: Up to 90% off On Demand– Scale: Access up to 1,000s of EC2 instances• To use Spot– Decide on a bid price– Launch via Console, API, Auto Scaling– Monitor Bid Statuses via Console/API
    29. 29. What applications work on Spot?• Good Spot applications are:– Delayable: to balance SLA/cost– Scalable: “embarrassingly parallel”– Fault-tolerant: can be terminated without losing all work– Portable across regions, AZs, instance types• Examples:– MapReduce (Hadoop, Amazon EMR)– Scientific Computing (Monte Carlo simulations)– Batch Processing (video transcoding)– Financial Computing (high-frequency trading algorithm backtesting)– and many others…Lucky Oyster crawled 3.4B Web Pages,building a 400M entry index in around14 hours for $100 (>85% savings)!
    30. 30. • Auto Scaling auto-sizes your cluster based on preset triggers and schedules• Integrates with CloudWatch metrics• Use Auto Scaling to– Improve customer experience, application performance– Maximize CPU/IO/Memory utilization– Optimize other metricsUse Auto Scaling to dynamically scale your appScale with Real-Time Demand
    31. 31. Auto-Scaling Example: Netflix
    32. 32. Follow the Money vs. Follow the Customer• Optimize utilization– Auto Scale on utilization metrics: CPU, memory, requests, connections, …• Optimize price paid– Scale with Spot instances when Spot prices are low– e.g., Run batch processes off-peak (nights, weekends) when Spot prices are lower
    33. 33. Follow the Money vs. Follow the Customer• Optimize customer experience with Auto Scaling• Example 1: Scale resources to meet customer demand– Video service Auto Scales instances to respond to customer web service requests• Example 2: Scale resources to ensure fresh results– A scientific paper search engine Auto Scales on queue depth (# of new docs to crawl)– 10 instances steady state and up to 5,000+ to ensure minimum throughput time• Example 3: Scale resources preemptively before large demand– A TV show marketing site scales up before the show and back down after
    34. 34. Cost-Saving Examples• Achieve potentiallylarge savings byprofiling yourapplication andpaying only forwhat you need:Base Case Savings ExamplesYou run 10 m3.2xlarge’sOn-Demand 24x7:10 instancesX $1.00/inst-hoursX 24 hours/dayX ~30.5 days/month= $7,320/monthIf you need to run 100% of the time, indefinitely:10x 3-yr Heavy RIs @ 100% Utilization= $2,731/month (63% savings)If you can layer RIs and On Demand to meet demand:4x 3-yr Heavy RIs @ 100% Utilization4x 3-yr Light RIs @ 15% Utilization2x On-Demand @ 5% Utilization= $1,843/month (75% savings)If you Auto Scale from 2 to 10 instances aroundprimetime TV (6-11pm, Mon-Fri):2x 3-yr Heavy RIs @ 100% Utilization8x 3-yr Light RIs @ 15% Utilization= $1,683/month (77% savings)If you can use 40x Spot Instances at 25% up-time:= $840/month (89% savings)
    35. 35. World domination withoutthe price tag, Freelancer.comDavid HarrisonVice President of @freelancer
    36. 36. Use Only What You Need• No premature scaling commitment on host capacity (start small and scale up)• Use on-demand instances early on, you can always shut them down!• Use `pay for what you eat` services – S3
    37. 37. Monitor EVERYTHING• Hosts• Releases• Logs
    38. 38. Performance / Cost efficiency• Speed doesn’t always == increased $We use S3 as a persistent object store!• Some data needs to be hot, some doesn’t• Make sure you’re optimizing for your high value patterns
    39. 39. Reserved Instances• Great way to optimize cost for committed resources youknow you need• On-demand vs. shorter 1 year reserves vs. 3 year reserves
    40. 40. Focus your engineering resources where it counts• Focus your resources on the things that are critical to your success, don’t worryabout the things you don’t have to• Avoid re-building common patterns (unless you really want to!)– RDS– S3– ELB• Your staff’s time is precious, use automated build / configuration tools to makethe most of it!
    41. 41. Automate Your Cleanup• Scripted cleaning of snapshots• Automated monitoring of long lived instances in staging environments• Age based expiry of some S3 objects (logs etc)• Monitoring !
    42. 42. Conclusion (Part I):Fit the cloud to your product and business model• Use Only What You Need (and pay only for what you use!)• Measure and Manage• Scale Opportunistically
    43. 43. An example putting it all together: saving on Batch Processing ScaleOpportunistically:Auto Scale workernodes based on sizeof input queue1. Pay Onlyfor What YouUse: Right-size yourcloudresources2. Monitor andManage your systemwith CloudWatch,Billing Alerts, TrustedAdvisor
    44. 44. Conclusion (Part II):Use the cloud to create new products & business modelsOn-Premises• Failure isexpensive• Experimentinfrequently• Less InnovationOptimized Cloud• Failure isinexpensive• Experiment earlyand often• More Innovation
    45. 45. THANK YOU