Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I'm launching a load of threads (as Tasks) that call the web service as a Web Reference.

Despite the threads all starting, only 2 concurrent connections from the app can be handled by the web service.

I'm aware that by specification simultaneous connections are limited to 2 per user. 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.

  <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.

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).

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 (e.g. soapUI) at the web service and have observed the same issue.

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.
  • Also I have run SoapUI and my loadtester simultaneously and each is only able to request 2 connections each (i.e. 4 in total).

Thanks in advance,

Ali

like image 970
alergy Avatar asked Mar 29 '12 11:03

alergy


2 Answers

I found the answer here: Multiple concurrent WCF calls from single client to Service

The problem was with my client, not the receiving service. I needed to set System.Net.ServicePointManager.DefaultConnectionLimit with the initialization of the client.

like image 158
alergy Avatar answered Nov 14 '22 20:11

alergy


There is a system-wide TCP connection limit, basically this is in place to stop TCP using too many resources on your computer.

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

like image 34
Matthew Abbott Avatar answered Nov 14 '22 20:11

Matthew Abbott