Search code examples
performanceasp.net-mvc-3controllermvc-mini-profiler

MVC-Mini Profiler vs DotTrace inconsistancies


I've been trying to find a bottleneck, that I believe is within our controllers (I suspect out Unity IoC).

From using the MVC-Mini-Profiler, I've found a method that takes 500ms to do the simplest task.

However after tracing into this using DotTracer - it only appears to be taking 16ms to execute the thread...

Anybody come across this before?

Just to note - Debug mode is set to false in Web.Config

DotTracer

Mini Profiler


Solution

  • I have discovered the solution to this issue - It turns out that it was all session related.

    Because I was simultaneously firing off 4 HTTP requests to the same server, the session object was being locked each time, thus forcing my requests to be queued up and dealt with once the session object was unlocked.

    Adding:

    [SessionState(SessionStateBehavior.Disabled)]
    

    to the controller as an attribute forces MVC2 upwards to become sessionless and thus increases the performance ten-fold

    (Answer taken from:

    Why would multiple simultaneous AJAX calls to the same ASP.NET MVC action cause the browser to block?)