Why do my asp.net views take so long to render?

I’ve optimized my database queries with indexes and am caching output for 10 minutes at a time, but occasionally I have to recalculate the page, and it’s taking way longer than I like. Tools like firebug only show that the request spent a long time waiting on the server. What I really need is a tool to help me locate the bottleneck.

Enter Glimpse, an open-source tool to analyze load times end-to-end for C# asp.net applications. It times everything from javascript, web requests, controller actions, view rendering, database queries, ajax calls, and more.

2016-08-09 07_23_06-Window.png

This image shows that the total time to render the page was 478ms. Of that, 351ms was spent server-side, and 198ms of that was on rendering the view. That means not the database access, but compiling the cshtml with embedded C# at runtime.

How to reduce that render time? Precompile the views at build time!

Now that the views are precompiled, our page render time has dropped to 208ms, with only 72ms spent server side. At 208ms, page loads feel almost instant, which only happens when we have a cache miss once every ten minutes.
2016-08-09 07_30_02-Window.png

 
0
Kudos
 
0
Kudos

Now read this

A weekend with Google AutoML Beta

Some time ago I built a site called slackernews.io to take the top-rated submissions from HackerNews and categorize them into newspaper sections. In this way I could focus on the ones I care to read while blithely ignoring the sections I... Continue →