1

In our project we use MVC4 + Umbraco7.2.8. On one of the pages we make around 25 calls to the server simultaneously, each call is full-fledged http get to controller's action which returns cshtml view. Then results are parsed and displayed on a single page. (We know that is wrong design and we are going to replace it with web api calls to get light weight json).

So the problem is that abovementioned process is very time consuming (no wonder, eh?) taking around 19-20 seconds to retrieve and display results of all the 25 calls. Seeking the way to improve performance without changing existing design I noticed that all of the returned view had a Layout page (Master Page), and after I placed all of the code from the Layout page into view and set Layout = null (without changing any functionality) I got dramatic performance boost. Now it takes around 2-3 seconds to accomplish all that 25 calls.

I put traces and I can see (when running with Layouts) that between last trace in the view and first trace in its Layout page is around 800ms gap (not always but often) so when removing Layouts we get rid of those slowdowns. But why is that? I read lots of info and forums and everybody says that using Layouts should have only very light performance impact since it has no more overhead than just calling a function. But my facts say just opposite: just getting rid of master pages we benefit gigantic performance boost. I tried that many times and results are always the same.

Can anybody explain why having/removing Layouts can influence performance so much and what can MVC engine (or Umbraco???) be doing so long while stitching view with its Layout ?

Yura Lutyj
  • 11
  • 2
  • are there any javascripts or such calls or 3rd party widgets. on your layout? – coder771 Dec 07 '15 at 12:41
  • no widgets, a lot of javascript, but delay is purely on the server, (I also looked through fiddler detailed statistic). What is to say more iis process is being loaded up to 80% while serving these calls. – Yura Lutyj Dec 07 '15 at 12:49
  • http://stackoverflow.com/questions/6172350/mysterious-asp-net-mvc-action-high-latency-issue – coder771 Dec 07 '15 at 12:52
  • have you minified css and javascripts – coder771 Dec 07 '15 at 12:54
  • @coder771 the problem was not exactly in loading css but your suggestion pushed me in right direction, the problem was that there were a few rooted layouts (included in each other) and the root layout Master was really heavy weight. So omitting it resolved the problem. – Yura Lutyj Dec 07 '15 at 15:45

0 Answers0