Auto-Healing Windows Azure Web Sites

Posted on

 

 

How many times have you been woken up in the middle of a night for an issue that was simply resolved by restarting your web site? Wouldn’t it be nice to auto detect certain conditions and automatically recoverWith recent updates to Windows Azure Web Sites (WAWS), we have tried to address these questions. There are some new enhancements to “Always ON” feature and with these enhancements comes the ability to automatically recycling the worker process hosting your web application. We call this the “Auto Healing” feature, and here is how it works:

You simply define the triggers in the root web.config file of your web site and configure theactions to be performed when these triggers are hit. At high level, your configuration section will have following structure.

Recycling based on Request count

Consider a scenario where you have a need to recycle your application automatically after it has served X number of requests in Y amount of time. You know that it just doesn’t scale well after huge influx of requests in short amount of time. You want to detect this condition and recycle worker process automatically and log an event.

You simply edit the root web.config file for your application with following sample configuration. (If you have an existing web.config file then please copy <monitoring> section under an existing <system.webServer> section)

Recycling based on slow requests

Consider a scenario where the performance of your application starts degrading and several pages start taking longer time to render. You would like to detect this situation and recycle worker process automatically.

You simply edit the root web.config file for your application with following sample configuration. (If you have an existing web.config file then please copy <monitoring> section under an existing <system.webServer> section)

 

Logging an event (or recycling) based on HTTP status code(s)

Consider a scenario where you would like to get notified of a situation when your web site starts throwing specific HTTP status codes, sub-status code or win32 status codes. You could choose to recycle or simply log an event in eventlog.xml file (found inside Logfiles folder of your web sites content root)

 

Taking custom actions (or recycling/logging) based on memory

Consider a scenario where you are troubleshooting a memory leak in your web site and would like to perform a custom actions like generating memory dumps, or sending an email notification or generate memory dumps and recycle the process etc.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s