繁体   English   中英

增加IIS7中Web服务的最大并发连接数(负载测试)

[英]Increasing max concurrent connections for web service in IIS7 (load testing)

我正在尝试为我们的一个Web服务编写一个简单的负载测试器,它通过IIS7提供服务。 我正在启动一个线程加载(作为任务),将Web服务作为Web引用调用。

尽管线程都已启动,但Web服务只能处理来自应用程序的2个并发连接。

我知道通过规范,每个用户的同时连接数限制为2个 为了这个负载测试器,我猜是一个用户, 我想打开许多同时连接。

我试图将以下内容添加到Web服务的web.config中。

  <system.net>
    <connectionManagement>
      <add address="*" maxconnection="40"/>
    </connectionManagement>
  </system.net>

我的设置如下:

Web服务位于http://devserver/MyWebServiceApp/MyWebService.asmx ,其中MyWebServiceApp配置为应用程序。

webme方法可以看作是一些微不足道的东西,只需等待,比如说,在返回响应之前20秒(很容易看到任何时候只有2个连接打开)。

最简单的负载测试器代码形式如下:

Imports System.Threading.Tasks

Module SuperBasicLoadTester

    Sub Main()
        ThreadLauncher(10)
    End Sub

    Sub ThreadLauncher(ByVal numberOfThreads As Integer)
        Dim tasks(numberOfThreads - 1) As Task
        For index As Integer = 0 To numberOfThreads - 1
            tasks(index) = Task.Factory.StartNew(AddressOf SendRequest)
        Next
        Task.WaitAll(tasks)
    End Sub

    Sub SendRequest()
        Dim myWebServiceCaller As New MyWebService.ServiceMethods
        myWebServiceCaller.Url = "http://devserver/MyWebServiceApp/MyWebService.asmx"
        Dim response As String = myWebServiceCaller.MyWebServiceMethod("Some string passed to the web service method")
    End Sub

End Module

我已尝试在Web服务上指向其他负载测试软件(例如soapUI )并观察到相同的问题。

对于如何增加此连接限制(用于测试目的)的任何指示,我将不胜感激。

编辑:

  • 我应该补充说,Web服务盒运行的是Windows 2008 R2。
  • 此外,我同时运行SoapUI和我的loadtester,每个只能请求2个连接(即总共4个)。

提前致谢,

阿里

我在这里找到了答案: 从单个客户端到服务的多个并发WCF调用

问题在于我的客户,而不是接收服务。 我需要使用客户端的初始化设置System.Net.ServicePointManager.DefaultConnectionLimit

存在系统范围的TCP连接限制,基本上这是为了在计算机上使用太多资源来停止TCP。

检查这里是否有帮助,但要小心,因为这需要一些注册表调整: http//smallvoid.com/article/winnt-tcpip-max-limit.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM