Question

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";
    }
Was it helpful?

Solution 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

OTHER TIPS

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

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

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top