IIS上下文中的Threadpool [英] Threadpool in IIS context

查看:172
本文介绍了IIS上下文中的Threadpool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IIS上的Web应用程序中运行时,我有一个关于System.Threading.Threadpool的一般性问题。
假设我们有两个请求同时执行,我们通过ThreadPool.QueueUserWorkItem方法启动几个线程。这两个请求是否共享ThreadPool,或者两个请求对ThreadPool的调用是否会在两个独立的池中运行?

I have a general question about System.Threading.Threadpool when run in a webapplication on IIS. Say we have 2 requests execute at once, and we fire up a couple of threads through the ThreadPool.QueueUserWorkItem method. Will the two requests share the ThreadPool, or will the calls to the ThreadPool from the two requests operate in a two separate pools?

这是在IIS6和7中。

This is in IIS6 and 7.

感谢您的任何见解。

推荐答案

以下是来自MSDN的报价有关 ThreadPool类的文档:

Here is a quote from the MSDN documentation about the ThreadPool class:


每个进程有一个线程池。
线程池的默认大小为
每个可用的
处理器250个工作线程,以及1000个I / O完成
个线程。

在IIS6和IIS7中,任何给定的ASP.NET应用程序都通过应用程序池基础结构托管在单个进程( w3wp.exe )中。
应用程序池可以通过将多个Web应用程序保存在不同的AppDomain中来托管它们,但它可以在服务器上的一个物理进程内运行。


这两个事实在实践中意味着来自正在运行的Web应用程序实例的所有线程都在同一个.NET线程池中执行。

In IIS6 and IIS7 any given ASP.NET application is hosted inside of a single process (w3wp.exe) through the Application Pool infrastructure.
An Application Pool can host multiple web applications by keeping them in different AppDomains, but it runs inside of one physical process on the server.

These two facts mean in practice that all threads from a running web application instance execute inside the same .NET Thread Pool.

这篇关于IIS上下文中的Threadpool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆