Cloud Service Roles are load-balanced and ubiquitous.  Rebooting one instance while having others in the Role handle the load is considered "normal" and application architects are encouraged to expect occasional reboots to occur.  


In Worker Roles, ensuring that rebooting instance behaves appropriately it is usually done handling the RoleEnvironment.Stopping event.  In Web Roles, this situation is often handled by Azure, because during Azure instance reboot, an instance is first taken out of the load balancer but not rebooted, this allows it to finish any pending requests without starting to handle new ones, then it is rebooted and only afterwards placed back into the load balancer and allowed to handle traffic.


It is often desired to force reboots of instances to keep them "clean".  Memory leaking, fragmentation regularly occur and rebooting is often simplest and best way to fix such issues.  CloudMonix can assist Azure administrators with a single Action that reboots all Azure Cloud Role instances once per day, one instance at a time.


Steps to enable this:

  • Your Subscription must be on a Trial or Ultimate plan to get access to automation features such as reboots
  • Setup (or enable an existing Daily Reboot) Action with expression: CheckTimeUtc.Hour == (int.Parse(InstanceName.Substring(InstanceName.LastIndexOf("_") + 1)) % 12)
  • Explanation: this expression will reboot, at the beginning of every hour, every instance whose index divides by that hour without a remainder.  What this means, is that this action will reboot 1/24th of all of your instances every hour.
  • Important: ensure that Suspended amount of time is long enough to disallow this action from executing on the same Instance continuously for the next 60 minutes
  • Daily reboot action is provided in the sample monitoring profile and is disabled by default.