WCF服务节流 [英] WCF Service Throttling

查看:264
本文介绍了WCF服务节流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署在一个控制台应用程序具有basicHttpBinding的和SSL WCF服务端口上启用了使用Netsh命令,更在下面的属性被设置为好。

  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)
 

和我还设置了节流行为

 < serviceThrottling maxConcurrentCalls =2147483647maxConcurrentSessions =2147483647
        maxConcurrentInstances =2147483647/>
 

在另一方面,我创建了一个测试客户端(用于负载测试),能同时启动多个客户端(多线程),并执行服务器上的数据。一切似乎都很好,工作正常,但在服务器上的CPU利用率不长,所以我加了一些日志,查看并发调用服务器的数量,发现其从来没有超过6

我已经回顾了性能计数器日志code的两倍多,似乎没什么问题。

所以我要问哪里是在这种情况下,这个问题还有一件事我还没有指定任何ContextMode或ConcurrencyMode呢。

这篇文章后,我注意到,每当我开始测试客户端的另一个Intance我的并发服务器调用计数器增加至2一样,如果我运行只有一个实例的最大并发RCVD调用将被2,如果有两个实例相同的值进到4等等。是否有WCF的数的限制,从曾经进程调用?

寻求帮助 Mubashar

的* 添加日期17-March******************* 今天,我的服务器运行这个时候我得到确切的结果是什么我想它显示由服务器= 50

但我需要做同样的别人的机器也是如此。任何人可以帮助我在此。

解决方案

我找到了解决方案,

没有对ServicePointManager这是造成这个问题的连接限制。反正要消除这种限制,你只需要设置

  System.Net.ServicePointManager.DefaultConnectionLimit = X;
 

在这里默认的上限为2。

注:我开始赏金只是为了检查它做什么:P

I have a WCF Service Deployed in a Console App with BasicHTTPBinding and SSL enabled on port using NetSH command and more over following attribute is set as well.

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

And also i have set the Throttling behavior as

<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 server. everything seems fine and working properly but on server the CPU utilization is doesn't grow so i added some logging to view the number of concurrent calls to the server and found that its 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 and one more thing i haven't specified any kind of ContextMode or ConcurrencyMode yet.

After this Post I noticed that whenever i start another Intance 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?

Looking for help Mubashar

*Added on 17-March******************* 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 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. Can anybody help me on this.

解决方案

I found the Solution that is

there is a Connection Limit on ServicePointManager that was causing this problem. anyway to remove this limit you just need to set

System.Net.ServicePointManager.DefaultConnectionLimit = X;

where the default limit is 2.

Note: I started bounty just to check what it does :P.

这篇关于WCF服务节流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆