Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Part 44 - Multiple concurrency mode in WCF

Suggested Videos
Part 41 - Single instance context mode in WCF
Part 42 - SessionMode Enumeration in WCF
Part 43 - Single concurrency mode in WCF



In this video we will discuss the Multiple concurrency mode in WCF with examples. This is continuation to Part 43. Please watch Part 43 before proceeding.



With Multiple concurrency mode an exclusive lock is not acquired on the service instance. This means multiple threads are allowed to access the service instance simultaneously and we get better throughput. However, shared resources if any must be protected from concurrent access by multiple threads to avoid concurrency issues.
concurrency in wcf

In Part 93 in C# video series, we discussed
1. What happens if shared resources are not protected from concurrent access in a multithreaded environment
2. How to protect shared resources from concurrent access

When concurrency mode is set to Multiple, requests are processed concurrently by the service instance irrespective of the Service Instance Context Mode and whether if the binding supports session or not.
multiple concurrency in wcf

wcf tutorial

1 comment:

  1. Hi Venkat my Multiple Concuerrency Mode not working ,
    here is my client call
    var tasks = new List>();
    var service = new ServiceReference1.Service1Client();
    tasks.Add(Task.Factory.StartNew(() => service.GetOddNumbers()));
    tasks.Add(Task.Factory.StartNew(() => service.GetEvenNumbers()));
    Task.WaitAll(tasks.ToArray());

    Please help

    ReplyDelete

It would be great if you can help share these free resources