Willy
Willy

Reputation: 10638

MaxWorkerThreads vs App Pool Worker Processes: What's the difference?

As far as I know one can improve ASP.NET applications performance published on IIS through different methods:

  1. Web Garden: using more than 1 worker process for App Pool.
  2. Web farm: having more than one machine serving an instance of the same application
  3. Tweaking ASP.NET web.config file

... and maybe others I do not know ...

Option 1 and 2 require complex data structures to be serialized and also session state mode to be set to either State Server or SQL Server (InProc mode is not compatible and it does not work)

I want to focus in options 1 and 3:

Regarding to web garden (option 1), we set more than 1 worker process for an application Pool and we must set state server or sql server as session state mode.

In option 3, we tweak web.config file as explained here by setting parameters such as maxWorkerThreads.

Now a lot of questions come to my mind....

I am not be able to distiguish what's the differnce between setting more than 1 worker process for App Pool in option 1 and setting maxWorkerThreads > 1 in option 3.

  1. In option 1 you have more than 1 worker process available for attending incoming requests and in option 3 instead you have many threads available for attending incoming requests so what's the difference?
  2. Worker processes = threads?
  3. Do worker processes for the application Pool (option 1, case #worker processes > 1) work and behave in the same way as if we have many threads (option 3, case #maxWorkerThreads > 1)?
  4. Are processes in option 1 the same as threads in option 3?
  5. Furthermore, in option 3, how it works when you have 1 worker process for an application pool but you set maxWorkerThreads > 1 in web.config file? Is not the same scenario as in option 1?
  6. Also, can I use InProc session state mode with option 3?

Upvotes: 2

Views: 4042

Answers (1)

Brando Zhang
Brando Zhang

Reputation: 27987

In option 1 you have more than 1 worker process available for attending incoming requests and in option 3 instead you have many threads available for attending incoming requests so what's the difference?

As far as I know, the worker process is the max number of the w3wp.exe processes which the IIS could start.

The number of the maxWorkerThreadsis the number of the threads which the worker process w3wp.exe could use.

If you set in machine.config and has a value of 20 for .Net, it means each of the w3wp process can initiate a maximum of 20 worker threads.

Worker processes = threads?

No, worker processes means the w3wp.exe volume.

Do worker processes for the application Pool (option 1, case #worker processes > 1) work and behave in the same way as if we have many threads (option 3, case #maxWorkerThreads > 1)?

No

Are processes in option 1 the same as threads in option 3?

No, there are differernt things.

Furthermore, in option 3, how it works when you have 1 worker process for an application pool but you set maxWorkerThreads > 1 in web.config file? Is not the same scenario as in option 1?

Firstly, the maxWorkerThreads should be set in the machine.config, we couldn't set it through web.cofnig.

MaxWorkerThreads is used to limit the maximum number of worker threads, if you set it to 1, it means only one thread will work for each w3wp.exe process.

Also, can I use InProc session state mode with option 3?

Sure, you could use it.

Upvotes: 1

Related Questions