What is an Application Pool?
An application pool is a collection of one or more websites running a single process called w3wp.exe with a single identity.
Application pools provide encapsulation among hosted web applications so that any applications running outside a given pool cannot affect the applications in the pool.
You can have multiple websites running under a single application pool, but you cannot have a single website running in multiple application pools.
What is the Private Memory of the Application Pool?
Private memory is the maximum amount of memory (in KB) a worker process can consume before causing an application pool to recycle.
Private Memory restricts web applications from consuming more memory than the assigned limit. Default application pools have private memory of 0 KB, which means there is no limit. Therefore, according to your server resources, you can run as many websites as you wish under the default application pool.
In the case of a Dedicated Application Pool, a certain amount of private memory is assigned. For example, if you allocate 250 MB of memory to a website, it cannot use personal memory of more than 250 MB. Therefore, if this application attempts to occupy more than 250 MB of RAM, the application pool will get automatically recycled. Additionally, a website with 250 MB of private memory takes 100 MB while running; its 150 MB can serve other websites.
What is Shared Application Pool?
An Application Pool is denoted as 'shared' if several web applications/ websites run under the same application pool.
The primary reason for combining websites into application pools was to conserve server memory. As we discussed earlier, each application pool is an instance of the w3wp.exe worker process for a single website or a number of websites.
If you set a single application pool to 20 websites, for all of them, only one w3wp.exe process will be created. On the contrary, if all 20 websites have separate application pools, 20 w3wp.exe processes are completed. Hence, there's a large memory overhead to run a number of w3wp.exe processes.
You can conserve a significant amount of RAM and other resources by running several websites on a shared application.
A Shared Application Pool has the significant benefit of sharing the server resources. Therefore, keeping them together is better if you have no specific reason for splitting them up.
What is a Dedicated Application Pool?
An application pool is said to be 'dedicated' if each web application has its own application pool.
In other words, each website is isolated from others with a separate application pool. Isolating websites over application pools allows more rigid security between the applications and prevents one website from crashing if another one does.
Dedicated Application Pools have the following advantages over Shared Application Pools –
- You can assign resource-intensive websites separate application pools so that the performance of other applications does not decrease.
- If an application in one application pool fails, other applications are not affected.
- By isolating applications, you reduce the probability that one application will access the resources of another application.
- You can have different application pool settings for different applications.
- You can run 'untrusted' and third-party applications in a very restrictive environment so they do not get unauthorized access to other applications.
- If you need to recycle the application pool, you can do so for only one site without affecting the performance of the others.
- Each application pool will have its own private memory along with its processes. Therefore, it will consume more server resources, especially memory.
What is the Best Practice?
Should I create an Application Pool for each application?
Should I Share an Application Pool with the number of applications?
It depends on the number of websites, server resources, type of web application, and website requirements. When several applications run inside the same application pool, they have the same resources and security level. Therefore, if one website starts having issues, it could cause frequent application pool recycles that could impact all others.
To be safe, you can assign one application pool per website. Although, it's not necessary in all cases.
Following are some of the things you can consider –
- If your web application is essential, assign a separate application pool.
- If your web application is a third-party application and you are uncertain about its code, you must definitely separate the application pool.
- If your application is resource-intensive and creating significant resource spikes, separate the application pool.
How do I determine the memory requirement of the website?
First, you should have a web server with enough resources. Now, give the application an above-average amount of memory and monitor it for a few days under normal usage. This will provide you with a better estimate of the resource requirements of this application.
Then decrease the application memory gradually. Meanwhile, continue measuring the impact of the changes.
Determine the lowest amount of memory at which your website gives the Optimal performance. This specific memory amount is a memory requirement of your application.
How do I configure WebsitePanel to automatically assign a dedicated application pool when creating the website?
Please follow our step-by-step guide here.
→ Looking to change the application pool of your website?
Please refer to the Change IIS application pool article for more details.