I am relatively new to asp.net and IIS things, i have done many apps using other technologies, but never faced such a problem.
We have set up a lab on Azure, with all needed virtual machines, hosting the ASP.NET MVC 5.0 app on a machine (IIS 7), and another machine hosting SQL Server 2014 to host its database, we are using code first.
The issue is that when opening a page that lists records from a table from the database, it takes 15 seconds to do so, only for the first time when opening the website from chrome browser or any other browser, when continue navigating the website it takes no time at all. leaving the website for 10 minutes or so, and coming back, the issue happens again, and it takes 15 seconds again only once.
Digging deeper into the issue and after profiling of the performance, the most of the time taken is spend on the first time the app touches the database, for example, a very simple query:
model.Workflows.ToList();
Apparently connecting to the SQL server is taking the most of the time. 15 seconds for the first time is a lot of time to accept, I have never seen such a delay in any application.
the object graph is small its only 12 tables with very few records, even no records for some tables, for example, workflow table contains only 2 records. the relationships are complicated but not that much.
I have tried to connect without entity framework using SqlConnection class, and it takes 4 seconds for the first time also, it is much better but still there is something wrong.