Optimizing for Costs in the Cloud
Upcoming SlideShare
Loading in...5
×
 

Optimizing for Costs in the Cloud

on

  • 1,078 views

 

Statistics

Views

Total Views
1,078
Views on SlideShare
807
Embed Views
271

Actions

Likes
1
Downloads
27
Comments
0

2 Embeds 271

http://www.ipsense.com.br 263
http://kandgi.com 8

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Optimizing for Costs in the Cloud Optimizing for Costs in the Cloud Presentation Transcript

    • 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
    • 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 benefits
    • 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 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
    • 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
    • Web Servers 50% Savings 1 5 9 13 17 21 25 29 33 37 41 45 49 WeekOptimize during a year
    • 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
    • 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
    • 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.
    • Instances Agg. CPU
    • 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
    • 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)
    • Tip: Use “Reminder scripts” Disassociate your unused EIPs Delete unassociated EBS volumes Delete older EBS snapshots Leverage S3 Object Expiration
    • AWS Support – Trusted Advisor – Your personal cloud assistant
    • 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” $$$ inSavings
    • Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db) #2 Invest time in Reserved Pricing analysis (EC2, RDS)
    • 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
    • The Total Cost Of (Non) Ownership in the Cloud Whitepaper (New!) Whitepaper: http://bit.ly/aws-tco-webapps
    • 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)
    • 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
    • $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 Light Utilization $4.000 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
    • Spiky Predictable Usage Pattern 12Traffic measured in Servers/Instances 10 8 6 Traffic Pattern EC2 Reserved 4 EC2 On-Demand Physical servers (on-premises) 2 0 0 5 10 15 20 25 30 35 Months
    • TCO of Spiky Predictable Web Application TCO Web Application - Spiky Usage Pattern On-Premises AWS Option 1 AWS Option 2 AWS Option 3 Amortized monthly costs All Reserved Mix of On-Demand All On-Demand Option over 3 years and ReservedOption 1: All Reserved Compute/Server Costs Server Hardware $510 $0 $0 $0 Network Hardware $103 $0 $0 $0Option 2: Mix of On-Demand and Reserved Hardware MaintenanceRecommended Option (Most Cost- $78 $0 $0 $0effective)Power and Cooling $286 $0 $0 $0 Data Center Space $240 $0 $0 $0 Personnel $2,000 $0 $0 $0Option 3: AWS Instances All On-Demand $0 $992 $881 $1,940Commitment-free and Risk-free Option Total - Per Month $3,220 $992 $881 $1,940 Total - 3 Years $115,920 $35,717 $31,731 $69,854 Savings over On-premises 69% 72% 40% Option
    • 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
    • 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)
    • 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
    • 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
    • What is the tradeoff? Unused Unused Unused Reclaimed Unused UnusedReclaimed Unused Availability Zone Availability Zone Region
    • 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
    • Save more money by using Spot InstancesReserved Hourly Price > Spot Price < On-Demand Price
    • Spot: Example Customers 57% 50%63% 50% 56%50% 66% 50%
    • 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% 3. Bid near On- 6% Demand Price 4% 2% 4. Bid above the 0% On-Demand Price Bid Price as Percentage of the On-Demand Price
    • 1. Bid Near the Reserved Hourly Price$$$$$$$$$$$$$$$$$$ $$$ $ $ $ $ 66% Savings over On-Demand
    • 2. Bid above the Spot Price History 50% Savings over On-Demand
    • 3. Bid near the On-Demand Price 50% Savings over On-Demand
    • 4. Bid above the On-Demand Price 57% Savings over On-Demand
    • Managing Interruption
    • 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 DynamoDB 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
    • 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
    • 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
    • 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 DynamoDB CloudWatch Amazon DynamoDB Amazon EC2 Intranet
    • Use of Amazon SQS in Spot ArchitecturesVisibilityTimeOut Amazon EC2 Spot Instance
    • 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
    • Persistent Requests
    • 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
    • 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)
    • Optimize by converting ancillary instances into services Monitoring: CloudWatch Notifications: SNS Queuing: SQS SendMail: SES Load Balancing: ELB Workflow: SWF Search: CloudSearch
    • 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
    • $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
    • 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
    • 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
    • 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)
    • caching Optimize for performance and costby page caching and edge-caching static content
    • 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
    • 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
    • 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)
    • 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)
    • Thank you!jvaria@amazon.com Twitter: @jinman
    • http://aws.amazon.com