ChannelFactory最大连接池

发布于 2024-12-22 15:37:37 字数 1524 浏览 1 评论 0原文

我正在创建一个测试工具来对服务器进行压力加载。我创建了许多不同的线程,向服务器发送单独的请求。它似乎受到 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>

I am creating a testing tool to stress load a server. I create many different threads that send seperate requests to the server. It appears to be limited by the ChannelFactory. It bottlenecks on making the actual service call, for example:

_proxy.MyServiceCall(...);

I've tried several different approaches:

  • Using a single static ChannelFactory shared by all the threads
  • Creating a new channel factory per thread
  • Creating a new channel factory per call

All these result in fairly similar performance. There appears to be a global static pool of available connections that the channel factory is using. I've tried looking this up but couldn't find anything. Would you know more about this? Do you think my guess that there is a static pool of connections is correct? If so do you know how that would be configurable?

This is the current configuration for the testing application:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初雪 2024-12-29 15:37:37

事实证明,我需要做的就是添加 system.net 连接管理的配置:

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

请参阅: 元素(网络设置)

请注意,此线程中的问题与我遇到的问题相同:IIS/WAS 每个客户端仅处理两个请求并行

It turned out that all I needed to do is add a configuration for system.net connectionManagement:

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

See: Element (Network Settings)

Note that the problem in this thread is the same one as I have run into: IIS/WAS only handles two requests per client in parallel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文