+1  A: 

Your application receives multiple requests at a time. Based on your edits and comments here you are looking for information on Web Gardens and sessions, as opposed to threads and session state.

Web Gardens use multiple processes and act like a load balancer when it comes to session state. Each process will have a separate in memory session store. IIS will send requests to any available process. Since the processes do not share session state then session usage will only really work if your session provider is shared between all the web garden processes.

Web Gardens only make sense if you use something like SQL Server for session state, and want to have affinity with a particular CPU/core. Since you can increase the number of threads this may be a more appropriate optimization for some users than using web gardens. However some applications may perform better with web gardens due to a particular work load or application characteristic. Use of web gardens in testing could also help work out some potential issues present under load balancing.

I believe it uses the .NET ThreadPool and has 20 threads by default. The each request coming into the server may be handled on a separate thread. The ASP.NET performance guidelines have some information on this topic.

BrianLy
Doesn't this create a problem with the in memory session though? As far as I know the sessions need to stay on the same thread or everything blows up.
Alex
I don't see why threads would be linked to sessions. The Session ID should be enough to lookup the session data so there would be no reason need to map to the same thread. Session data is stored separately even if it is 'in memory'. The same APIs are used to plug in the other session providers.
BrianLy
Alex
It's the right information but you are not really understanding the nuances here. Processes are different beasts from threads. Web Gardens start multiple processes but IIS maps every request through. This pretty much simulates a load-balanced environment. Hence the processes have separate session state but the end user could end up hitting either process on the next request.
BrianLy
+1 thanks for the explanation Brian. Does it make sense to have web gardens then on one server? When one could just increase the worker THREAD count of the single IIS process?
Alex
I added some info on situations for web gardens. It's hard to think of reasons. Most people tend to ignore them since they could make performance worse, or they are scared of session problems with off-the-shelf applications that they don't want to test fully.
BrianLy
A: 

In memory sessions means you should typically only have one front-end web server at a time, not a single worker thread :D

The reason being that any information stored in session on one machine is not available on the other. If you have two front-end web servers and your proxy or firewall does "load-balancing" whereby it will randomly assign requests to web servers, then you will have problems. That said, the problem is easily solved with so called "sticky sessions" where users are always sent to the same server.

-Oisin

x0n
Follow Up: Why can't you enable 'web garden' processing on your machine then across multiple CPU on one server? This causes random session loss.
Alex
My understanding is that a web garden creates multiple processes on a machine. Each process will have a different session state store.
BrianLy