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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With