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

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

问题描述

当在 IIS 上的 web 应用程序中运行时,我有一个关于 System.Threading.Threadpool 的一般问题.假设我们一次执行了 2 个请求,并且我们通过 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 应用程序通过将它们保存在不同的 AppDomains 中,但它在服务器上的一个物理进程内运行.

这两个事实实际上意味着来自正在运行的 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 上下文中的线程池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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