简体   繁体   English

WCF对大量呼叫进行压力测试

[英]WCF Stress Testing on large number of calls

I'm currently developing a secure WCF service that will receive large numbers of calls, eg over 3000. My original approach has been to call the webservice methods using 'async' however rather quickly I realised that I needed to use the Task.WaitAll to ensure that all the calls were successfully made before the execution dropped out. 我目前正在开发一种安全的WCF服务,该服务将接收大量调用,例如超过3000个。我的原始方法是使用“异步”调用webservice方法,但是很快我意识到我需要使用Task.WaitAll来确保在执行退出之前成功完成所有调用。

However, by utilising the WaitAll I'm now overloading the service with 70% of calls returning a combination of 'CommunicationException' and 'ServerTooBusyException' type messages. 但是,通过利用WaitAll,我现在使70%的调用超载服务,并返回“ CommunicationException”和“ ServerTooBusyException”类型消息的组合。 I have reviewed the WCF throttling options but still finding that these do not appear to have any direct effect, ie (Note: the webservice is being ran locally in this instance on Local IIS) 我查看了WCF限制选项,但仍然发现这些选项似乎没有任何直接作用,即(注意:在此实例中,Web服务正在本地IIS上本地运行)

<serviceThrottling 
    maxConcurrentCalls="4096" 
    maxConcurrentSessions="65536" 
    maxConcurrentInstances="2147483647"/>

Running the webservice call sychronously works fine but runs too slow and I'm not terribly bothered about waiting for any callback from the webservice - I literally just need to 'fire and forget' these calls to the service. 同步运行webservice调用可以正常运行,但运行速度太慢,对于等待来自webservice的任何回调,我也不会感到烦恼-我实际上只是需要“触发并忘记”这些对服务的调用。

Here's a rough example of what I'm doing on the client-side... 这是我在客户端正在做的一个粗略示例...

var numberOfIterations = 3000;
var allCalls = new List<Task>();

using (var service = new WebserviceServiceClient())
{
    for (var n = 0; n < numberOfIterations; n++)
    {
        var someObject = new SomeObject(DateTime.UtcNow);
        allCalls.Add(service.WebserviceMethodAsynch(SomeObject));
    }
}
Task.WaitAll(allCalls.ToArray());

Can anyone advise on an elegant approach to bombarding a WCF webservice from a client without an attritional amount of failed calls? 任何人都可以建议一种优雅的方法来轰炸客户端的WCF Web服务,而不会造成大量失败呼叫吗?

Note: one approach would be utilise queues (in this case Azure Queues), ironically the service being called is performing some minor preprocessing prior to adding the object onto a queue to be picked up by a separate, more intensive process. 注意:一种方法是利用队列(在本例中为Azure队列),具有讽刺意味的是,被调用的服务正在执行一些较小的预处理,然后再将对象添加到队列中,以由一个单独的更密集的过程进行处理。

Thanks in advance 提前致谢

Your client and your web service are not on the same machine, right? 您的客户端和Web服务不在同一台机器上,对吗? Anyway, I believe you'd better use a Load Test to achieve the results that you're looking for: 无论如何,我相信您最好使用负载测试来获得所需的结果:

http://www.sandeepsnotes.com/2013/05/load-and-performance-testing-of-wcf.html http://www.sandeepsnotes.com/2013/05/load-and-performance-testing-of-wcf.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM