简体   繁体   English

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

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

I'm trying to write a simple load tester for one of our web services, which is served through IIS7. 我正在尝试为我们的一个Web服务编写一个简单的负载测试器,它通过IIS7提供服务。 I'm launching a load of threads (as Tasks) that call the web service as a Web Reference. 我正在启动一个线程加载(作为任务),将Web服务作为Web引用调用。

Despite the threads all starting, only 2 concurrent connections from the app can be handled by the web service. 尽管线程都已启动,但Web服务只能处理来自应用程序的2个并发连接。

I'm aware that by specification simultaneous connections are limited to 2 per user . 我知道通过规范,每个用户的同时连接数限制为2个 For the sake of this load tester, which I guess is one user, I would like to open many simultaneous connections. 为了这个负载测试器,我猜是一个用户, 我想打开许多同时连接。

I have tried to add the following to the web.config of the web service. 我试图将以下内容添加到Web服务的web.config中。

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

My setup is as follows: 我的设置如下:

The web service is located at http://devserver/MyWebServiceApp/MyWebService.asmx , where MyWebServiceApp is configured as an application. Web服务位于http://devserver/MyWebServiceApp/MyWebService.asmx ,其中MyWebServiceApp配置为应用程序。

The webmethod can be viewed as something trivial that simply waits for, say, 20 seconds before returning a response (making it easy to see that only 2 connections are open at any one time). webme方法可以看作是一些微不足道的东西,只需等待,比如说,在返回响应之前20秒(很容易看到任何时候只有2个连接打开)。

The simplest form of the load tester code is ass follows: 最简单的负载测试器代码形式如下:

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

I've tried pointing other load testing software (eg soapUI ) at the web service and have observed the same issue. 我已尝试在Web服务上指向其他负载测试软件(例如soapUI )并观察到相同的问题。

I would be grateful for any pointers as to how to increase this connection limit (for testing purposes). 对于如何增加此连接限制(用于测试目的)的任何指示,我将不胜感激。

Edits: 编辑:

  • I should add that the web service box is running Windows 2008 R2. 我应该补充说,Web服务盒运行的是Windows 2008 R2。
  • Also I have run SoapUI and my loadtester simultaneously and each is only able to request 2 connections each (ie 4 in total). 此外,我同时运行SoapUI和我的loadtester,每个只能请求2个连接(即总共4个)。

Thanks in advance, 提前致谢,

Ali 阿里

I found the answer here: Multiple concurrent WCF calls from single client to Service 我在这里找到了答案: 从单个客户端到服务的多个并发WCF调用

The problem was with my client, not the receiving service. 问题在于我的客户,而不是接收服务。 I needed to set System.Net.ServicePointManager.DefaultConnectionLimit with the initialization of the client. 我需要使用客户端的初始化设置System.Net.ServicePointManager.DefaultConnectionLimit

There is a system-wide TCP connection limit, basically this is in place to stop TCP using too many resources on your computer. 存在系统范围的TCP连接限制,基本上这是为了在计算机上使用太多资源来停止TCP。

Check here to see if this helps, but be careful as this requires some registry tweaking: http://smallvoid.com/article/winnt-tcpip-max-limit.html 检查这里是否有帮助,但要小心,因为这需要一些注册表调整: http//smallvoid.com/article/winnt-tcpip-max-limit.html

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

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