5

Is it possible to test WCF throttling behaviour through Wcftest client?

If Yes then How?

I have a code below for ServiceHost

 ServiceThrottlingBehavior stb = _servicehost.Description.Behaviors.Find<ServiceThrottlingBehavior>();
        if (stb == null)
        {
            stb = new ServiceThrottlingBehavior();
            stb.MaxConcurrentCalls = 1;
            stb.MaxConcurrentInstances = 1;
            stb.MaxConcurrentSessions = 1;
            _servicehost.Description.Behaviors.Add(stb);
        }

My service has a method such as:

    public string ThrottlingCheck()
    {
        Thread.Sleep(new TimeSpan(0, 0, 0, 5, 0));//5 seconds
        return "Invoke Complete";
    }
Devesh
  • 396
  • 1
  • 4
  • 23

4 Answers4

4

In the event that you are using “web” bindings, you could use the open-source soapUI/loadUI test tools.

SoapUI is a free and open source cross-platform Functional Testing solution. With an easy-to-use graphical interface, and enterprise-class features, SoapUI allows you to easily and rapidly create and execute automated functional, regression, compliance, and load tests.

Reference:
http://www.soapui.org/
http://www.soapui.org/Load-Testing/using-loadui-for-loadtesting.html

Seymour
  • 7,043
  • 12
  • 44
  • 51
2

As your request is taking 5 seconds, you can easily test this by invoking two operations at the same time by using two WCF Test Client or by opening two tabs in the same WCF client.

An integration test is certainly a better choice to check this behavior.

In addition, if your want to check that the behavior is really applied to your service, you could use WCF diagnostics such as WCF counters, especially "Percent of Max Concurrent XXX".

enter image description here

Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
1

No, it is not possible using WCF Test Client. If you have Visual Studio Ultimate you can use load tests/performance tests to test the throttling.

http://blogs.msdn.com/b/rickrain/archive/2009/06/26/wcf-instancing-concurrency-and-throttling-part-3.aspx?Redirected=true

Wojciech Kmita
  • 249
  • 2
  • 12
0

If you company has a copy of LoadRunner (hp product), you'll be able to build up enough fake transaction to actually test throttling.

In our case, we actually built a multi-instance, multi-threaded program to slam our web service with 1000+ concurrent (fake) users, each uploading 40 files. It was only then that we were able to see the throttling begin to take effect.

BTW, we tried a bunch of different combinations to see if we could tweek the settings and increase the performance, but in the end, the fastest we were able to get our web service running was under the default settings for throttling ... in other words, no throttling at all, just letting WCF manage the traffic and queue. Weird, huh?

Brian
  • 3,653
  • 1
  • 22
  • 33
  • By no throttling, do you mean default throttling? – Nick Westgate Jun 24 '15 at 02:26
  • The default is that no throttling is applied. In other words, right out of the box, there's no throttling being used in WCF implementation. – Brian Jun 25 '15 at 07:23
  • But if you don't apply any throttling WCF has [defaults](http://blogs.msdn.com/b/appfabriccat/archive/2010/10/29/less-tweaking-of-your-wcf-4-0-apps-for-high-throughput-workloads.aspx). – Nick Westgate Jun 25 '15 at 23:21
  • Perhaps ... I'm not sure what they are. They behavior we saw that that if you launched, say, 1000 concurrent requests, the web service would try to process about 150 and the rest would be queued by the web service. So maybe there's a default in there somewhere. – Brian Jun 26 '15 at 07:57
  • I linked to the defaults in my previous comment. There was also a threading [bug in .NET 4](http://blogs.msdn.com/b/dmetzgar/archive/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work.aspx) that affects WCF performance and is fixed in 4.5. – Nick Westgate Jul 01 '15 at 00:03