user1140479
user1140479

Reputation:

MVC so slow on server

I have made a website. Locally it works fine, no problems at all. But when I publish it to the server (VPS) it runs terribly slow. It takes almost 37 seconds for the homepage to load. While locally it takes like 400 ms.

I have no idea what to do because I tried a lot:

It became faster local. From 900 ms to 350 ms.

But on the server nothing seems to help. So I turned to the server.

For web application:

Server settings:

But then I noticed was that IIS Worker Process was using almost 1.7 GB memory, % of the memory and I was like "... What? Why?". Later I saw it was using 2.7 GB.

I installed Glimpse on the web application. But I cannot find out what the problem could be.

Some information of the techniques I use in the project:

VPS information:

I can't think of any other information to give. So, if I missed something, just ask. If you want to check if out: Website is http://www.zatyscorner.com. I try to optimize the start page first so see what is happening.

Hopefully, someone can help me out.

Upvotes: 0

Views: 1901

Answers (2)

user1140479
user1140479

Reputation:

Okay, so back at programming-school I was taught that you have to do a few things when there are performance issues: Check the server, check the code and.... Check the queries...

Well, in this case, the queries to SQL were the bad guys. I had one query that took 7700 records (give or take), took 10 from those and showed it... Yeah, that will cause a timeout and enormous amount of memory... Especially when 3 people are doing it at the same time.

Problem fixed! I am rebuilding most queries now with Dapper and I make sure the good amount of records are returned.

Feeling like a noob :(

Upvotes: 3

Shahbaz
Shahbaz

Reputation: 392

I think changing the Application Pool's Identity to LocalSystem can help, check out this answer here.

I will also suggest you to enable output caching on your IIS if you haven't done yet. Enable it for all image files i.e. .png,.jpg, etc., .css files, html and cshtml files and js files too. Here is how you can do it

Upvotes: 0

Related Questions