7

I'm doing some tracing in NewRelic, and I'm seeing almost every single request contains a call to 'System.Web.Mvc.MvcHandler.ProcessAsyncRequest()'.

This function call can take anywhere from 300ms up to 100s (seriously, 100s). I tried to search msdn documentation, but there's nothing on http://msdn.microsoft.com/en-us/library/system.web.mvc.mvchandler.aspx

clearly, something is lying to me here.

I have a few theories as to why this is taking so long:

  • type inference? I'm using structuremap.

  • server resource issues?

  • .net version incompatibility of some sort?

  • asp.net mvc incomopatibility of some sort?

Environment:

.net 4

asp.net mvc 3

dedicated vm

Oren Mazor
  • 4,437
  • 2
  • 29
  • 28
  • I see you already asked [here](http://stackoverflow.com/questions/6861434/what-is-this-method-system-web-mvc-mvchandler-processasyncrequest)... – Ry- Nov 29 '11 at 00:45
  • Yes but that question was abandoned and I wasnt sure the user will ever look at it. Already my reasking what is essentially the same problem has resulted in more activity! :) – Oren Mazor Nov 29 '11 at 01:20
  • I know - but posting the link here allows answers to go to that question. Then your question can be closed as a duplicate. Yay! :D (Sounds somewhat morbid, now that I'm typing it...) – Ry- Nov 29 '11 at 01:24
  • Definitely morbid. I don't care where the answers go, as long as answers get figured out. Installing some fancy expensive tracer tools now... – Oren Mazor Nov 29 '11 at 01:29
  • What environment are you seeing this behaviour on? Shared host? Dedicated Server? What version of MVC? What version of .NET? – Trent Scholl Nov 29 '11 at 08:37

3 Answers3

4

When I found this issue, I thought the same as @garfbradaz and looked through the MVC source. It was interesting, as I found no reference to the ProcessAsyncRequest method.

Hence, I decided it might be something New Relic were injecting, or as you say, a red herring and something is lying to us! I switched New Relic off, and got in touch with their support team.

Today, after a few emails from an extremely responsive and courteous member of the New Relic team, they got back to me and confirmed it's a bug (of sorts). Here is their response:

ProcessAsyncRequest is a custom name that we use for any metric being recorded that is not / does not inherit from "System.Web.UI.Page." Given that MVC view engine uses "System.Web.Mvc.ViewPage" all of those metrics will incorrectly fall under the New Relic moniker of "ProcessAsyncRequest."

I will be working on a modification to the agent and the core instrumentation that will hopefully aggregate these metrics appropriately. I am sorry for the confusion and trouble this has caused you.

I'll give you an update as I get close to a solution.

EDIT: Further response from New Relic below - looks like they have a fix in place.

I just pushed a commit that will help us better classify the transactions coming from the installed agent.

As far as the performance issue we did discover an issue reported by the awesome engineers at AppHarbor that was causing TypeLoadExceptions which might be related to slow loading / compiling code being put into the cache. We have found the cause and are in the final testing phases of that fix and we are hoping to get the fix in the next release of the agent.

Nick from New Relic was excellent in responding to this and their product has been really useful, so I don't have any bad feelings, just thought I'd share the details here.

Very happy to find out there are no ghosts in my MVC app anyway!

For now my advice to anyone having these problems is switch off New Relic until their next release.

EDIT 2: Nick from New Relic emailed me today - their latest agent (version 2.0.9.15) - is now available and should fix this issue.

dazbradbury
  • 5,729
  • 5
  • 34
  • 38
  • awesome! I've actually gotten busy improving performance elsewhere and haven't had a chance to get back to this. good job following it up. – Oren Mazor May 15 '12 at 18:29
  • @dazbradbury I have latest agent version 2.10.40.0 and still most of my bottlenecks are System.Web.Mvc.MvcHandler.BeginProcessRequest() – Korayem Aug 28 '13 at 14:19
  • @Korayem Have you emailed the New Relic team? Might be worth linking to this post so they can re-look at the issue in case it's popped up again. I moved away from New Relic after this, but keen to give them another go when fixed. – dazbradbury Aug 29 '13 at 10:35
2

Have you tried downloading the MVC Source Code, the MVC3 code can be found here:

http://aspnet.codeplex.com/releases/view/58781

Have a did around and debug your site to see whats doing on - and kindly report back! :)

garfbradaz
  • 3,424
  • 7
  • 43
  • 70
  • Looking at the source, there is no method: `ProcessAsyncRequest` in the MvcHandler class. Seems a little odd. Is this something specific to New Relic perhaps? – dazbradbury Apr 19 '12 at 15:36
1

Have you tried installing Glimpse via Nuget and watching the request?

Hanselman has blogged about it

Ryand.Johnson
  • 1,906
  • 2
  • 16
  • 22
  • 1
    Going through with dottrace seems to suggest this may be a structure map issue. Which I can believe would cause a performance hit, but it doesn't change te fact I don't use async controllers. – Oren Mazor Nov 29 '11 at 22:01