Cutting costs on Windows Azure Isn’t always about compromise, its about organization and using available resources to a maximum.
Taking the time to observe and evaluate how your application consumes available resources is critical. Small changes can make a world of difference when It comes to costs.
For example, by default Visual Studio sets the size of your virtual machines to Small. If you were to scale down and out, you could have 3 Extra Small virtual machine instances for the price of a single Small virtual machine instance.
Having more than one instance of you roles is crucial, because it allows your end users to benefit from a 99.995% up time SLA. Having a single instance will only provide a 99.99% up time SLA. Furthermore, having a single instance will incurs sporadic down times when role instances are taken down for maintenance by the Azure Fabric Controller (FC). Your end users will also be submitted to down times when you deploy new versions of your application.
Imagine a scenario where you have 3 roles configured as Small virtual machines, 1 Web Role and 2 Worker Roles. Scaling down and out these Roles yields surprising results! Lets do the math:
Original Scenario
3 small instances * 0.12$ * 24 hours * 365 days = 3153.60$ per year
Scaled Down And Out Scenario
6 extra small instances * 0.02$ * 24 hours * 365 days = 1051.20$ per year
Scaling down greatly reduced the costs of operation, it also gave us enough leftover budget to add more virtual machine instances. Having more instances means more resiliency against hardware failures, it means more durability and more availability. Consequently, the end user will perceive reliability which in time results in trust.
The next question that needs to be answered is ‘are you using your available resources to a maximum?’. Microsoft recently bought MetricsHub, a monitoring SaaS solution that enables your teams to monitor your services deployed on Windows Azure. I strongly recommend using third party monitoring solutions because they cover close to all daily needs in terms of monitoring and auto scaling. Implementing your own solutions can be quite costly to build and test. But if you build your own solution, be sure to read up on how costs are calculated. Scaling up or scaling down at the wrong time will incur unexpected costs.
Peek into how resources are used by your application.
- Is the CPU idle or close 95%?
- Is your bandwidth is overloaded?
- Is your disk I/O causing a bottleneck?
- Is your virtual machine under memory pressure? Memory pressure occurs when your virtual machine’s RAM is close to full. At that moment Windows will start swapping in order to keep up with your demands. Swapping drastically slows processing.
Once you have a comprehensive picture of how the application is consuming resources, compare it with the following table. See if your application could benefit from scaling down.
configurations available as of February 2013
Then think about your worker roles
- Are they underused?
- Are they exclusive or can they be combined into one?
- Are both your worker roles constantly busy or are they under load on different schedules?
If it’s possible to combine both Worker Roles into a single Worker Role, you could cut cots by scaling in and reduce your Worker Role instance count to 2.
Original Scenario
3 small instances * 0.12$ * 24 hours * 365 days = 3153.60$ per year
Scaled Down And In Scenario
2 extra small Web Role instances * 0.02$ * 24 hours * 365 days = 350.40$ per year
2 extra small Worker Role instances * 0.02$ * 24 hours * 365 days = 350.40$ per year
Result
4 extra small Role instances * 0.02$ * 24 hours * 365 days = 700.80$ per year
Comparing these last scenarios, your could be saving up to 2452.80$ a year. You would also have an environment that has a greater availability for your end users. Furthermore, these savings can be achieved without changing a single line of code!
Spend time and money on monitoring your Windows Azure applications, its worth every penny! It will allow you to rapidly identify bottlenecks, overspending and other issues that are hard to spot without support from specialized tools.
Favor scaling out over scaling up. Before you mention scaling up to management, be absolutely sure that you code has been fully optimized. Look into caching and offloading streaming to Windows Azure Blob Storage Service. There are many different approaches to reducing costs on Windows Azure. The following are a few of my previous posts discussing some of these aspects.
Interesting Posts
- Choosing The Right Compute Virtual Machine Size
- Floor It! Then Kick It Back a Notch
- Does your data really belong in your SQL database?
- Get More Bang For Your Buck With Windows Azure!
- Surprisingly, Size Matters in The Cloud!