Search code examples
ajaxasp.net-mvcperformanceninject

Webapp getting slower with multiple ajax request


I'm using ninject with an asp.net MVC5 application and I experiment weird performance behavior only with stacked ajax requests.

Looking to optimize the poor performance of a particular page, I placed a stopwatch between the Application_BeginRequest and Application_EndRequest (let's call it A) and one inside the called method in the controller (let's call it B).

The results are a consistent if I make std http requests (page call) the measurement made by A and B are quite in the same magnitude.

Problem: I display a page with 10 tables, feed by Ajax request. The 4 first requests shows normal behavior (A and B times are respectively 100ms and 80ms) while the 6 other show catastrophic performances: B stays around 80ms while A take up to 10 second.

Is there anythin I can do to avoid such a disturbance, preferably on the server side of the application?

Do not hesitate to ask any information about the setup, I'll be glad to complete the question


Solution

  • It seems that the SessionState was the culprit here, setting it to ReadOnly using [SessionState(SessionStateBehavior.ReadOnly)] drastically improved the performances of the Ajax requests.