ChannelFactory最大连接池
本文关键字:连接 ChannelFactory | 更新日期: 2023-09-27 18:18:20
我正在创建一个测试工具来对服务器进行压力加载。我创建了许多不同的线程,它们向服务器发送不同的请求。它似乎受到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>
我所需要做的就是为system.net connectionManagement添加一个配置:
<system.net>
<connectionManagement>
<add address = "*" maxconnection = "1000" />
</connectionManagement>
</system.net>
参见:Element (Network Settings)
请注意,这个线程中的问题与我遇到的问题相同:IIS/WAS仅并行处理每个客户端的两个请求