Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is MvcHandler.BeginProcessRequest() so slow?

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.

like image 514
Paul Avatar asked Mar 14 '14 05:03

Paul


1 Answers

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.

like image 84
Paul Avatar answered Sep 21 '22 08:09

Paul