0

I'm fairly knew to asp.net MVC4 and have created a large web application using EF6. The page I'm working with seems to take a long time to initially load, but speeds up after the first initial "cold" load.

Based off reading this, https://msdn.microsoft.com/en-us/data/hh949853.aspx I have been trying to improve performance even on the initial first "cold" load. However, if anyone has any other ideas on what I can do to improve the performance time that would be great, (I am on a time crunch).

The DB is fairly complex, and has lots of tables and relationships. I have stepped through while debugging, but a large chunk of the time is spent before my index function even gets hit in my controller, I am assuming this is because of Entity Framework mapping the DB? Any assistance on making the initial load time decrease would be great.

  • Also, the page I am working on is a modal popup that loads after a button click from the parent page. The parent page isn't part of the same project, I direct the user to it using showModalDialog("url") and then load my page. – naman bhansali Mar 12 '15 at 16:16
  • Do you tested this application on your remote server or just in localhost by debugging? – Márcio Gonzalez Mar 12 '15 at 16:17
  • Your assumption is incorrect. The website is being compiled on execution. –  Mar 12 '15 at 16:17
  • I test this application on the remote server, but when I debugged locally the same thing occurs. – naman bhansali Mar 12 '15 at 16:18

1 Answers1

1

In my experience, this problem was especially harmful in client-side database connecting applications (Windows Forms, WPF) in pre-EF6 applications, where the startup time is interesting. The warm up time seems to be exponential to model size (number of entities / relationships in a single ObjectContext/DbContext). I think the most significant improvements would be:

  • Follow this guide to create pregenerated views for your model.
  • Reduce model size, I'm assuming you have 100+ entities in the model. Split the model up into multiple models if possible (you will likely have to sever one or more strongly typed FK relationships). This greatly reduces the warm up time, however the development effort required is quite large.

Note that warm-up time is something that is likely less worthwhile to invest in for web applications, so long as the application doesnt get killed all the time.

Bas
  • 26,772
  • 8
  • 53
  • 86
  • Thanks for your help, we are working on pregenerated views and reducing the model size for further optimization! But for now playing with IIS settings (http://weblogs.asp.net/owscott/why-is-the-iis-default-app-pool-recycle-set-to-1740-minutes) and changing the idle time out made a drastic difference. Also just cleaning up overall code quality and taking out redundancy. – naman bhansali Mar 12 '15 at 21:20