I try to run stress tests with WCF service. Stress test emulates scenario 'many concurrent users perform one request to service'. I use self-hosted WCF service, basicHttpBinding and ssl support.
On this test I found that there are problems with performance. The reason of these problems was that service does not close connections so the number of open connections constantly increase (I use netstat -n to count open connections). I tried to disable keep-alive property but it did not helped. Any ideas, what can be the problem?
Here it is server configuration:
<system.serviceModel>
<services>
<service
name="WorkerService"
behaviorConfiguration="SecureBehavior">
<endpoint
address=""
binding="customBinding"
bindingConfiguration="BasicHttpSSLWithoutKeepAliveBinding"
contract="IWorkerService"
/>
<host>
<baseAddresses>
<add baseAddress="https://localhost/service" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SecureBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="BasicHttpSSLWithoutKeepAliveBinding">
<textMessageEncoding />
<httpsTransport allowCookies="false"
keepAliveEnabled="false"/>
</binding>
</customBinding>
</bindings>
</system.serviceModel>
Here is small script to count open connections:
@echo off
setlocal enabledelayedexpansion
:loop
set lc=0
for /f "usebackq delims=_" %%i in (`netstat -n`) do (
set /a lc=!lc! + 1
)
echo %lc%
ping -n 2 -w 1000 127.0.0.1 > nul
goto loop
endlocal