本文介绍了从IIS 6升级到8.5:并发请求增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将Web服务器从Windows Server 2003升级到Windows Server 2012 R2.有问题的Web应用程序可在ASP.NET 4.0上运行.该Web应用程序又与第三方Web API进行通信.

We upgraded our web server from Windows Server 2003 to Windows Server 2012 R2. The web application in question runs against ASP.NET 4.0. The web application in turn communicates with a third-party Web API.

升级后不久,Web API延迟增加,从而导致明显的超时.我怀疑在IIS 8.5上,允许的并发请求数增加了,导致Web API无法处理的吞吐量增加了.但是:

Shortly after the upgrade, the Web API latency increased, which in turn lead to notable timeouts. I suspected that on IIS 8.5, the number of allowed concurrent requests increased, causing an increase in throughput that the Web API was unable to handle. However:

    IIS 6没有限制并发请求的数量.帮助文件显示为:您可以配置Internet信息服务(IIS),以允许无限数量的并发连接,或限制该网站接受的连接数量.目前,我们将此设置为无限.
  • IIS 6和IIS 8.5都使用ASP.NET 4,它也具有限制并发请求数的功能.这两个IIS版本都在 machine.config 文件中设置为自动配置.由于两台服务器具有相同的处理器和RAM配置,因此它们应该使用相同的设置.
  • IIS 6 isn't limiting the number of concurrent requests. The help file reads: You can configure Internet Information Services (IIS) to allow an unlimited number of concurrent connections, or to limit the number of connections it accepts for this Web site. We currently have this set to unlimited.
  • Both IIS 6 and IIS 8.5 are using ASP.NET 4 which also has the ability to limit the number of concurrent requests. Both IIS versions are set to auto-config in the machine.config file; since both servers have the same processor and RAM configuration, they should be using the same settings.

当我们回滚升级时,延迟下降了不久.不太可能是巧合,因此在所有其他内容保持不变的情况下,Windows 2012 R2或IIS 8.5必须具有某些内在因素,这些因素会影响Web API.第三方Web API开发人员确认,他们的空间没有任何变化,很遗憾,我没有任何其他信息可以收集.

When we rolled back the upgrade, the latency shortly after dropped. Unlikely a coincidence, so with everything else remaining the same, there must be something intrinsic about Windows 2012 R2 or IIS 8.5 that's affecting the Web API. The 3rd party Web API developers confirmed that nothing had changed in their space, and unfortunately there isn't any additional information that I can gather.

我检查了版本6和8.5的IIS日志:每秒,分钟和小时的平均(和中位数)请求表明在IIS 8.5上有更多的请求正在处理(我使用Log Parser Studio分析日志) .但是,没有任何迹象表明应该是这种情况.有没有人有见识或建议?如果有控制此设置,那么现在我希望Web应用程序在Windows Server 2003和2012 R2上具有相同的行为.

I checked the IIS logs for both version 6 and 8.5: the average (and median) requests per second, minute, and hour indicate there were more requests being processed on IIS 8.5 (I used Log Parser Studio to analyse the logs). However, there is nothing to indicate that this should be the case. Does anyone have any insight or suggestions? If there are settings controlling this, then for now I'd like the web application to behave in the same on Windows Server 2003 and 2012 R2.

推荐答案

由于每个新请求都是在线程池中的新工作线程上处理的,因此我查询了线程池限制以验证自动配置的设置是否匹配(aspx文件):

Since each new request is processed on a new worker thread from the thread pool, I queried the thread pool limits to verify that the auto-configured settings match (aspx file):

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Threading" %>
<html>
  <body>
    <div>
    <%
      int workers;
      int io;
      ThreadPool.GetMaxThreads(out workers, out io);
    %>
    The maximum number of worker threads is <%=workers.ToString()%> and
    the maximum number of IO threads is <%=io.ToString()%>
    </div>
  </body>
</html>

结果如下(虚拟机具有2个内核):

The results are as follows (the virtual machine had 2 cores):

  • 在Windows Sever 2003上,运行IIS 6:200个工作程序和200个I/O线程限制
  • 在Windows Server 2012 R2上,运行IIS 8.5:32767工作程序和1000个I/O线程限制

这意味着较新的设置可以同时处理更多请求.

This implies that the newer setup is able to handle more requests concurrently.

这篇关于从IIS 6升级到8.5:并发请求增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 15:38