Autofail: A Big Azure Autoscale Limitation and What To Do
Azure Autoscale is a great feature of Azure and a reason many choose to use this platform… however, there is a key limitation that affects many Sitecore PaaS environments.
The issue is that Azure puts new Application Service instances into rotation without knowing if your Sitecore application is actually ready to receive traffic/is warmed up!
This is a huge concern as scaling out is a common cloud practice. While autoscaling has detailed metrics on when to trigger a scale, missing a component like checking to know if an app is ready for traffic can cause a horrible experience for end users as they receive 500 errors until the app is ready.
Of note, Microsoft has a Health Check feature that checks for bad instances along with a timing of up to 10 minutes to keep a instance in rotation. You can enter in the URL that Azure checks against (i.e. the Sitecore keepalive.aspx page) to know if you app is healthy. Given this, Microsoft has a base hook for checking application status but they do not have it in use for autoscaling new instances.
OK! Autoscaling Adding Instances Without Checking App Status Is A Big Deal. Now What Do I Do About It?
Given this huge limitation, there are a few options to managing this as follows:
- Use Application Initialization to warm up your Sitecore application. If using Application Initialization does not warm up your app fast enough before the instance is put into rotation, consider if the remap option which serves up a temporary HTML page of your choice while Application Initialization is waiting to complete works for your user experience.
Here are some resources for Application Initialization:
Application Initialization <applicationInitialization> –https://docs.microsoft.com/en-us/iis/configuration/system.webserver/applicationinitialization/
Sitecore App Service Warm-Up Demystified – https://blog.richardszalay.com/2019/07/03/sitecore-azure-appinit/
APPLICATION INITIALIZATION FOR AZURE SERVICE APPS (AND SITECORE) – https://andrewwburns.com/2019/08/30/application-initialization-for-azure-service-apps-and-sitecore/
- Don’t use Autoscale but load test and use the Manually Set option for the number of instances that will meet your expected load + 30% for any unexpected traffic. Also make sure to use a CDN to speed up your site/cache along with a WAF to prevent unwanted traffic to maximize performance. Don’t forget about your Sitecore Caches either!
- Upvote this feature request and keep pushing Microsoft until this mission critical feature is added to the base Autoscale functionality: https://feedback.azure.com/forums/169385-web-apps/suggestions/42219319-ensure-autoscale-allows-for-new-instances-to-get-i