3

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
Tony
  • 16,527
  • 15
  • 80
  • 134
Sergey
  • 171
  • 1
  • 1
  • 14
  • You need to close the connection. See this question on SO: http://stackoverflow.com/questions/1400010/closing-wcf-connection/1400102#1400102 – Lawrence Oct 24 '13 at 11:32
  • The closing happens on the client side. What are you using to connect to the host: Java, C#, VB ...? – Brian Oct 24 '13 at 11:50
  • I use python and close connection on client side - I check it with the same 'netsat -n' script. – Sergey Oct 24 '13 at 13:11

0 Answers0