9

I have an MVC project, and I'm looking at speeding things up. One thing I'm scratching my head over is the BeginProcesRequest() which I have no control over. Using New Relic I found that this method is, on average consuming 90% of the time required for the transaction to complete.

The code in my controller is pretty simple. It has a look for an action session for the user and redirects to their dashboard if it finds one. there isn't any database calls on the actual page. The only written is:

if (Session["UserID"] != null)
// Perform actions

The BeginProcessRequest() method takes almost 4 seconds as you can see in the screenshot

enter image description here

This can't be something unique to my site? I'm using a small EC2 instance for the server, and although there are other applications running on the site the CPU and memory stay pretty much at 0 throughout the request.

EDIT - Reviewed the following post:

What happens in BeginProcessRequest()?

However as my application is idle when the most time consuming requests take place I can't see how it could be related to competing threads.

Community
  • 1
  • 1
Paul
  • 3,072
  • 6
  • 37
  • 58
  • possible duplicate of [What happens in BeginProcessRequest()?](http://stackoverflow.com/questions/17064380/what-happens-in-beginprocessrequest) – Rowan Freeman Mar 14 '14 at 05:28
  • @RowanFreeman, I saw this however my application is actually idle when the worst timeframes occur so I couldn't see how it would relate to competing threads. – Paul Mar 14 '14 at 05:33
  • Did you try the solutions listed just to see what happens? – Rowan Freeman Mar 14 '14 at 05:37
  • @Paul in your mvc app , have you implemented custom mvc handler to route requests ? – Vishal Sharma Mar 14 '14 at 05:39
  • @RowanFreeman, yes I removed all references to the session state in my application, have disabled the session state on my home controller and set the outputcache to be active for 1 day, yet it is still pretty slow especially when it's been inactive a while. This is particularly important as the main function of the website is an API, so I need it to be pretty responsive – Paul Mar 15 '14 at 04:56
  • @vishalsharma, no there is no custom route handler. In fact not even any custom routes defined. – Paul Mar 15 '14 at 04:57
  • I've just found this: http://stackoverflow.com/questions/17064380/what-happens-in-beginprocessrequest – daviddv Nov 03 '14 at 11:20

1 Answers1

1

I think the issue was with IIS, as after I changed the property of idle time-out in the application pool to be one day it now seems to load much faster on initial start.

I also explicitly disabled the session state on my home controller, and ensured that SQL Server's auto close parameter was set to off.

Paul
  • 3,072
  • 6
  • 37
  • 58