goalie35
goalie35

Reputation: 786

MVC page loading very slowly. How can I pinpoint the issue?

I have a very basic MVC page. All it does is reads the url the user is using, pulls the subdomain from the url, compares that subdomain against some values in a database, & then redirects to another page. But it's loading very slow. About 30 seconds. There's very little to my code. It has something to do with what's loading ahead of time.

You can try the link here to see for yourself

In my tests, it takes about 30 seconds to load initially. If I try it multiple times, it's fine. It's just that 1st load. In my debugging, I experience the same problem. It's something during loading because the slowdown happens before I hit my 1st line of code.

How can I determine where the issue's coming from? I do see visual studio 2015 loaded a TON of DLL's into my MVC project when I created it, many of which I'm not using. Could this be the culprit? Here are most of them:

enter image description here

Upvotes: 0

Views: 2212

Answers (3)

MStew
MStew

Reputation: 1275

It looks like your pictures are what's slowing you down (campus background, graduate viewbook, etc.). These get cached locally and that's why you only experience the slowness on the initial load. Can you make these images smaller?

Upvotes: 0

Andrei Dragotoniu
Andrei Dragotoniu

Reputation: 6345

You can definitely get rid of some of those references.

There is one thing to keep in mind though.

The first time you run your website the code will be compiled, files copied over to the ASP.Net Temporary Folder ( 32 or 64 bit version ). This part will always introduce a delay.

When you run the website for real, as in from a proper server and IIS, the same thing will happen, the first request takes a bit of time to load. Subsequent calls will be instant as all the files are available, until there is a gap in usage. If your website is not used for a period of 20 minutes, let's say, the first request after that will again take some time.

You can speed up the bits which are within your control, like the size of the page, how many libraries you're loading, how big they are, images etc. There are online tools around which will give you an indication of where to look. YSLow is such a tool.

Upvotes: 2

Benjsoft
Benjsoft

Reputation: 177

For better performance, if you are only using Razor as your view engine, then remove the WebForms view engine.

See this article http://www.dotnet-tricks.com/Tutorial/mvc/aDN4031112-Removing-the-Web-Form-View-Engine-for-better-performance-of-Razor-View-Engine.html

Upvotes: 0

Related Questions