IIS7集成管道:maxConcurrentRequestsPerCPU和requestsQueueLimit设置之间的交互

发布于 2024-10-12 23:55:04 字数 988 浏览 8 评论 0原文

首先,这里对 IIS7 HTTP 请求生命周期以及影响性能的各种设置进行了很好的概述:

IIS 7.0 和 6.0 上的 ASP.NET 线程使用

非常具体,在 dotNet 4 中,默认值是ma​​xConcurrentRequestsPerCPUrequestsQueueLimit 设置为 5000。例如相当于:(在 aspnet.config 中):

<system.web>
   <applicationPool 
      maxConcurrentRequestsPerCPU="5000" 
      maxConcurrentThreadsPerCPU="0" 
      requestQueueLimit="5000" /> (** see note below)
</system.web>

在我看来,在多 CPU/核心服务器上,这里的 requestQueueLimit 将始终在“perCPU”限制之前调用。因此,如果每个 CPU 最多 5000 个请求是您实际想要的,那么我预计 requestQueueLimit 需要增加到 5000 * CPUCount 或完全禁用。

我的解释正确吗?如果是这样我可以禁用 requestQueueLimit 吗? (将其设置为零?)。有关此设置的文档似乎没有解决这个问题(所以也许我遗漏了某些内容或误读了?)

**上述文章的旁注:requestQueueLimit 的命名很糟糕。它实际上限制了 ASP.NET 可以同时处理的最大请求数。这包括排队的请求和正在执行的请求。如果“当前请求”性能计数器超过 requestQueueLimit,新传入请求将被拒绝,并显示 503 状态代码)

Firstly there's a great overview of the IIS7 HTTP request lifecycle and various settings that affect performance here:

ASP.NET Thread Usage on IIS 7.0 and 6.0

Very specifically though, in dotNet 4 the defaults for maxConcurrentRequestsPerCPU and requestsQueueLimit are set to 5000. E.g. equivalent to: (in aspnet.config):

<system.web>
   <applicationPool 
      maxConcurrentRequestsPerCPU="5000" 
      maxConcurrentThreadsPerCPU="0" 
      requestQueueLimit="5000" /> (** see note below)
</system.web>

Seems to me that on a multi-CPU/core server the requestQueueLimit here will always be invoked well berfore the 'perCPU' limit. Thus, if a max of 5000 requests per CPU is what you actually want then I would expect that the requestQueueLimit needs to be increased to 5000 * CPUCount or just disabled altogether.

Is my interpretation correct? If so can I disable requestQueueLimit? (set it to zero?). The documentation on this setting doesn't appear to address this question (so maybe I'm missing something or misreading?)

** side note from the above article: The requestQueueLimit is poorly named. It actually limits the maximum number of requests that can be serviced by ASP.NET concurrently. This includes both requests that are queued and requests that are executing. If the "Requests Current" performance counter exceeds requestQueueLimit, new incoming requests will be rejected with a 503 status code)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

树深时见影 2024-10-19 23:55:04

***我的解释正确吗?

是的,如果您想同时执行超过 5000 个请求,则需要增加 requestQueueLimit。 requestQueueLimit 限制系统中的请求总数。由于其遗留问题,它实际上是系统中的请求总数,而不是某个队列中的请求数。它的目标是防止服务器由于物理内存、虚拟内存不足等原因而崩溃。当达到限制时,传入的请求将收到快速的 503“服务器太忙”响应。顺便说一句,系统中当前的请求数由“ASP.NET\Requests Current”性能计数器公开。

***我可以禁用 requestQueueLimit 吗? (将其设置为零?)

您可以通过将其设置为较大的值(例如 50000)来有效地禁用它。您必须在 aspnet.config 文件中设置该值我怀疑您的服务器是否可以处理 50000 个并发请求,但如果是这样,则将其加倍。将其设置为零不会禁用它......奇怪的是,这意味着不能同时执行多个请求。

顺便说一下,v4 好像有一个 bug。对于集成模式,只有在 aspnet.config 文件中按照 所述进行配置时,它才会成功读取 requestQueueLimit 的值在 MSDN 上。由于某种原因,当我不久前尝试时,v4 没有从 machine.config 中读取它。

***Is my interpretation correct?

Yes, if you want to execute more than 5000 requests concurrently, you'll need to increase the requestQueueLimit. The requestQueueLimit restricts the total number of requests in the system. Due to its legacy, it is actually the total number of requests in the system, and not the number of requests in some queue. It's goal is to prevent the server from toppling over due to lack of physical memory, virtual memory, etc. When the limit is reached, incoming requests will receive a quick 503 "Server Too Busy" response. By the way, the current number of requests in the system is exposed by the "ASP.NET\Requests Current" performance counter.

***can I disable requestQueueLimit? (set it to zero?)

You can effectively disable it by setting it to a large value, like 50000. You must set the value in the aspnet.config fileI doubt your server can handle 50000 concurrent requests, but if so, then double that. Setting it to zero will not disable it...oddly, it means no more than one request can execute concurrently.

By the way, it looks like there is a bug in v4. For integrated mode, it only successfully reads the value of requestQueueLimit if it is configured in the aspnet.config file as described on MSDN. For some reason, v4 was not reading it from machine.config when I experimented with it a little bit ago.

浅笑轻吟梦一曲 2024-10-19 23:55:04

您可能需要检查应用程序的源代码。 IIS 调谐器是一个开源应用程序,可优化 IIS 设置以获得更好的性能。另一方面,页面可能对您的问题有用。

You might want to check this application's source code. IIS tuner is an open source application which optimizes IIS settings for better performance. On the other hand this page could be useful for your questions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文