Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure app service websites has slow response times after being idle for some time

Tags:

In the last couple of weeks we've been investigating some performance issues where our MVC application was responding very slow for the first request. We are talking like 30-45 seconds for the first request and 3 seconds for each new view. Our MVC application is using our OData API (Web API) which is located on the same server. Besides the same performance issues as the MVC application, the first query to entity framework version 6 is executing in 6 seconds and new queries is executing 200ms slower than subsequent queries.

In order to meet our requirements, we have chosen to execute all known Ef queries and hit all our MVC/API endpoints from Application_Start in Global.asax. This seems to work fine for at least a couple of hours, but after some time without use, the first request to every MVC view is responding in 3-5 seconds.

We have configured the websites to be "Always on" and we have not found anything in the IIS logs or the logging we've added to Application_Start. So it seems our applications are at least not recycling. I suspect some kind of IIS cache being cleared or maybe some Ef cache? Any suggestions are welcome.

like image 728
Kasper Nørtoft Avatar asked Mar 20 '16 15:03

Kasper Nørtoft


People also ask

Why is Azure App Service so slow?

This problem is often caused by application level issues, such as: network requests taking a long time. application code or database queries being inefficient. application using high memory/CPU.

Which service can be used to detect issues in a Web application running on Azure App Service?

Application Event Log (Azure App Service) To access the Application Event Log, use the Diagnose and solve problems blade in the Azure portal: In the Azure portal, open the app in App Services. Select Diagnose and solve problems.


1 Answers

You'll want to enable the "Always On" setting for your web app.

You can do that from portal.azure.com -> your site's blade -> Configuration -> General Settings -> Always On

See here for details: https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/

When Always On is disabled, after 20 minutes of inactivity the site gets taken down in order to free up resources for any other sites that might be running on the same App Service Plan.

like image 134
Zain Rizvi Avatar answered Sep 27 '22 20:09

Zain Rizvi