2

I am using StackExchange.MiniProfiler with the MVC and EntityFramework add-ons to try and track down a long TTFB that reliably occurs for one type of request on our web site. As you can see in the image at bottom, the duration indicated for this request is 504.3ms. I believe this corresponds to the time between the call to MiniProfiler.Start in BeginRequest and the call to MiniProfiler.End in EndRequest (minus the time of the children steps). Using browser tools I can see that the TTFB for this request corresponds with the data from MiniProfiler, so I believe MiniProfiler is accurate. I have been adding profiler steps around more and more code and think everything is wrapped now, yet they don't add up to anything near 504ms.

This request is an ajax request that happens on a page with a few other request going on at the same time. If I take the url out and hit it from the same browser in isolation, the duration and TTFB is only ~100ms. This would seem to imply something from one of the other requests is blocking this one, but I don't think we have anything that should be blocking at all, and certainly not that long, none of the other requests take that long.

The site is running as a mid level Azure App Service, could this be some sort of limitation there? How could I confirm or deny that? Any MiniProfiler tricks that might expose more data here?

MiniProfiler Output

jackmott
  • 1,112
  • 8
  • 16
  • 1
    Do you have similar with the time offset data? i.e. the "more columns" view and the "from start" column? – Marc Gravell Jul 01 '16 at 13:16
  • Aha, immediately I see why that is helpful, thanks! – jackmott Jul 01 '16 at 13:24
  • I've updated the image with the more columns and irrelevant steps pulled out. Looks like the delay is somewhere between `Application_PostAuthenticateRequest` and `FormsAuthSessionEnforcement.OnAcquire` time to go study up on lifecycles – jackmott Jul 01 '16 at 13:29
  • aye, that's pretty much what I would have to do next, to be honest - the "Redirect User Non-Authenticated User" bit - is that one of your own timings? if so, what is the entry point to that? – Marc Gravell Jul 01 '16 at 13:34
  • Yeah the redirect looks suspicious but it is just poorly named, no redirect is happening. I'll probably be able to figure it out from here. Thanks! – jackmott Jul 01 '16 at 13:41
  • I'm 99% sure this is the root cause: http://stackoverflow.com/questions/3629709/i-just-discovered-why-all-asp-net-websites-are-slow-and-i-am-trying-to-work-out – jackmott Jul 01 '16 at 14:32

1 Answers1

0

The issue was related to this SO question here: I just discovered why all ASP.Net websites are slow, and I am trying to work out what to do about it

Session states get locked, so if you have a bunch of simultaneous requests from one browser/session, they can end up all waiting on each other. Specifying some of our relevant controllers as readonly with an attribute made the bad all go away: [SessionState(SessionStateBehavior.ReadOnly)]

Community
  • 1
  • 1
jackmott
  • 1,112
  • 8
  • 16