Your Azure role instances can sometimes become unhealthy or experience slower performance. Use the included tool to remove the unhealthy instance - and replace it with a healthier, better performing one.



Summary


Not all cloud instances are the same. A variety of factors can cause one of your instances to perform poorly, or fail. You can then get stuck with bad performance, or an instance that is being constantly restarted by Azure.

To recover quickly, you can delete the specific instance that is experiencing problems so it can be replaced with a clean, better performing vm.

What can cause one of my Azure instances to have poor performance?


It can be any number of things, including:

  • The physical host, VM, or associated hardware experience a failure.

  • Application memory leaks create a persistent low memory condition.

  • The application enters a high CPU loop.

  • Data corruption on the temporary instance storage.

  • Azure's own WaIISHost.exe or WaAppAgent.exe host processes encounter a bug, causing your role to fail or be frequently restarted.


If you've been running applications in Azure, you have experienced some of not all of these problems.

How do I identify the instance that needs to be deleted?



You may be alerted to this because Azure will report the instance as unhealthy. However, in the majority of cases, your server and application monitoring software will be the one to identify an increase of errors or lower performance from the affected instance.

If you are using LeanSentry, it will automatically identify if one of your instances experiences overload or poor performance.


How do I delete the bad instance?


In the past, Azure compute services did not allow you to retire a specific instance. Instead, you'd need to either perform a VIP swap, or scale down your environment, removing each instance starting with the last until your affected instance is removed.

Both of those approaches were unworkable for production applications because of the impact to the running instances.

Thankfully (and in part due to our feedback), Azure recently released an API to allow specific instances to be removed. We wrote a small tool to do this for our own environment.

1. Download the tool: AzureDeleteInstance.zip.

2. To use:


AzureDeleteInstance.exe [subscriptionId] [serviceName] [instanceToDelete] [certificateThumbprint]


For example:


AzureDeleteInstance.exe "F9D7C942-214C-479A-93A0-578C583B9F0D" "leansentrystorageendpoint" "LeanSentry.StorageEndpoint_IN_17" "AAAAAABBBBBBBCCCCCDDDDEFFFFFFFFFFFF01234"


You can find the subscription id, service name, and instance name in your Azure management portal.

Locating Azure compute service name and instance name

NOTE: Finding the management certificate: Click Settings > Management Certificates to find your Azure management certificate. Make sure that certificate is installed on your machine in order to authenticate successfully.


Conclusion


Don't assume that ever instance will perform the same. It's a good idea to monitor the health and performance levels of your cloud instances so you can identify poorly performing ones.

If you do find that one of your instances is performing poorly, use the included tool to remove it and scale up again to replace the removed instance with a fresh one.







More resources


Want to learn the best techniques for managing your IIS web server? Join our how-to newsletter.
Want to get the best tool for troubleshooting and tuning your web apps? .

Build your skills


Get performance best practices straight from our IIS & ASP.NET experts:


How-to newsletter: 1-2 emails/week with expert IIS & ASP.NET tips.