You are on page 1of 27

virtual techdays

INDIA 28-30 September 2011

Window Azure Cost Inspired Architecture Sujesh Kodoth Senior Consultant, MCS, Microsoft

SESSION AGENDA
Explain compute, storage and bandwidth cost considerations. Identify fundamental efficiency principles to consider. Recognize where and how to translate savings into added value and increased revenue.

Estimating Cost

Windows Azure Platform Purchasing Models

Windows Azure Platform Consumption Pay as you go and grow for only what you use when you use it Prices

$0.15 per GB for data transfers


from European & North American locations

$0.20 per GB for data transfers


from other locations

$0.01 per 10,000 transactions

Predicting Cost
It can be difficult to predict and deal with cost purely in terms of the billing metrics that Windows Azure uses Easier to deal with cost when converted to units that make sense for your service, example:
Cost / Feature Cost / Business Transaction Cost / Unit of Uptime

Cost / User

Easier to say If we get X, well be paying Y


Can use this technique to simulate fixed costs on top of the variable costs of cloud computing, but it only works when your initial measurements are correct.

Predicting Cost
Compute Per Service Hour, for VM size Storage Per GB stored & transactions Bandwidth Per GB transfer out of datacenter AppFabric Per connection/month Per transactions/month SQL Azure Per DB per Month

Predicting Cost
Migration Assessment and Planning Toolkit Windows Azure TCO Calculator

Factoring cost into architecture decisions


There are often many ways of solving a problem Traditionally, architects focused mainly on nonfunctional requirements to decide the best path With Windows Azure, cost can be added to the equation:
Data Storage: SQL Azure or Azure Storage? Session State: AppFabric Cache, SQL Azure or Azure Storage? Integration: AppFabric Service Bus or Azure Connect? Distribution: 1 site on each of 2 roles, or 2 sites on 1 role?

Windows Azure Units Scale Units


Having an approximate $ amount for what your business/service specific metric costs is important Simulate business-specific metric in the cloud (transactions, users, uptime, etc.)
Metrics could span multiple hosted services, storage services, or subscriptions

Break down the billing statement so you know what a servicespecific unit costs you Take it further by deploying scale units Each scale unit has known cost due to past profiling/measurement

Hosted Services

Storage Services

Known Workload

Scale Unit

Example Scale Units


Search & Browse (95%)
16 x Web Roles 2 x 2 GB AppFabric cache to hold product inventory 2 x Worker Roles to update cache periodically 220ms response time 2000 concurrent users

Checkout (5%)
2 Web Roles 2 x Queue 2 x Worker Roles for order processing 300ms response time 200 concurrent users 100 orders per minute

Shared Databases
1 x Products DB 1 x Customer DB 1 x Orders DB

! Dont forget the resources used for monitoring, instrumentations etc. which may be directly related to scale unit.

Estimating Cost per Feature


When does it make sense to use this estimation approach?
Might need to reset Customers expectations on how much a feature might cost

Application Migration Scenario


Customer thinks that existing feature will be cheap, free or simple to implement/migrate Feature request wasnt in original scope and to implement has unmanageable consequences

Net-New Application Scenario (Similar to Migration)

Estimation Process
COMPUTE

GET BIZ PROCESSES

ESTIMATE COST OF:

DATA

BANDWIDTH

Transaction Estimation (Example)

Optimising Cost

Fundamental Principles
Measure everything, measure everything!
Windows Azure Diagnostics Transparent ROI

Better Performance = Lower TCO


Lower ongoing infrastructure costs Scalability of capacity Rapid deployment

Whenever possible:
Cache Compress Batch

Following these principles typically leads to a better user experience and app performance

Instrumentation is Key to Optimizing Costs

Monitoring
Where is CPU time spent? What % of CPU is used?

Diagnostics
What URLs are getting served? What are the characteristics (caching, compression, etc)

Storage
What parts of your code are calling storage? What partitions are they hitting? Route all storage access through common code. Verify storage patterns.

Cost Savings

Remember to account for monitoring and diagnostic usage costs!

Storage Cost Considerations

Batch Transactions

Distributed Network Cache

Data in Storage

Snapshots

CDN Service

Data Pulls

Monitoring and Diagnostics


Remember that monitoring and diagnostics arent free
Storage transactions Data storage CPU cycles (which could be used elsewhere)

At scale, think about what granularity is appropriate: Do you really need per second CPU counters with 1K cores? Use different storage accounts for app, monitoring , and diagnostic data.
Remember that storage has per-account throttling.

At very large scales, heavy monitoring / aggressive transfers can cause storage throttling and fail to capture critical data.

Picking the correct VM Size


Remember:
1 role instance == 1 VM running Windows.
1 role instance != one specific task for your code Youre paying for the entire VM so why not use it?

Common mistake split up code into multiple roles, each not using up CPU. Balance between using up CPU vs. having free capacity in times of need. Multiple ways to use your CPU to the fullest

Exploiting Concurrency
Typically code falls into one or more of these categories:

Memory Intensive

CPU Intensive

Network Intensive

Storage IO Intensive

Stopping & Removing Services

Scaling Appropriately
Scaling is a feature, and under your control.
Monitor your application and make Performance Cost sure youre scaled appropriately (not over-scaled) Spinning VMs up and down automatically is good at large scale, but may be cost-prohibitive for smaller scale deployments.

Remember that VMs take a few minutes to come up and cost ~$3 a day (give or take) to keep running.

Traffic Reduction

Bandwidth is major cost of any application. Reducing bandwidth leads to edge savings. Batching increases Storage efficiency. Reducing throughput increases VM capacity.

AJAX/JSON Image maps CSS Sprites Inline Images Combine scripts Combine stylesheets

All of these tips have the side benefit of improving your web apps performance and user experience

Content Compression
Gzip all output content:
All modern browsers can decompress on the fly. Compared to Compress, Gzip has much better compression and freedom from patented algorithms
Uncompressed Content

Gzip Minify JavaScript Minify CCS Minify Images

Minify JavaScript. Minify CSS. Minimize image sizes:


Use Portable Network Graphics (PNGs) Crush your PNGs Strip needless metadata Make all PNGs palette PNGs

Compressed Content

Effective Caching Techniques

Caching Techniques
Etags Expires Max-Age header Using query strings, different filenames for cache breaking

Summary
Understand the Windows Azure pricing model, and how it applies to your specific solution Use Scale Units to estimate costs under different usage scenarios Take cost into consideration when estimating features Maximize the utilization of each role instance Shut down services/instances when not needed Use caching, compression and batching to minimize resource usage and cost

You might also like