Search code examples
azureazure-worker-roles

How does Azure check the WorkerRole's status?


I see how Azure checks the status of my worker role periodically, but how?

There is no method in RoleEntryPoint to do that, and I'm taking a look on Microsoft.WindowsAzure.ServiceRuntime's classes with ILSpy but I don't see anything relevant.


Solution

  • Here's a blog post that describes how the Windows Azure Fabric Controller monitors instance health.

    Aside from that, the controller calls a StatusCheck event, every 15 seconds, that you can handle. If you want to pull yourself out of the load balancer (maybe based on some internal data your instance has), you just call SetBusy() on the RoleEnvironmentStatusCheckEventArgs object. This takes you out of the load balancer until the next check.