“Web garden” can be configured by using process model settings in “machine.config” or “Web.config” file. The configuration section is named <process Model> and is shown in The following example. The process model is enabled by default (enable=”true”). Below is the snippet from config file.
From the above process model section for web garden, we are concerned with only two attributes “web garden” and “cpuMask”.
Web Garden: - Controls CPU affinity. True indicates that processes should be affinities to the corresponding CPU. The default is False.
CpuMask:- Specifies which processors on a multiprocessor server are eligible to run ASP.NET processes. The cpuMask value specifies a bit pattern that indicates the CPUs eligible to run ASP.NET threads. ASP.NET launches one worker process for each eligible CPU. If web Garden is set to false, cpuMask is ignored and only one worker process will run regardless of the number of processors in the machine. If web Garden is set to true, ASP.NET launches one worker process for each CPU that corresponds to a set bit in cpuMask. The default value of cpuMask is 0xffffffff.
Below are detail steps of how to implement web garden
• Click Start and then click Run.
• Type calc.exe and then click OK.
• Go to View menu, click Scientific.
• Go to View menu, click Binary.
• Use zero and one to specify the processors ASP.NET can or cannot use.
Use one for the processor that you want to use for ASP.NET. Use 0 for the processor that you do not want to use for ASP.NET. For example, if you want to use the first two processors for ASP.NET of a four-processor computer, type 1100.
• On the View menu, click Decimal. Note the decimal number.
• Open the Web.config or machine.config file in a text editor such as Notepad. The Web.config file is located in the folder where the application is saved.
• In the Web.config file, add the process Model configuration element under the System. Web element. Before adding <process Model> to Web.config file, the user has to make sure that the allow Definition attribute in the <process Model> section of the Web.config file is set to everywhere.
• Add and then set the web Garden attribute of the process Model element to True.
• Add and then set the cpuMask attribute of the process Model element to the result that is determined in your calculation.
Do not preface the number with zerox because the result of the calculation is a decimal number. The following example demonstrates the process Model element that is configured to enable only the first two processors of a four-processor computer.
Save the Web.config file. The ASP.NET application automatically restarts and uses only the specified processors.
Asked In: Many Interviews |