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