0

我有一个用于负载测试的客户端应用程序,用作有效负载生成器。该应用程序是托管在具有安全 wsHttpBinding 的 IIS 中的 WCF 服务的客户端。此外,IIS 中托管的 WCF 服务是一个中间层,它也是使用 netTcpBinding 在 Windows 服务中托管的另一个异步 WCF 服务的客户端。

在负载测试时,我不能超过每秒 10-12 个请求。我有正确的节流配置,如下所示。

这是我对作为 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>

这是托管在 IIS 中的 WCF 服务的 web.config 文件

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

1 回答 1

0

为了提高 IIS 托管的 WCF 服务的性能,您可能需要调整应用程序池设置。以下代码片段显示了一个示例配置设置:

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

有关其他信息,请参阅以下 MSDN 页面:http:
//msdn.microsoft.com/en-us/library/ee377050.aspx

于 2013-11-06T14:09:34.050 回答