Note that there are some explanatory texts on larger screens.

plurals
  1. POIIS, Asp.NET pipeline and concurrency
    text
    copied!<p>I'm wondering how the concurrency in a web application actually works. Ive read several articles and to my understanding multiple instances of HttpApplication would be working at the same time. Now, I created a simple web app to test concurrency and put the following to global.asax:</p> <pre><code>protected void Application_BeginRequest(object sender, EventArgs e) { Response.Write("Request started: " + DateTime.Now); System.Threading.Thread.Sleep(10000); Response.Write("&lt;br /&gt;"); Response.Write("Request ended: " + DateTime.Now); Response.End(); } </code></pre> <p>I was expecting that if I browse to the web app root in several browser tabs at nearly the same time, they would start and stop concurrently. However, it seems that they don't. Second tab start time is same as first time end time. I then tested by having this same code in an httpmodule or default.aspx page_load and got the same result.</p> <p>What is going on here? Why aren't the requests being served parallel?</p> <p><strong>Edit:</strong> I'm placing my understanding mainly to two articles:</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/cc188942.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc188942.aspx</a> says "If multiple requests targeting the same application arrive simultaneously, multiple HttpApplication objects will be used."</p> <p>and <a href="http://www.code-magazine.com/article.aspx?quickid=0511061&amp;page=5" rel="nofollow noreferrer">http://www.code-magazine.com/article.aspx?quickid=0511061&amp;page=5</a> has an example for an aspx page doing basically what I tested, with comment "Simulate slow request so we can see multiple requests side by side." next to Thread.Sleep call</p> <p>It is possible that I'm completely misunderstanding something... but what?</p> <p><a href="http://www.code-magazine.com/article.aspx?quickid=0511061&amp;page=5" rel="nofollow noreferrer">http://www.code-magazine.com/article.aspx?quickid=0511061&amp;page=5</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload