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