A key benefit of cloud computing is the ability to add and remove capacity as and when it is required. This is often referred to as elastic scale. Being able to add and remove this capacity can dramatically reduce the total cost of ownership for certain types of applications; indeed, for some applications cloud computing is the only economically feasible solution to the problem.
The Windows Azure Platform supports the concept of elastic scale through a pricing model that is based on hourly compute increments. By changing the service configuration, either through editing it in the portal or through the use of the Management API, customers are able to adjust the amount of capcity they are running on the fly.
A question that is commonly asked is how to automate the scaling of a Windows Azure application. That is, how can developers build systems that are able to adjust scale based on factors such as the time of day or the load that the application is receiving?
To answer this need, and to show how it can be done, Grzegorz Gogolowicz and Trent Swanson from Microsoft's Developer and Platform Evangelism division have developed a sample Windows Azure Dynamic Scaling Sample and framework. It is posted on the MSDN Code Gallery here.
The goal for the "Dynamic Scaling Windows Azure" sample is to show one way to implement an automated solution to handle elastic scaling in Azure. Scaling can be as simple as running X amount of server during weekdays and Y amount during weekends, or very complex based on several different rules. By automating the process, less time needs to be spent on checking logs and performance data manually, and there is no need for an administrator to manually intervene in order to add and remove capacity.
An automated approach also has the benefit of always keeping the instance count at a minimum while still being able to cope with the current load- it allows the application to be run with a smaller amount of 'headroom' capacity and therefore at a lower cost. The sample as provided scales based on 3 different variables, but the framework has been designed to be flexible in terms of future requirements.
This sample application shows an approach to dealing with variable load through rule based scaling and then illustrates in detail the architecture, implementation and use of the provided sample code. It also covers how potential extensions to the framework can be developed to support additional scenarios.