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:
Thanks in advance,
Ali
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With