Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beginner's Profiling Qn - ASP .NET MVC + Mini-Profiler + Chrome Developer Tools

enter image description here

Two sections highlighted above.


1st - Mini-Profiler telling me how much time execution of a Controller/Action is taking (called via ajax)

87ms


2nd - Chrome Web Inspector telling me how much time the same ajax request is taking to complete

535 ms


Using glimpse, I figured that execution of the other lifecycle events (base controller / filters) took ~22ms.

Looking for guidance to figure out where the rest of the time is going.

Thanks.


Edit

This is almost consistent (variance is ~10 - 20 ms in both values - Mini-Profiler's and Chrome Inspector's).

These results are for an online request against a production server (VPS) running IIS 7.5. When these numbers are measured on a dev machine (localhost running IIS express), difference in Mini-Profiler and Chrome Inspector results isn't as significant.

like image 659
Sameet Avatar asked Oct 07 '22 14:10

Sameet


1 Answers

Since these requests are against an online resource you need to account for the latency.

For example take this:

image

Server time is merely 118ms, however the dns lookup takes 598ms, connecting takes another 205ms and the response only comes back +1173ms after I visited the page. Finally the DOM only starts rendering 1.27 seconds in.

The server bits only account for time spent on the server inside your app.

You must add to that.

  1. Time it takes to resolve dns.
  2. Time it takes to connect (if no keepalive is in place)

[waiting time]

  1. Time it takes to send the TCP packet asking for the resource
  2. Overhead on the web server / proxy front end
  3. Server time (the bright red number)
  4. Time it takes for the first TCP packet to find its way back to you.

[/waiting time]

  1. Time it takes the rest of the packets to find the way back to you. (read about TCP congestion windows)
  2. Time it takes the browser to parse the stuff it gets back
  3. Time it takes it render

(and then there is the interdependency of JavaScript and CSS that I am not going to touch on here)

like image 63
Sam Saffron Avatar answered Oct 10 '22 02:10

Sam Saffron