views:

49

answers:

1

I wrote a test page that does a bunch of busy work in a method called at page load. This process as I have it now takes around 12 seconds.

If I try to load another page while the first long running page is loading, this second page doing nothing except writing out a hello world, it doesn't load until the first long running page is finished.

Why is this the case? I would think IIS would be able to handle multiple concurrent connections, it seems crazy that one long running page would stop every other page in the application from loading. I must be missing something or not understand how IIS works.

I would think multiple independent requests would be spawned on different threads. Is this only the case if the requests are from different sessions entirely? Are all requests from a single session bound to a single thread?

bd

+1  A: 

It's a threading problem. While IIS can handle multiple connections simultaneously, ASP.NET, by default, is configured in single-threaded mode.

This choice by Microsoft was to prevent dummy developers to make common concurrency mistakes. ASP.NET for Mono doesn't show this behaviour and if you access shared resources without prior locking you might be... f... you know ;) by a yellow page of death.

I don't remember the exact procedure, but in the properties of your website you can choose the application pool and also the number of threads. I saw with my eyes that IIS6 sets it to 1 by default.

If you can't find it, tell me and tomorrow I'll take a look on my development server in lab.

Hope to have been of help.

djechelon
I looked over IIS 6 and 7 but couldn't find a threat count attribute, just an entry for number of processes. I did some research and it seems you can configure threading using a couple .config files but I'm not sure that solves my issue as the default value for threads per process is like 10-40.
BrooklynDev
Adding threads does solve your problem. Try adding processes and see if it works the same...
djechelon
But the thing is the default value for threads per process is not 1. So it's not the total number of threads per process that's the problem. For some reason multiple requests act as if they are being handled on the same thread, that's the problem. I wonder why that is. Are all requests of a single session processed on 1 and only one thread? Not knowing more about how IIS works under the hood this seems like my best guess as to what's going on. Adding processes 'web garden' is a different feature entirely, and would require me to store session out of process and is way overkill for a simple app
BrooklynDev