【问题标题】:ChannelFactory Maximum Connection PoolChannelFactory 最大连接池
【发布时间】:2011-12-20 17:32:26
【问题描述】:

我正在创建一个测试工具来对服务器进行压力加载。我创建了许多不同的线程,它们向服务器发送单独的请求。它似乎受到ChannelFactory 的限制。它是进行实际服务调用的瓶颈,例如:

_proxy.MyServiceCall(...);

我尝试了几种不同的方法:

  • 使用所有线程共享的单个静态 ChannelFactory
  • 为每个线程创建一个新的通道工厂
  • 为每个调用创建一个新的通道工厂

所有这些都导致相当相似的性能。似乎有一个通道工厂正在使用的可用连接的全局静态池。我试过查找这个但找不到任何东西。你会知道更多吗?你认为我猜测有一个静态连接池是正确的吗?如果是这样,您知道如何配置吗?

这是测试应用程序的当前配置:

<configuration>
  <system.serviceModel>
    <client>
      <endpoint binding="wsHttpBinding" bindingConfiguration="SynchronizationServiceBinding" contract="My.Namespace.ISynchronizationService" name="ClientBinding">
      </endpoint>
    </client>
    <bindings>
      <wsHttpBinding>
        <binding name="SynchronizationServiceBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="10485760">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
          <reliableSession enabled="false"/>
          <readerQuotas maxArrayLength="1000000"/>
        </binding>
      </wsHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>    </configuration>

【问题讨论】:

  • 您是否配置了throttling
  • 我无权访问服务器配置,但我知道服务器能够处理更多调用然后测试工具当前能够发送因此限制在某处测试工具。我已经添加了测试工具的配置。

标签: c# multithreading wcf channelfactory


【解决方案1】:

原来我需要做的就是为system.net connectionManagement添加一个配置:

  <system.net>
    <connectionManagement>
       <add address = "*" maxconnection = "1000" />
    </connectionManagement>
  </system.net>

见: Element (Network Settings)

请注意,此线程中的问题与我遇到的问题相同:IIS/WAS only handles two requests per client in parallel

【讨论】:

  • 谢谢!我正在尝试做与您完全相同的事情,并且正在考虑创建多个流程来解决此问题。
猜你喜欢
  • 2011-08-13
  • 1970-01-01
  • 1970-01-01
  • 2012-07-06
  • 2013-05-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多