locked
Concurrent calls to the WCF service RRS feed

  • Question

  • Hi Friends,

    I am doing load testing of my WCF service. I created multiple threads (using Thread thread = new Thread()). I call the service from each thread. What I noticed that - when the thread count is <= 10, everything works fine.
    - when the count is more than 10 (I tried with 15, 20) it takes much longer for processing and few of the service calls get timed out.
    - Normally for 10 threads it takes around 3-4 seconds but for 15-20 threads it takes around 3 mins (my timeout is set to 3 mins).
    - With 10 threads, all thread run seemingly together. Even if they are waiting, it takes hardly any time.
    - However with 15-20 threads it appears like 5 or 8 threads get processed first. After 30-40 seconds another 2-3 get processed.

    I thought of a deadlock, but apparently there is no possibility of deadlock and again if deadlock is a possibility it might happen with 10 threads too.  Why it is not happening with 10 threads?

    My service is hosted on IIS. I am using wsHttpBinding. Can you please let me know what are the possible reasons?

    Thanks,
    Sat

    Tuesday, December 21, 2010 1:56 AM

Answers

  • Hi Sat,

    assuming that you are using a plain vanilla wsHttpBinding with no fancy configuration applied, you should be aware that the service is sessionful. i.e. there is a WCF session created with every security session.

    This means that you should properly Dispose() every proxy after use (otherwise it would take a long time until the session is cleaned up) and that you cannot have more concurrency than the ServiceThrottlingBehavior allows you to have. The default for the number of concurrent sessions is only 10.

     

    HTH,

    Markus

    • Marked as answer by Bin-ze Zhao Thursday, December 23, 2010 8:30 AM
    Tuesday, December 21, 2010 1:37 PM
  • Hi Sat,

    assuming that you are using a plain vanilla wsHttpBinding with no fancy configuration applied, you should be aware that the service is sessionful. i.e. there is a WCF session created with every security session.

    This means that you should properly Dispose() every proxy after use (otherwise it would take a long time until the session is cleaned up) and that you cannot have more concurrency than the ServiceThrottlingBehavior allows you to have. The default for the number of concurrent sessions is only 10.

     

    HTH,

    Markus

    Hi Marcus,

    Looks like this is a feasible solution. I will first try increaing the concurrent sessions count (say 15) to check whether those number of calls (15) work with no delay. Thanks for pointing this out.

    Regards,
    Sat

    • Proposed as answer by Leonid Ganeline Wednesday, December 22, 2010 4:23 AM
    • Marked as answer by Bin-ze Zhao Thursday, December 23, 2010 8:30 AM
    Tuesday, December 21, 2010 6:47 PM

All replies

  • Hi,

    As per me it looks like the issue is mixture of thread-pooling and service throttling behavior.

    Can you first try increasing the maxConcurrentCalls under service behavior. Its default value is 16.

     

    Link..

    http://msdn.microsoft.com/en-us/library/ms735114(v=vs.90).aspx

     

    Thanks,

    Prabhas 


    Please mark posts as answers/helpful if it answers your question
    Tuesday, December 21, 2010 9:11 AM
  • Hi Sat,

    assuming that you are using a plain vanilla wsHttpBinding with no fancy configuration applied, you should be aware that the service is sessionful. i.e. there is a WCF session created with every security session.

    This means that you should properly Dispose() every proxy after use (otherwise it would take a long time until the session is cleaned up) and that you cannot have more concurrency than the ServiceThrottlingBehavior allows you to have. The default for the number of concurrent sessions is only 10.

     

    HTH,

    Markus

    • Marked as answer by Bin-ze Zhao Thursday, December 23, 2010 8:30 AM
    Tuesday, December 21, 2010 1:37 PM
  • Hi,

    As per me it looks like the issue is mixture of thread-pooling and service throttling behavior.

    Can you first try increasing the maxConcurrentCalls under service behavior. Its default value is 16.

     

    Link..

    http://msdn.microsoft.com/en-us/library/ms735114(v=vs.90).aspx

     

    Thanks,

    Prabhas 


    Please mark posts as answers/helpful if it answers your question


    Well Prabhas I already tried that with no luck. Another point is even though default is 16 the service does not work for 15 calls either.

    Regards,
    Sat

    Tuesday, December 21, 2010 6:43 PM
  • Hi Sat,

    assuming that you are using a plain vanilla wsHttpBinding with no fancy configuration applied, you should be aware that the service is sessionful. i.e. there is a WCF session created with every security session.

    This means that you should properly Dispose() every proxy after use (otherwise it would take a long time until the session is cleaned up) and that you cannot have more concurrency than the ServiceThrottlingBehavior allows you to have. The default for the number of concurrent sessions is only 10.

     

    HTH,

    Markus

    Hi Marcus,

    Looks like this is a feasible solution. I will first try increaing the concurrent sessions count (say 15) to check whether those number of calls (15) work with no delay. Thanks for pointing this out.

    Regards,
    Sat

    • Proposed as answer by Leonid Ganeline Wednesday, December 22, 2010 4:23 AM
    • Marked as answer by Bin-ze Zhao Thursday, December 23, 2010 8:30 AM
    Tuesday, December 21, 2010 6:47 PM