Application Pool and Worker process

Application Pool and Worker process

One worker process can serve only one application pool. Application pool can contain more than one web applications. You can't serve the application pool with two different version of worker process. However, you can add multiple worker processes of same version in application pool. Here version of worker process means asp.net runtime version like 2.0 or 4.0. In IIS 6.0 you can assign 4000000 worker process to server your Application Pool.
To know how many worker processes are presently serving your application pool, you can open command prompt and

Execute command IISapp.Vbs

It will tell information about  W3Wp process  and its process ID.

e.g.

C:\Documents and Settings\Administrator>iisapp

W3WP.exe PID: 30736   AppPoolId: ReportServer

W3WP.exe PID: 12348   AppPoolId: ReportServer

Note*: If you are using In proc session storage mechanism and you are adding multiple worker process to your application pool,
          You will definitely loose session values. To avoid this use SQL server or state server for storing session state. 
          This way session values will get shared across all worker process.

By default when you deploy your web application on IIS, it assigns default application pool which has only one worker process.

image
Fig.1.

As shown in Fig.1. above. You can see virtual directory samsung, motorola and nokia
are mounted on Application pool #1 and all requests coming to those websites are
served by default worker process 1. In this scenario if worker process 1 becomes
unhealthy, the entire website of application pool #1 goes offline or down.

WebGarden Scenario:

Add multiple worker process to your application pool and see magical performance boost in your web application.

image 
Fig.2.

As you can see in Fig.2. The Application Pool #1 has virtual directory named samsung
and it is served by worker process 1 and 2.
Also, Application pool #2 has virtual directory called motorola and it is served by
worker process 3 and 4.

In this scenario if worker process of application pool #2 becomes unhealthy the website http://mysite.com/samsung will not go down or offline and vice versa.

Even you can add multiple website in either Application pool #1 or #2.

Note: In web gardening scenario you must store the session out of process using
SQL serer or state server otherwise you will loose the session values during subsequent
requests.

There are two types of process model in Asp.net. The one is Proacive and other is Reactive recycling.

http://revenmerchantservices.com/post/aspnet-process-model.aspx

You need to find out wheter to proactively recycle the process or let it be reactive.
In proactive process recycling, you can let the process recycle after getting predefined number of requests to
your web application. It will prevent your system from getting crashed. During recycling of the process
system generates new instances of worker process to serve the new incoming requests and old requests which are in
queue or process get served by old worker processes. As soon as old requests ends the system kills the old instances
of worker processes.

Satalaj.

 

 

Connection PoolingRestart IIS or recycle application poolIt is an error to use a section registered as allowDefinition3dMachineToApplication beyond application level This error can be caused by a virtual directory not being configured as an application in IISAsp.net process modelSessions In AspnetTransaction (Process ID) was deadlocked on lock resources with another process and has been chosen as the deadlock victim Rerun the transactionHigh performance aspnet applicationBest Android ApplicationsSession application viewstateAsp.net Interview Questions for 2 years or 3 years experianceAndroid install APK from computer application

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.