Web Garden Model

The Web garden model is configurable through the section of the machine.config file. Notice that the section is the only configuration section that cannot be placed in an application-specific web.config file. This means that the Web garden mode applies to all applications running on the machine.
Two attributes in the section affect the Web garden model. They are webGarden and cpuMask. The webGarden attribute takes a Boolean value that indicates whether or not multiple worker processes (one per each affinitized CPU) have to be used. The attribute is set to false by default. The cpuMask attribute has default value 1.
Web gardening enables multiple worker processes to run at the same time. However, you should note that all processes will have their own copy of application state, in-process session state, ASP.NET cache, static data, and all that is needed to run applications. When the Web garden mode is enabled, the ASP.NET ISAPI launches as many worker processes as there are CPUs, each a full clone of the next (and each affinitized with the corresponding CPU). To balance the workload, incoming requests are partitioned among running processes in a round-robin manner. Worker processes get recycled as in the single processor case.
When you enable a web-garden in IIS6.0, It creates multiple w3wp.exe to service that application pool. Each w3wp.exe process has it's own memory, threads etc.

Web gardening has some side effects that you should be aware of:

1. If your application uses session state, it must choose an out-of-process provider (NT Service or SQL).
2. Application state and application statics are per process, not per computer.
3. Caching is per process, not per computer.


1 comment:

Anonymous said...

Nice article. Can you elaborate on the consequences of the side effects you list at the end?

If caching is per process and not per computer (by that I assume you mean the servers not the clients making requests) is the effect to double the cache usage for a dual cpu system and quadruple the cache usage on a 4 cpu system?