TH03 - Tips & Tricks onArchitecting W indows Azure for                          Costs                        Nuno Godinho ...
About MeNuno Filipe GodinhoCloud Solution Architect @ AditiWindows Azure MVPnunog@aditi.comhttp://msmvps.com/blogs/nunogod...
Agenda•   Compute•   Bandwidth, Storage & Transactions•   SQL Azure•   Customer Awareness•   Developer Awareness•   Scenar...
COMPUTE
Limiting virtual machine count•   Do you need full capacity 24/7?    – Probably not, reduce # cpu’s when not used•   Use W...
Limiting virtual machine countDon’t Forget•   Staging environment costs•   When not in use, undeploy the staging    enviro...
Workers need work!•   Out of the box, 1 worker role = 1 task•   Why not spin up processes or threads?•   Example: You want...
Do you need all of that?•   1 XL = 2 L = 4 M = 8 S (regarding costs)•   No need for this memory / disk space?    – Start s...
IMPORTANT•   Billing per reserved VM    – Reserved = deployed / running•   Billing in staging and production    – 2 instan...
Work per hour•   Billed per clock hour / CPU•   Keep instances running at least until x:55•   Don’t deploy at x:50, instea...
BAND WIDTH, STORAGE& TRANSACTIONS
Bandwidth?•   Simple metric    – Use more = pay more    – Use less = pay less
When am I using bandwidth?•   Data transfers in/out Windows Azure    – Compute    – Blobs    – AppFabric    – SQL Azure•  ...
Content Delivery Network•   Content distributed across 24 Node    servers across the world•   Storage costs = Storage cost...
Data Storage•   Data you store (non SQL)    – Tables    – Blobs    – Queues•   Per GB / month•   Average over full month  ...
Transactions•   1 transaction = 1 storage operation•   Billed per 10.000•   Example: Checking a queue every second    from...
Transactions•   Use Service Bus Queues and Notifications•   Serving 100 images from blob storage    – High traffic app  h...
Diagnostics monitor•   Writes data to storage account•   Does not clean up•   Write often = # transactions•   Write less =...
SQL AZURE
Database editionsDatabase Size                 Price Per Database Per Month0 to 100 MB                   Flat $4.995Greate...
Billing nuances•   Based on peak DB size / day•   Averaged over 1 month•   Actual database edition size used is billed•   ...
Tables & indexes cost money•   Be careful with them•   Only define indexes needed•   Indexing every column & not using it ...
CUSTOMERAWARENESS
Customer awareness•   Yes, you can have all you want•   Yes, you can have it your way              BUT...
Discuss OpEx!•   Cost-analyze the requirements•   Discuss implications & alternatives with    stakeholders    – Pay more f...
DEVELOPERAWARENESS
A code snippet...  if (Session["culture"].ToString() == "en-US") {     // .. set to English ...  }                      rs...
Analysing Real World ScenariosSCENARIOS
Static WebSiteSCENARIO 1
Scenario 1 – Static WebSite What to use? Options?   Blob Storage   Compute Option 1: Blob Storage   We pay for?     Storag...
Scenario 1 – Static WebSite – v1  Number of Concurrent Users: 10 / second  WebSite Storage Space: 0,5 GB  Average Number o...
Scenario 1 – Static WebSite – v2  Number of Concurrent Users: 1000 / second  WebSite Storage Space: 0,5 GB  Average Number...
Scenario 3 – Static WebSite – v3  Number of Concurrent Users: 2000 / second  WebSite Storage Space: 0,5 GB  Average Number...
Application Data StorageSCENARIO 2
Scenario 2 – Application DataStorage•   What to use? Options?    – SQL Azure    – Table Storage    – SQL Azure + Table Sto...
Scenario 2 – Application DataStorage – v1•   Option 1: SQL Azure    – We pay for?      Database Storage = $ 45.954      Ba...
Scenario 2 – Application DataStorage – v2•   Option 2: Table Storage    – We pay for?      Storage Space = 10 GB * 0,15 = ...
Scenario 2 – Application DataStorage – v3•   Option 3: SQL Azure + Table Storage    – We pay for?      SQL Azure          ...
What to remember?KEY TAKEAWAYS
Key Takeaways•   Cloud pricing isn’t more complex    – Just “different”•   Every component has own characteristics•   Requ...
Resources•   Starting point:    – http://www.windowsazure.com•   Steve Marx:    – http://blog.smarx.com•   Cloud Cover Sho...
THANK YOU                 Nuno Godinho    Cloud Solution Architect @ Aditi                       nunog@aditi.com          ...
Upcoming SlideShare
Loading in …5
×

Tips & Tricks On Architecting Windows Azure For Costs

5,735 views

Published on

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

  • Be the first to like this

Tips & Tricks On Architecting Windows Azure For Costs

  1. 1. TH03 - Tips & Tricks onArchitecting W indows Azure for Costs Nuno Godinho Cloud Solution Architect Level: Introdutory
  2. 2. About MeNuno Filipe GodinhoCloud Solution Architect @ AditiWindows Azure MVPnunog@aditi.comhttp://msmvps.com/blogs/nunogodinhoTwitter: @NunoGodinho
  3. 3. Agenda• Compute• Bandwidth, Storage & Transactions• SQL Azure• Customer Awareness• Developer Awareness• Scenarios• Key Takeaways
  4. 4. COMPUTE
  5. 5. Limiting virtual machine count• Do you need full capacity 24/7? – Probably not, reduce # cpu’s when not used• Use Windows Azure Diagnostics API & Windows Azure Management API to scale (semi) automatically – 24 hours x 10 small instances = $28.80/day vs. – 16 hours x 10 small instances + 8 hours x 4 extra-small instances = $20.48/day
  6. 6. Limiting virtual machine countDon’t Forget• Staging environment costs• When not in use, undeploy the staging environment – 24 hours x 5 small instances = $14.4/day
  7. 7. Workers need work!• Out of the box, 1 worker role = 1 task• Why not spin up processes or threads?• Example: You want 20 tasks running – Option1: 1 task per worker = 20 workers = ~ 42 EUR/day – Option2: 2 tasks per worker = 10 workers = ~ 21 EUR/day – Option3: 10 tasks per worker = 2 workers = ~ 4,2 EUR/day – Which means ~ 42 EUR / day vs. ~ 4,2 EUR / day = 90% savings• “Generic workers”: http://research.microsoft.com/en- us/downloads/76537edf-9b77-4664-b76b-cf51be506a0d/• DON’T FORGET: 2 instances minimum for the SLA
  8. 8. Do you need all of that?• 1 XL = 2 L = 4 M = 8 S (regarding costs)• No need for this memory / disk space? – Start small – Scale up/down more granularly
  9. 9. IMPORTANT• Billing per reserved VM – Reserved = deployed / running• Billing in staging and production – 2 instances staging + 2 instances production = 4 instances billed• Undeploy your VM if not needed – Undeploy staging every evening – Automate this
  10. 10. Work per hour• Billed per clock hour / CPU• Keep instances running at least until x:55• Don’t deploy at x:50, instead deploy at x:55 – Deploy at x:50 and undeploy at x+1:10 – 2 hours billed!• Don’t deploy every minute – = 60 instance hours per hour! – Don’t do continuous deployment for every build, but accumulate
  11. 11. BAND WIDTH, STORAGE& TRANSACTIONS
  12. 12. Bandwidth?• Simple metric – Use more = pay more – Use less = pay less
  13. 13. When am I using bandwidth?• Data transfers in/out Windows Azure – Compute – Blobs – AppFabric – SQL Azure• Data transfers between Windows Azure regions – E.g. North America – Europe – IMPORTANT: Keep compute & storage in the same region!
  14. 14. Content Delivery Network• Content distributed across 24 Node servers across the world• Storage costs = Storage costs for public containers x 2• Bandwidth costs = # data in public containers x # servers – Can be limited by setting cache headers
  15. 15. Data Storage• Data you store (non SQL) – Tables – Blobs – Queues• Per GB / month• Average over full month – 10 GB stored for 15 days, 0 GB stored for 15 days = 5 GB stored for 1 month
  16. 16. Transactions• 1 transaction = 1 storage operation• Billed per 10.000• Example: Checking a queue every second from 2 workers – 172.800 transactions / day• Use a back-off mechanism – No data? Wait a second – Again no data? Wait two seconds – Etc.
  17. 17. Transactions• Use Service Bus Queues and Notifications• Serving 100 images from blob storage – High traffic app  high # transactions – Choose wisely between blob storage and compute
  18. 18. Diagnostics monitor• Writes data to storage account• Does not clean up• Write often = # transactions• Write less = lag in diagnostic data
  19. 19. SQL AZURE
  20. 20. Database editionsDatabase Size Price Per Database Per Month0 to 100 MB Flat $4.995Greater than 100 MB to 1 GB Flat $9.99 $9.99 for first GB, $3.996 forGreater than 1 GB to 10 GB each additional GB $45.954 for first 10 GB, $1.998Greater than 10 GB to 50 GB for each additional GB $125.874 for first 50 GB, $0.999Great than 50 GB to 150 GB for each additional GB
  21. 21. Billing nuances• Based on peak DB size / day• Averaged over 1 month• Actual database edition size used is billed• Examples – 0.9 GB in a 5 GB web edition costs 1 GB (= $9.99) – 1.1 GB in a 5 GB web edition costs 5 GB (= $49.95)
  22. 22. Tables & indexes cost money• Be careful with them• Only define indexes needed• Indexing every column & not using it may be a waste of money• Example – If an index does not add speed, lose it – If the data relational, go NoSQL – Table with 1 GB of “static data” on SQL Azure = $ 9.99, on table/blob storage it costs $ 0.12...
  23. 23. CUSTOMERAWARENESS
  24. 24. Customer awareness• Yes, you can have all you want• Yes, you can have it your way BUT...
  25. 25. Discuss OpEx!• Cost-analyze the requirements• Discuss implications & alternatives with stakeholders – Pay more for user experience? – Cheaper alternative experience? – Clever solutions?• Review the options you considered• Write them down & sign off – Or you will return to these discussions again and again
  26. 26. DEVELOPERAWARENESS
  27. 27. A code snippet... if (Session["culture"].ToString() == "en-US") { // .. set to English ... } rs s! if (Session["culture"].ToString() == "nl-BE") { pe st lo // .. set to Dutch ... } De ve ct co im pa string culture = Session["culture"].ToString(); ct ly if (culture == "en-US") { // .. set to English ... ir } ed if (culture == "nl-BE") { // .. set to Dutch ... }
  28. 28. Analysing Real World ScenariosSCENARIOS
  29. 29. Static WebSiteSCENARIO 1
  30. 30. Scenario 1 – Static WebSite What to use? Options? Blob Storage Compute Option 1: Blob Storage We pay for? Storage Space Transactions Bandwidth In/Out Option 2: Compute We pay for? Compute Hours Bandwidth In/Out
  31. 31. Scenario 1 – Static WebSite – v1 Number of Concurrent Users: 10 / second WebSite Storage Space: 0,5 GB Average Number of files served per User: 5 Average file size: 200 KB Option 1: Blob Storage We pay for? Storage Space = 0,5 GB * 0,15 = 0,075 USD Transactions = (10 * 5 * 60 * 24 * 30 ) / 10k * 0,01 = 2,16 USD Bandwidth In/Out = (10 * 5* 60 * 30 * 0,0002) * 0,15 = 2,7 USD Total Costs ~ $ 5 Option 2: Compute We pay for? Compute Hours = (2 * 24 * 30) * 0,12 = 172,8 USD Transactions = (1 * 5 * 60 * 24 * 30 ) / 10k * 0,01 = 0,216 USD Bandwidth In/Out = (10 * 5* 60 * 30 * 0,0002) * 0,15 = 2,7 USD Total Costs ~ $ 176
  32. 32. Scenario 1 – Static WebSite – v2 Number of Concurrent Users: 1000 / second WebSite Storage Space: 0,5 GB Average Number of files served per User: 5 Average file size: 200 KB Option 1: Blob Storage We pay for? Storage Space = 0,5 GB * 0,15 = 0,075 USD Transactions = (1000 * 5 * 60 * 24 * 30 ) / 10k * 0,01 = 216 USD Bandwidth In/Out = (1000 * 5* 60 * 30 * 0,0002) * 0,15 = 270 USD Total Costs ~ $ 487 Option 2: Compute We pay for? Compute Hours = (2 * 24 * 30) * 0,12 = 172,8 USD Transactions = (1 * 5 * 60 * 24 * 30 ) / 10k * 0,01 = 0,216 USD Bandwidth In/Out = (1000 * 5* 60 * 30 * 0,0002) * 0,15 = 270 USD Total Costs ~ $ 444
  33. 33. Scenario 3 – Static WebSite – v3 Number of Concurrent Users: 2000 / second WebSite Storage Space: 0,5 GB Average Number of files served per User: 5 Average file size: 200 KB Option 1: Blob Storage We pay for? Storage Space = 0,5 GB * 0,15 = 0,075 USD Transactions = (2000 * 5 * 60 * 24 * 30 ) / 10k * 0,01 = 432 USD Bandwidth In/Out = (2000 * 5* 60 * 30 * 0,0002) * 0,15 = 540 USD Total Costs ~ $ 973 Option 2: Compute We pay for? Compute Hours = (2 * 24 * 30) * 0,12 = 172,8 USD Transactions = (1 * 5 * 60 * 24 * 30 ) / 10k * 0,01 = 0,216 USD Bandwidth In/Out = (2000 * 5* 60 * 30 * 0,0002) * 0,15 = 540 USD Total Costs ~ $ 714
  34. 34. Application Data StorageSCENARIO 2
  35. 35. Scenario 2 – Application DataStorage• What to use? Options? – SQL Azure – Table Storage – SQL Azure + Table Storage• Assumptions – Number of Concurrent Users: 100 / second – Database Size: 10 GB – Average response size: 200 KB – Reference Data Percentage: 20 % – History Data Percentage: 30 % – Simple Indexed Data Percentage: 40% – Highly searched Data Percentage: 10%
  36. 36. Scenario 2 – Application DataStorage – v1• Option 1: SQL Azure – We pay for? Database Storage = $ 45.954 Bandwidth Out = (100 * 60 * 30 * 0.0002) * 0,15 = $ 5.4 Total Cost: $ 51.354
  37. 37. Scenario 2 – Application DataStorage – v2• Option 2: Table Storage – We pay for? Storage Space = 10 GB * 0,15 = $ 1.5 Transactions = (100 * 60 * 24 * 30 ) / 10k * 0.01 = $ 4,32 Bandwidth Out = (100 * 60 * 30 * 0.0002) * 0.15 = $ 5.4 Total Costs = $ 11.22
  38. 38. Scenario 2 – Application DataStorage – v3• Option 3: SQL Azure + Table Storage – We pay for? SQL Azure Database Storage =1 GB = $ 9.99 Bandwidth Out = (100 * 60 * 30 * 0.0002) * 0.15 = $ 5.4 Table Storage Storage Space = 9 GB * 0.15 = $ 1.35 Transactions = (100 * 60 * 24 * 30 ) / 10k * 0.01 = $ 4.32 Bandwidth Out = (100 * 60 * 30 * 0.0002) * 0,15 = $ 5.4 Total Costs = $ 26.46
  39. 39. What to remember?KEY TAKEAWAYS
  40. 40. Key Takeaways• Cloud pricing isn’t more complex – Just “different”• Every component has own characteristics• Requirements impact costs• Developers impact costs• Windows Azure pricing model can improve code quality• But don’t over-analyze!
  41. 41. Resources• Starting point: – http://www.windowsazure.com• Steve Marx: – http://blog.smarx.com• Cloud Cover Show – http://channel9.msdn.com/Shows/Cloud+Cover• Special Thanks to Maarten Balliauw – http://blog.maartenballiauw.be
  42. 42. THANK YOU Nuno Godinho Cloud Solution Architect @ Aditi nunog@aditi.com Twitter: @NunoGodinho http://msmvps.com/blogs/nunogodinho

×