A really complete example has been published on Windows Azure Dynamic Scaling Sample talking about this topic.
If you are still interested on knowing how this requirement can be “manually” implemented,continue reading this post,otherwise I would recommend you to visit the Windows Azure Dynamic Scaling Sample
Combining the strengthens of the Windows Azure Diagnostics API and the Service Management API makes really easy to implement your own logic for auto-scaling your Azure Services.
In this post I will show you how I have implemented a PoC for auto-scaling an Azure Solution and the different options that you have for implementing a similar solution.
1. Solution architecture
The solution components are :
The following diagram illustrates the solution architecture :
It would also have been possible to host the Controller Service in a traditional on premise service.The following diagram illustrates that option:
2. Using the Diagnostics API for reading performance counters
With the Diagnostics API you can :
The following table outlines the traces and counters that can be activeted and where are stored .
Diagnostic Data Type
Default Configuration
Stored in WA Storage as
Windows Azure Logs
Enabled and generating logs locally
Contains logs from the diagnostic infrastructure, which help the user troubleshoot issues with the diagnostic monitoring system itself.
Table
WADInfrastructureLogsTable
Diagnostic Monitor Logs
Contains the logs generated by your service using standard .NET Tracing APIs.
WADLogsTable
Performance Counters
Not Enabled
WADPerformanceCountersTable
Windows Event Logs
Application Crash Dumps
Blob
wad-crash-dumps
IIS Logs
Failed Request Logs
Enabled
wad-iis-failedreqlogfiles
Arbitrary Logs
For detailed information about implementing diagnostics in Azure go to the link Implementing Windows Azure Diagnostics
3. Scaling an Azure Service
For scaling an Azure service, you must consume the Service Management API.
Before being able to consume the API, you should generate a self-signed certificate for authenticating the service requests.You can show how this can be achieved in the following link Authenticating Service Management Requests.
After that, you have the following options for consuming the service management API and scaling the service:
When updating the service configuration,the key it’s to modify the Instances count param of the service configuration.For instance, this XML represents Financial Service configuration contained in the .csfg file
<Role name="GRC.BasicFinancialService"> <Instances count="1" /> <ConfigurationSettings> <Setting name="DiagnosticsConnectionString" value="UseDevelopmentStorage=true" /> </ConfigurationSettings> </Role>
If you want to scale the service using a the power shell cmdlets here you have an example :
string scaleScript="Add-PSSnapin AzureManagementToolsSnapIn "+
"Get-HostedService $serviceName -Certificate $cert -SubscriptionId $subId | "+
"Get-Deployment -Slot Production | " +
"Set-DeploymentConfiguration {$_.RolesConfiguration[$roleName].InstancesCount+=1}" ;
I hope that this post has helped you to see the wide set of options that you have for implementing diagnostics in your Azure Service.
I will upload the PoC I have used as soon as it is fully tested.
The example is really excellent and very useful.If I want to implement same application on Development fabric will it support after doing some code changes related to development fabric.