IIS7 线程是如何分配的?

How are IIS7 threads assigned?(IIS7 线程是如何分配的?)

本文介绍了IIS7 线程是如何分配的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 log4net 添加到我的应用程序中,现在可以在用户浏览我的网站时查看用户活动的线程 ID.是否有任何特定的算法来处理 IIS7 的线程分配,或者它只是一个随机数分配(我怀疑它不是完全随机的,因为我的低流量站点显示线程主要在 10-30 范围内)?可用线程数是否有最大值?而且我注意到我的调度程序出现了一个奇怪的线程 id——这有什么原因吗?调度器是 Quartz.net,id 显示为Scheduler_Worker-10",而不仅仅是一个数字.

I added log4net to my application and can now see the thread Ids of user activities as they navigate through my website. Is there any specific algorithm to how threads assignment happens with IIS7, or is it just a random number assignment (I suspect it's not completely random because my low traffic site show threads mostly in the range 10-30)? Any maximum to the number of threads available? And I notice that my scheduler shows up with a weird threads id -- any reason for this? The scheduler is Quartz.net and the id shows as "Scheduler_Worker-10", and not just a number.

推荐答案

这解释了你需要知道的一切.

This explains all you need to know.

摘录:

当 ASP.NET 托管在 IIS 7.0 中时集成模式,线程的使用是有点不同.首先,应用程序级队列已不复存在.他们的表现总是真的糟糕,没有希望解决这个问题,所以我们摆脱了他们.但也许最大的不同是在 IIS6.0,或者ISAPI模式,ASP.NET限制并发线程数执行请求,但在 IIS 7.0 中集成模式,ASP.NET 限制并发执行数要求.区别只在乎当请求是异步的(请求要么有异步处理程序或模块管道完成异步).显然,如果请求是同步的,那么并发执行数请求的数量相同并发执行的线程请求,但如果请求是异步然后这两个数字可以完全不同请求比线程多得多.

When ASP.NET is hosted on IIS 7.0 in integrated mode, the use of threads is a bit different. First of all, the application-level queues are no more. Their performance was always really bad, there was no hope in fixing this, and so we got rid of them. But perhaps the biggest difference is that in IIS 6.0, or ISAPI mode, ASP.NET restricts the number of threads concurrently executing requests, but in IIS 7.0 integrated mode, ASP.NET restricts the number of concurrently executing requests. The difference only matters when the requests are asynchronous (the request either has an asynchronous handler or a module in the pipeline completes asynchronously). Obviously if the reqeusts are synchronous, then the number of concurrently executing requests is the same as the number of threads concurrently executing requests, but if the requests are asynchronous then these two numbers can be quite different as you could have far more reqeusts than threads.

所以基本上,如果请求是同步的,每个请求的线程数相同.请参阅此处了解各种参数.

So basically, if requests are synchronous, the same number of threads per request. See here for various parameters.

这篇关于IIS7 线程是如何分配的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:IIS7 线程是如何分配的?