1
votes

I have performance issue with ASP.NET Web API app hosted as Azure Web App. After deploying the first request to web service is really slow (we are talking about seconds here). Subsequent requests work just fine without extra delay.

"Always on" feature works fine keeping the app from unloading but this does not solve my issue. I do not want this first request to warm up the service (BTW - should it be warmed up?).

I've used diagnostic and profiling tools in Azure without finding the root cause of this thing. I've used Application Insights as well. It seems like one function of mine needs much more time to execute during this first request - debugging the app locally I did not notice any performance issue with mentioned function.

How can I fix this?

Thanks!

1
You are deploying a new version, that has to load, that takes time. No feature can save you from that, just make a dummy request after publishingCamilo Terevinto
Cannot send a dummy request on production. Web service changes the state of the app.bulb2
You might be able to create an endpoint to do just that, a dummy request. Maybe you already have an health endpoint you can use?Peter Bons
Hi, I have built a ping service that is mapped to the base url of the app. "Always on" Azure web app's feature sends a request to that endpoint every 5 minutes however this does not warm up the endpoint that does the actual work. I believe this ping is just for keeping app alive, preventing it from unloading while being idle.bulb2
In production environment use deployment slots, and then swap the slots. This will help mitigate your issue with the slow loading speeds. I am having the same issue, with development environments it isn't as big of an issue though.Matt Drouillard

1 Answers

4
votes

This bit me as well. "Always On" will only make automated calls to your service root - think about slapping the process every time so it won't fall sleep.. We don't use this in our PROD services, we rather have an Azure Availability Test invoking a Ping() endpoint every 5 mins - two birdies, one stone. Besides, AlwaysOn will generate 404 errors in App Insights if you don't have anything in the root.. A totally different thing is warming up each one of the endpoints so they could get JIT-ed and ready, and I have not found anything better than a warm-up script with the whole list of endpoints to call, it is not perfect but it works. So every time you do a deployment o do a restart this will automatically run and your first calls won't be hurt. Have a look at this article. I hope this helps