3

WCF サービスでストレス テストを実行しようとしています。ストレス テストは、「多くの同時ユーザーがサービスに対して 1 つの要求を実行する」というシナリオをエミュレートします。自己ホスト型の WCF サービス、basicHttpBinding、および ssl サポートを使用しています。

このテストで、パフォーマンスに問題があることがわかりました。これらの問題の理由は、サービスが接続を閉じないため、開いている接続の数が常に増加しているためです (開いている接続をカウントするために netstat -n を使用しています)。キープアライブ プロパティを無効にしようとしましたが、役に立ちませんでした。どんなアイデアでも、何が問題になる可能性がありますか?

ここにサーバー構成があります:

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

開いている接続をカウントするための小さなスクリプトを次に示します。

@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
4

0 に答える 0