IIS Pools Interview Questions Worker Processes

Best 21 IIS Pools Interview Questions Including Worker Processes

THE TABLE OF CONTENTS

1) What Is an Application Pool?

2) What Is Private Memory of Application Pool?

3) What Is Shared Application Pool?

4) What Is Dedicated Application Pool?

5) What Is the Best Practice? Should I create an Application Pool for each application OR share an Application Pool with numbers of applications?

6) How do I determine memory requirement of website?

7) How do I configure “Website Panel” to automatically assign dedicated application pool when website is being created?

8) Why Add additional application pools in IIS?

9) How multiple child web applications with separate app pools in IIS?

10) What Are Pros and Cons of having dedicated application pools over keeping web applications in one default app pool?

11) What Is the advantage of increasing “maximum worker processes” in IIS?

12) How multiple worker process in single Application pool IIS?

13) ASP.NET session state and multiple worker processes?

14) Which Are the protocols that IIS supports?

15) What Is a virtual directory?

16) What Are the log files?

17) What Are Kernel Mode and User Mode in IIS?

18) What Is the Internet Information Service (IIS)?

19) What Is the DefaultAppPool in IIS?

20) What Is the purpose of App pool recycling in IIS?

21) What Is the ApplicationHost.config in IIS?

 

1) What is an Application Pool?

Application pool is a collection of one or more websites running as a single process called w3wp.exe with a single identity.

Application pools provide encapsulation among hosted web applications so that any applications that are running outside a given application pool cannot affect the applications in the application pool. You can have multiple websites running under a single application pool, but you cannot have a single website running in multiple application pools.

 

2) What is Private Memory of 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 to consume more memory than assigned limit. Default application pools have private memory of 0 KB, means there is no limit. According to your server resources, you can run as many websites as you wish under default application pool.

In case of dedicated application pool, certain amount of private memory is assigned. For example, If you allocate 250 MB of memory to a website, it cannot use private memory more than 250 MB. If this application attempts to occupy more than 250 MB RAM, application pool will get automatically recycled. Additionally, website with 250 MB private memory only takes 100 MB while running, its 150 MB memory can be utilized to serve other websites.

 

3) What is Shared Application Pool?

An Application pool is denoted as Shared, if there are several web applications/websites running under the same application pool.

The primary reason to combine websites into application pools was to conserve server memory. As we discussed earlier, each application pool is an instance of W3WP.EXE worker process for a single website or number of websites.

If you set single application pool to 20 websites, for all of them only one W3WP.EXE process will be created. On a contrary, if all 20 website have separate application pools, 20 W3WP.EXE processes are created. Hence, there's a large memory overhead to run number of w3wp.exe processes.

By running several websites on shared application, you can conserve significant amount of RAM and other resources as well.

Shared application pool has significant benefit of sharing the server resources. Therefore, If you have no specific reason for splitting them up, it's better to keep them together.

 

4) What is 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 with other websites having separate application pool. Isolating websites over application pools allow more rigid security between the applications, as well as preventing one website from crashing if another one does. Dedicated application pools have following advantages over shared application pool:

Advantages:

1.     You can assign resource-intensive websites separate application pools so that the performance of other applications does not decrease.

2.     If an application in one application pool fails, applications in other application pools are not affected.

3.     By isolating applications, you reduce the chance that one application will access the resources of another application.

4.     You can have different application pool settings for different applications.

5.     You can run untrusted and third party applications in a very restrictive environment so they do not get un authorised access to other applications.

6.     The event when you need to recycle the Application Pool, you can do so for only one site without affecting the performance of the others.

Disadvantages:

1.     Each application pool will have has its own private memory along with its own processes. Therefore, it will consume more server resources especially memory.

 

5) What is the Best Practice? Should I create an Application Pool for each application OR share an Application Pool with numbers of applications?

It really depends on the number of websites, server resource, type of web application and website requirements. When several applications run inside the same application pool they have the same resource and same security level. Therefore, if one website starts having issues, it could cause frequent application pool recycles that could impact all other. To be in safe side, 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:

1.     If your web application is important, assign separate application pool.

2.     If your web application is third party application and you are uncertain about its code, definitely separate application pool.

3.     If your application is resource-intensive and creating major resource Spikes, separate application pool.

 

6) How do I determine memory requirement of website?

At first place, you should have web server with the enough resources. Now, give the application an above-average amount of memory and monitor it for a few days, under normal usage.

This will give you better estimate of the resource requirements of this application. Now, decrease the application memory gradually. Meanwhile, continue measuring the impact of the changes. Determine lowest amount of memory at which your Website gives the optimal performance. This specific memory amount is memory requirement of your application.

 

7) How do I configure WebsitePanel to automatically assign dedicated application pool when website is being created?

8) Why add additional application pools in IIS?

1.     AppPools can run as different identities, so you can restrict permissions this way.

2.     You can assign a different identity to each app pool so that when you run task manager, you know which w3wp.exe is which.

3.     You can recycle/restart one app pool without affecting the sites that are running in different app pools.

4.     If you have a website that has a memory leak or generally misbehaves, you can place it in an app pool so it doesn't affect the other web sites

5.     If you have a website that is very CPU-intensive (like resizing photos, for instance), you can place it in its own app pool and throttle its CPU utilization

6.     If you have multiple websites that each has their own SQL database, you can use active directory authentication instead of storing usernames/passwords in web.config

 

9) How multiple child web applications with separate app pools in iis?

A performance is something subjective and that one you should measure yourself. By placing each application in a separate pool, you ensure that potential problems with one application do not cause problems with other applications. On another hand, each application pool is an instance of w3wp.exe, therefore to serve more pools you need more RAM. So, it's a trade-off between security and hardware restrictions.

"Child" app pools are isolated from "root" pools and every application that has its own application pool, doesn't inherit any other application pool. If root and child applications have different configuration or root application is mission-critical and child applications might have problems (such as memory leaks) then it makes sence to use dedicated application pools, otherwise you could consider to use a shared pool for all.

 

10) What are pros and cons of having dedicated application pools over keeping web applications in one default app pool?

Pros:

1.     Applications are isolated from each other, unless IIS goes with it, an app pool locking will only take out applications in that pool

2.     Ability to run applications under different ASP.NET runtimes, one pool for 1.1 another for 2.0 if needed

3.     Ability to have different app pool settings for more or less critical applications

4.     For example a corporate website in ASP.NET might want to have the shut down after __ minutes of inactivity bumped up, to prevent unloading because response is critical. Other sites might not need it.

5.     Can secure pools from each other in regards to file access, great for third party, or untrusted applications as they can run under a very restrictive user account.

Cons:

1.     Each application pool has its own bank of memory and its own process, therefore CAN use more resources

2.     Some find it hard to debug the application as you have multiple processes

The primary reason for combining sites in app pools is to conserve memory. There's a large memory overhead in running several w3wp.exe processes. If you have no specific reason for splitting them up, it's better to keep them together.

 

11) What is the advantage of increasing “maximum worker processes” in IIS?

The only real advantage of increasing the number of worker processes is if you've got some long running process that's blocking the other threads from running - in which case you might want to consider adding another Worker Process.

However, as you've found this basically spools up another instance of w3wp.exe with its own memory space that doesn't share in-process information between them, so you need to ensure you're set up for session sharing (Machine Key has been set, session is stored in a database or Session Service, etc.). A better option would be looking to see if you can offload the long running process to a separate process altogether.

 

12) How multiple worker process in single Application pool IIS?

The worker processes are specific to each application pool. If you specify one application pool to have 1 worker process it will have only 1 worker process. If you specify another application pool to have 2 worker processes it will have 2 worker processes. You should notice that the properties screen is specific to an app pool.

You can see which application pools are using which worker processes using the following process;

o   Start > Run > Cmd

o   Go To Windows > System32

o   Run cscript iisapp.vbs

o   You will get the list of Running Worker ProcessID and the Application Pool Name.

You should see that if one of your app pools is set to use 2 worker processes it will have two entries in the list against the same app pool name.

13) ASP.NET session state and multiple worker processes?

Worker processes are a way of segmenting the execution of your website across multiple exe's. You do this for a couple of reasons, one if one of the workers gets clobbered by run time issues it doesn't take the others down. For example, if a html request comes in that causes the process to run off into nothing then only the other requests that are being handled by that one worker processor get killed. Another example is that one request could cause blocking against the other threads handled by the same worker.

 As far as how many you need, do some load testing. Hit the app hard and see what happens with only one. Then add some more to it and hit it again. At some point you'll reach a point of truly saturating the machines network, disk, cpu, and ram. That's when you know you have the right balance.

Incidentally, you can control the number of threads used per worker process via the machine.config file. I believe the key is maxWorkerThreads.

 

Now, beware, if you use session, Session state is not shared between worker processes. I generally recommend avoiding sessions anyway but it is something to consider. For all intents and purposes you might consider each worker process as its own separate web server. Except they are running on the same box.

 

Problem for Managing Session State with multiple Worker Processes:

Having multiple worker processes and using InProc does not seem to be compatible.

If you enable Web-garden mode by setting the webGarden attribute to true in the processModel element of the application's Web.config file, do not use InProc session state mode. If you do, data loss can occur if different requests for the same session are served by different worker processes.

 

More than one worker process is a "web garden." In-process session state will not work correctly. You'll need to use either a single worker process for your web app, or use a session state server, or SQL Server for session state.

 

You probably don't want to turn on WebGardening (Multiple Worker Processes), oftentimes it causes more harm than good, especially with .NET apps. By default, Session in .NET is stored "InProc" meaning In Process. If you are setting up WebGarden (Multiple Proc on one Box) or WebFarm (Multiple Servers) then you need some way to handle Session. With WebFarm, one technique used is called Sticky Sessions where the device doing the routing (Load Balancer) will route the same user to the same server each time. With WebGardens, there is no "stick session". Other techniques for handling this issue is by storing Session State Out of Process for which there are many ways to do that.

 

InProc session is the fastest, common, and default mechanism, it has a lot of limitations:

                 We can't use it in web garden (multiple worker processes) scenarios

                 InProc session mode is not suitable for web farm scenarios.

14) Which Are the protocols that IIS supports?

The protocols that IIS supports include HTTP/HTTPS, FTP, FTPS, and SMTP, etc.

 

15) What Is a virtual directory?

It is the name of a directory, which is mapped to a physical directory in a local server.

 

16) What Are the log files?

Log files record different actions on a server, which includes the date, time, IP address, and volume of transmitted data.

 

17) What Are Kernel Mode and User Mode in IIS?

The Kernel Mode and User Mode are the two main layers of IIS architecture.

 

18) What Is the Internet Information Service (IIS)?

The IIS is a web server from Microsoft, which is used to host websites and web applications on the web. It is the most used HTTP server in the world, which runs on Windows.

 

19) What Is the DefaultAppPool in IIS?

It is the name of the default application pool in IIS.

 

20) What Is the purpose of App pool recycling in IIS?

The main purpose of App pool recycling is to free up the memory, which is consumed by the applications in an app pool.

 

21) What Is the ApplicationHost.config in IIS?

It is the root file of the configuration system, which consists of the following:

 

1.     Applications

2.     Definitions of all sites

3.     Global defaults for the webserver setting

4.     Virtual directories and application pools


ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.
^