What is the relationship between application pools and workflow threads?

I am trying to eliminate reboots in an ASP.NET application. The application restarts about 20 times a day. We strongly suspect one part of the application, because the restart began when this feature appeared during production. I added some entries to these pages using the log4net library, but I have problems interpreting the logs.

When an ASP.NET application is running in the application pool, is only one instance of this application running, or will multiple instances of this application be running? I know that several workflows will be created. What is the relationship between workflow threads and applications running in the application pool?

I think that I cannot correctly interpret the results if there are several applications that register in the same journal. If one of them reboots and the other does not, the logs don’t tell me much about what happens when you restart.

UPDATE 1

Looking at this page , I find the following information:

An application pool defines a group of one or more workflows configured with common settings that serve requests for one or more applications that are assigned to this application pool. Because application pools allow a set of web applications to share one or more of the same configured workflows, they provide a convenient way to isolate a set of web applications from other web applications on a server. Process boundaries share each workflow; therefore, application problems in one application pool do not affect websites or applications in other application pools.

But I'm still confused. From experience, I know that I can designate two completely different applications to use the same application pool. Does this mean that exactly two work processes will be generated? Or can there be several workflows spawned for the first application and several workflows spawned for the second application? If the problem occurs in one workflow, can it remove all applications running in this application pool?

UPDATE 2

From this page about using WinDbg, I found this information (my highlight):

In IIS 5.x, there is only one Aspnet_wp.exe worker process and one debugger thread. Therefore, only one debugger can be attached to the Aspnet_wp.exe process at a time. This can be a problem if you are dealing with multiple web applications on the same computer. In IIS 6.0, you can force AppDomain to run in a separate application pool. (For more information, see “IIS 5.x Process Model” and “IIS 6.0 Process Model” in Chapter 1.) Separate application pools provide several W3wp.exe processes. They create several threads of the process debugger (one in each), which allows you to debug more efficiently.

It sounds as if each application pool receives one w3wp.exe process. Am I interpreting this right? And if so, does it apply in IIS 7.5?

+6
source share
1 answer

Yes, each application pool typically represents one process 1 but may contain multiple threads. You can assign several nodes to the application pool, and these sites will work under the same process, however they will work under different "application domains", which are security contexts that separate the code of one site from another, re works in the same application pool.

Two users who click on the site at the same time can work on different threads, which means that they can be launched simultaneously. This means that any log can have interspersed values. You might want to add a session value for logging so that you can sort based on the session.

Restarting the application pool (processing) is normal; 20 restarts per day do not seem unusual. They can run several times a day, and IIS - when restarting application pools. He does this every time he thinks he needs to empty the pool. 2 Your applications should be written in such a way as to gracefully recover from this (i.e. do not keep anything in the session, which is not easy to recreate if the application pool is restarted).

The application pool can also reload when an unhandled exception occurs in the application. In this case, you want to decide the reason for this. Such exceptions are usually recorded in the event log.


1 - Although you can configure the application pool for several workflows (this is called Web Garden ), this is not a typical (and not recommended) configuration in my experience.

2 - Note that using IIS Manager, you can configure the application to log events in the Windows event log. You can also use IIS Manager to set a threshold when several different types of repeat events occur.

+11
source

Source: https://habr.com/ru/post/948554/


All Articles