WCF 服务限制
我在控制台应用程序中部署了一个 WCF 服务,并启用了 BasicHTTPBinding 和 SSL。还设置了以下属性:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
我还将限制行为设置为
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="2147483647"
maxConcurrentInstances="2147483647" />
另一方面,我创建了一个测试客户端(用于负载测试),它同时启动多个客户端(多个线程)并在服务器上执行事务。一切看起来都很好,但在服务器上,CPU 利用率没有增加,因此我添加了一些日志记录来查看对服务器的并发调用数,发现它从未超过 6。
我已经检查了性能计数器日志记录代码两次以上,它对我来说似乎很好。
那么我想请问一下这种情况问题出在哪里呢?我还没有指定任何类型的 ContextMode 或 ConcurrencyMode。
在这篇文章之后,我注意到每当我启动另一个测试客户端实例时,我的并发服务器调用计数器就会增加到 2,就像如果我只运行 1 个实例,则最大并发 Rcvd 调用将为 2,如果有两个实例,则相同的值将变为 4等等。一次进程的 WCF 调用次数是否有限制?
今天更新
我在运行服务器的同一台计算机上使用一个测试客户端(具有 50 个并发用户)运行了另一项测试。这次我得到了我想要显示的确切结果(即服务器接收的最大并发呼叫数 = 50)。
但我也需要在其他机器上做同样的事情。接下来我可以尝试什么?
I have a WCF service deployed in a console app with BasicHTTPBinding and SSL enabled. The following attribute is set as well:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
I have also set the throttling behavior to
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="2147483647"
maxConcurrentInstances="2147483647" />
On the other hand I have created a test client (for load test) that initiates multiple clients simultaneously (multiple threads) and performs transactions on the server. Everything seems fine but on server the CPU utilization doesn't increase so I added some logging to view the number of concurrent calls to the server and found that it never went over 6.
I have reviewed the performance counter logging code more than twice and it seems fine to me.
So I want to ask where is the problem in this situation? I haven't specified any kind of ContextMode or ConcurrencyMode yet.
After this Post I noticed that whenever I start another Instance of Test Client my concurrent Server Calls counter increase to 2 like if I am running only 1 instance the maximum Concurrent Rcvd Calls will be 2 and if there are two instance the same value goes to 4 and so on. Is there any limit of Number of WCF Calls from once process?
Update
Today I ran another test with one test client (with 50 concurrent users) on the same machine on which the server is running. This time I am getting the exact result what I wanted it to show (i.e. Maximum concurrent Calls Rcvd by Server = 50).
But I need to do it the same on others machines as well. What can I try next?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者在客户端使用此配置。
这里200是客户端的限制
Or use this configuration in the client.
Here 200 is the limit from the client
我找到了一个解决方案:ServicePointManager 上的连接限制导致了此问题。要删除此限制,您只需设置
默认限制为 2。
I found a solution: there is a connection limit on ServicePointManager that was causing this problem. To remove this limit you just need to set
where the default limit is 2.