Is there way to determine why Azure App Service restarted?

Viewed 15213

I have a bunch of websites running on a single instance of Azure App Service, and they're all set to Always On. They all suddenly restarted at the same time, causing everything to go slow for a few minutes as everything hit a cold request.

I would expect this if the service had moved me to a new host, but that didn't happen -- I'm still on the same hostname.

CPU and memory usage were normal at the time of the restart, and I didn't initiate any deployments or anything like that. I don't see an obvious reason for the restart.

Is there any logging anywhere that I can see to figure out why they all restarted? Or is this just a normal thing that App Service does from time to time?

2 Answers

If your service restarted due to OutOfMemoryExceptions Application_End might not run due to the app crashing.

We moved our ASP.NET 4.8 MVC 5 app to Azure App Services (with windows containers) and were faced with OOMs once we went live. Application crashes were so severe that the Application_End event was not able to log any messages. We did get intermittent OOMEs that AppInsights was able to dispatch before the restart.

Our engineers had been searching to increase the memory of the website (as we did use a lot in our previous environment) but could not find any usable reference. We were saved at last by Microsoft support who suggested using this application setting (to be added under Configuration) to increase memory:

WEBSITE_MEMORY_LIMIT_MB = 3072

They added this reference to the Azure documentation: https://github.com/MicrosoftDocs/azure-docs/issues/13263#issuecomment-655051828

Now our application is running happily committing around 4200M at peak times. My service plan has 32G, has 2 app services, total of 5 slots, one of which is configured to use 5120M. Still have around 40% memory left for spinning up staging slots.

Related