none
Two service throttling for one service RRS feed

  • Question

  • I am developing a system under WCF services which contain two modules and this service is self hosted. One of the module has to handle multiple clients whereas another module has to handle one request at a time for direct file download. Other request on this module is set on a queue. enter image description here

    System should hold other request if it for module two but it should handle requests for module

    1. How can I use WCF service Throttling to achieve this? I tried implementing two throttling but it did not work.
    2. Is it possible to count number of pending request in WCF throttling?

    I am trying to get this done by using MySQL to hold up the queue but I am not able to hold current request that is for module 2. Is it possible to hold user request and process it after current process is completed?


    Saugat K.C.

    Thursday, June 4, 2015 7:08 AM

Answers

  • Hi  Saugat,
        According to this case, you can define interface separately in corresponding service for multiple throttling & also have to define the endpoints separately in the corresponding configurations .
    Moreover you can set instance mode as single and concurrency mode as multiple in your service behavior like below :

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single,
                     ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class SampleService : ISampleService
    {}

    WCF throttling helps you to put an upper limit on the number of concurrent calls, WCF instances, and concurrent sessions. WCF provides three ways by which you can define upper limits: MaxConcurrentCalls, MaxConcurrentInstances, and MaxConcurrentSessions like below :

    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
         <behavior name="serviceBehavior">
           <serviceThrottling maxConcurrentCalls="16"
                  maxConcurrentInstances="2147483647" maxConcurrentSessions="10" />
         </behavior>
       </serviceBehaviors>
     </behaviors>
    </system.serviceModel>

    for more information, Click here to refer about WCF service throttling.

    Friday, June 5, 2015 1:54 PM