I am wondering how concurrency works in a web application. I have read several articles, and as far as I know, several instances of HttpApplication will work simultaneously. Now I created a simple web application for testing concurrency and placed the following in global.asax:
protected void Application_BeginRequest(object sender, EventArgs e)
{
Response.Write("Request started: " + DateTime.Now);
System.Threading.Thread.Sleep(10000);
Response.Write("<br />");
Response.Write("Request ended: " + DateTime.Now);
Response.End();
}
I expected that if I go to the root of the web application on several browser tabs almost simultaneously, they will start and stop at the same time. However, it seems they do not. The start time of the second tab is the same as the first end time. Then I tested the same code in httpmodule or default.aspx page_load and got the same result.
What's going on here? Why are concurrent requests not running?
Edit: I put my understanding mainly in two articles:
http://msdn.microsoft.com/en-us/magazine/cc188942.aspx : " , , , HttpApplication."
http://www.code-magazine.com/article.aspx?quickid=0511061&page=5 aspx, , , " , ". Thread.Sleep
, -... ?
http://www.code-magazine.com/article.aspx?quickid=0511061&page=5