IIS delays a lot between each response with asynchronous requests

I have an ASP.NET MVC project running on my developer's machine with Windows 7 ultimate and iis 7.5.

I do the following:

var requests = ["http://myserver.com/news/details/113834", "http://myserver.com/tag/details?ids=113834&entityType=23", "http://myserver.com/publish/details?ids=113834&entityType=23", "http://myserver.com/generalproperty/details?ids=113834&entityType=23", "http://myserver.com/category/details?ids=113834&entityType=23"]; var f = new Date().getTime(); $.each(requests, function(k,v) { $.ajax({ url :v, async : true, type :'get', success : function(data) { console.log(new Date().getTime() -f ); }}); }) 

Then I get the following results (approximately) 12, 521, 1025, 1550, 2067 async result http://martinhansen.no/hostedimages/async.PNG

If I switch async to false, I get: 14,32,49,58,68 synchronization result http://martinhansen.no/hostedimages/sync.PNG

It seems that the requests are in the queue, and after a while it responds only every 500 seconds. I made my controllers return empty text instead of calling the database, so not the database.

Is there a limitation on IIS 7.5 for Windows 7? Can I change the setting? I suspect the maximum number of simultaneous requests per user or something like that. And then it β€œpunishes” you, responding only every 500 ms. So that people do not use it as a real server.

Likely? And is there a way to avoid this?

+7
source share
2 answers

This has nothing to do with IIS apperantly or IIS in Windows 7, I also tried it on a test server and in the same results.

It is because of the restrictions imposed by sessionstate, see the "Parallel Queries and Session State" section below: http://msdn.microsoft.com/en-us/library/ms178581.aspx

However, if two simultaneous requests are made for the same session (using the same SessionID value), the first request gets exclusive access to the session information. The second request is executed only after the completion of the first request.

But I still do not understand why it will not burn the next request immediately after the first, it would seem, completed. This seems like a very fake 500 ms delay.

I came up with this question How to set LOCK timeout for reading and writing in ASP.NET SessionState , which talks about lock time for session state.

System.Web.SessionState.SessionStateModule.LOCKED_ITEM_POLLING_INTERVAL = 500

This is the magic number I searched in my code and in interwebs for .. 500! I knew it had to be somewhere.

Anyway, to fix this, I added a sessionstate attribute to my read-only controllers

 [SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)] public class BaseController : Controller{} 

More on this:

http://afana.me/post/session-less-controllers-and-TempData-ASPNET-MVC.aspx

http://weblogs.asp.net/imranbaloch/archive/2010/07/10/concurrent-requests-in-asp-net-mvc.aspx

I still think something is wrong, but why would the previous request not tell the system that it no longer needs a session lock to complete the next request?

+8
source

How many requests do you send at one time? IIS on client OSs is limited to 10 concurrent connections . Above this limit, he puts the incoming connection into the queue and processes it when the slot opens.

It has been a long time in the efforts of MS to ensure that client operating systems are not used to prohibit the sale of their platforms on the server.

0
source

All Articles