1
votes

Good day!

I've found interesting behaviour for both LAMP stack and ASP.NET.

The scenario:

There is page performing task in 2-3 minutes (making HttpWebRequest for ASP.NET and curl for PHP). While this page is processed all other requests to this virtual host from the same browser are not processed (even if I use different browsers from one machine). I use two pages written in PHP and C#.

I've tested with Apache+PHP in both mod_php and fast_cgi modes on Windows and Debian. For ASP.NET I use IIS6 (with dedicated app pool for this site and with default app pool) and IIS7 in integrated mode.

I know that it is better to use async calls for such things, but I'm just curious why single page blocks the entire site and not only the thread processing the request?

Thanks in advance!

5

5 Answers

1
votes

It seems you open standard php session that is open until end of request. That means session file is locked. Use session_write_close() soon as possible if you don't need session data already.

0
votes

I don't think it's blocking the site; I would suspect that the open connection is blocking the client from making more requests. Have you proven that other machines can't use the site while your long-running request is in progress?

0
votes

If you only see a single request coming to the app the only thing I can think of is a global lock somewhere in the pipeline.

The lock can be explicit (you wrote the lock statement) or implicit. If you can see several requests - it can be due to the thread pool exhaustion.

Keep in mind that in addition to the cap on the number of threads used to process incoming web requests there is a separate cap on the number of simultaneous outgoing web requests through HttpWebRequest and by default this limit is very low - if I remember correctly 2 per CPU. I do not remember the name of the setting in the web.config, but will try to look it up.

In any case posting code would give us a better chance to assist you

0
votes

I've definitely noticed this behavior while debugging ASP.NET applications, but I have always just assumed it was a debug config issue. Are you building everything in release mode and have debugging turned off in your web.config?

0
votes

ASP.NET applications have a global session lock.

Use EnableSessionState="ReadOnly" for WebForms or [SessionState(SessionStateBehavior.ReadOnly)] for MVC. It will prevent the lock (of course you can't write anything to a read-only session).

I just discovered why all ASP.Net websites are slow, and I am trying to work out what to do about it