Pergunta

I have a client application for load testing, which is used as payload generator. The application is a client to WCF service hosted in IIS with secure wsHttpBinding. In addition, the WCF service hosted in IIS is a middle tier which is also a client to another asynchronous WCF service hosted in Windows services using netTcpBinding.

While load testing I couldn't go beyond 10-12 requests per second. I have the right throttling configuration as shown below.

Here is my configuration for the application that is client to the service hosted in IIS

<?xml version="1.0" encoding="utf-8" ?>
<configuration>


  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ews.behavior" name="ServiceLoadTest.ProcessLoadRequest">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="ews.search.netTcp" contract="ServiceLoadTest.IProcessLoadRequest" />
        <endpoint address=""
          binding="wsHttpBinding" bindingConfiguration="ews.wsHttp" 
          contract="EWSServiceLoadTest.IProcessLoadRequest" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:3300/load/" />
            <add baseAddress="http://localhost:3301/load/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="ews.search.netTcp" closeTimeout="00:05:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="1000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2000" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32767" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
        <binding name="ews.netTcp">
          <security mode="None" />
        </binding>

      </netTcpBinding>
      <wsHttpBinding>
        <binding name="WSHttpBinding_ISearchData" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
               maxBufferPoolSize="2147483647"
           maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Transport">
            <transport clientCredentialType="None" />
            <message clientCredentialType="None" negotiateServiceCredential="false" />
          </security>
        </binding>
       <binding name="ews.wsHttp" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
               maxBufferPoolSize="2147483647"
           maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
      </wsHttpBinding>  
    </bindings>
    <client>

      <endpoint address="https://[dnsName]/SearchData/Search.svc"
               binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISearchData"
               contract="SearchDataReference.ISearchData"
               name="WSHttpBinding_ISearchData">
            <identity>
              <dns value="[dnsName]" />
            </identity>
          </endpoint>

    </client>
    <behaviors>

      <serviceBehaviors>
        <behavior name="ews.behavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceMetadata httpGetEnabled="true" />
          <serviceThrottling maxConcurrentCalls="5000" maxConcurrentSessions="5000" maxConcurrentInstances="5000"/>
          <serviceTimeouts transactionTimeout="00:05:00" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

And here is web.config file for WCF service hosted in IIS

<?xml version="1.0" encoding="utf-8"?>
<configuration>


  <system.serviceModel>
    <extensions>
      <behaviorExtensions>
        <add name="wsdlExtensions" type="WCFExtrasPlus.Wsdl.WsdlExtensionsConfig, WCFExtrasPlus" />
      </behaviorExtensions>
    </extensions>
    <services>
    <service behaviorConfiguration="ews.behavior" name="SearchData">
      <endpoint address="" binding="wsHttpBinding" bindingConfiguration="ews.secure.wsHttp" 
behaviorConfiguration="FlatWsdlBehaviour" contract="Contracts.ISearchData">
        <identity>
          <dns value="[dnsname]" />
        </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="https://[dnsname]/SearchData/Search.svc" />
        </baseAddresses>
      </host>
    </service>
  </services>
  <behaviors>
    <endpointBehaviors>
      <behavior name="FlatWsdlBehaviour">
        <wsdlExtensions location="https://[dnsname]/SearchData/Search.svc" singleFile="true" />
      </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
      <behavior name="ews.behavior">
        <serviceDebug includeExceptionDetailInFaults="true" />
        <serviceMetadata httpsGetEnabled="true" />
        <serviceThrottling maxConcurrentCalls="5000" maxConcurrentSessions="5000" maxConcurrentInstances="5000" />
        <serviceTimeouts transactionTimeout="00:05:00" />
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <netTcpBinding>

      <binding name="NetTcpBinding_AllAsync" closeTimeout="00:10:00"
           openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
           transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
           hostNameComparisonMode="StrongWildcard" listenBacklog="5000"
           maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="5000"
           maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
        <security mode="None">
        </security>
      </binding>

    </netTcpBinding>
    <wsHttpBinding>

      <binding name="ews.secure.wsHttp" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"
               maxBufferPoolSize="2147483647"
           maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        <security mode="Transport">
          <transport clientCredentialType="None" />
          <message clientCredentialType="None" negotiateServiceCredential="false" />
        </security>
      </binding>

    </wsHttpBinding>
    <wsDualHttpBinding>
      <binding name="WSDualHttpBinding_AllAsync" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        <reliableSession ordered="true" inactivityTimeout="00:10:00" />
        <security mode="None" />
      </binding>

    </wsDualHttpBinding>

  </bindings>
  <client>

    <endpoint address="net.tcp://localhost:5536/NMVTISCheckForDataOnlineCallback"
      binding="netTcpBinding" bindingConfiguration="NetTcpBinding_AllAsync"
      contract="CheckForDataReference.IProcessCheckForDateOnlineAsync" name="NetTcpBinding_IProcessCheckDataOnlineAsync">
    </endpoint>
    <endpoint address="http://localhost:5525/NMVTISCheckForVinOnlineCallback"
        binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_AllAsync"
        contract="CheckForDataReference.IProcessCheckForDataOnlineAsync" name="WSDualHttpBinding_IProcessCheckDataOnlineAsync">
    </endpoint>
    </client>
  </system.serviceModel>

  <runtime>
    <gcServer enabled="true" />
  </runtime>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>

</configuration>
Foi útil?

Solução

In order to improve the performance of a IIS hosted WCF service, you may need to adjust the application pool settings. The following code snippet shows an example configuration setting:

<system.web>
   <applicationPool maxConcurrentRequestsPerCPU="x" maxConcurrentThreadsPerCPU="x" requestQueueLimit="x"/>
</system.web>

Refer to the following MSDN page for additional information:
http://msdn.microsoft.com/en-us/library/ee377050.aspx

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top