You’re Being Successful, Cater for More Visits
One of the benefits of platforms-as-a-service like Windows Azure, is that you don’t have to know in advance how many sites your company will have, or how popular and resource consuming your application will be. The platform provides you a way to adapt your hosting to whatever the needs are at a given time. In the Windows Azure platform, you can scale your sites on the fly.
Scaling up will allow your application to get more resources on the same instance.
Scaling out on Windows Azure consists of spinning additional instances of the application. Load balancing between the instances is provided by the platform and thus does not require further configuration. The application must, therefore, be multi-instance safe. This requires extra care to ensure that items such as how the data is consumed by the application, the handling of user sessions, and access to resources are thread safe. Sticky-sessions are not managed out of the box by the Azure platform. One way to ensure continuity of sessions on multi-instances is to store sessions in the Azure session state provider or in the Azure Redis Cache. Another way would be to leverage the routing capabilities in Windows Azure to route requests to stateful instances.
Go to the application settings on your Windows Azure Web Service (WAWS) platform and look for the app service plan menu. There you will find the "Scale out" menu.
Unfortunately, the scaling functionality is not part of the Free Service Plan.
So we need to select the S1 Standard plan to be able to access scaling options and configure the scaling of our application. We can see that, for the moment, we have only one instance running. We can manually add another instance of our application. Or we can scale given the CPU usage in a percentage of our application.
I modified the home page template to add some dummy code and get the page to fetch blog posts multiple times, triggering many requests to the server.
Looking back into the Azure portal, we can see that the scaling took place.
And I even received an email letting me know that my application is scaling.
After about 20 minutes without activity on the website, and having removed the code that caused extra load on the CPUs, our application has been automatically scaled back down to one instance.
In this part of the series, we showed how to automatically scale an Umbraco installation without having to worry about anything other than the cost. However, scaling an application requires you to manage its state at a global level. For Umbraco, the main pain points are handling the session state, the Lucene index files, and the config file. Depending on the version of Umbraco you run, some of those concerns have been addressed. Notice that we did not need any Visual Studio IDE, nor did we need to install IIS — we have a scalable website within a few clicks. This is the peace of mind that well-built software should give you. Always remember that a 100-instance production software system might have different needs than a 10-instance one. Maybe you need more powerful tools to monitor and inspect the state of your platform.