SlideShare a Scribd company logo
1 of 2
Understanding WCF Concurrency Modes and Throttling
1. Single:
Trong Single mode, sẽ có chỉ có một thread có thể sử dụng các ví dụ của WCF lớp dịch vụ.
Nếu bất kỳ chủ đề đã tạo một thể hiện của lớp sau đó tiếp tục yêu cầu đề có thể tạo ra các ví dụ
nhưng họ sẽ phải đợi cho chủ đề đầu tiên để kết thúc sử dụng cá thể của nó và sau đó nó sẽ có
được một sự thay đổi để thực hiện các hoạt động trên cá thể của nó.
Không quan tâm tới thằng InstanceContextMode (per call, per seasion, single).
2. Multiple
In Multiple mode, each thread will have its own instance of the WCF service object and they all
will be executing at the same time. Now this is the most complicated mode because all the
concurrency issues must be handled by the service.
Now let us see what is the behavior with various InstanceContext Modes:
- InstanceContextMode.Single: In this mode, only one instance will serve all the client requests and
since the ConcurrencyMode is also set to Multiple, multiple threads will be created for all the
clients.
- InstanceContextMode.PerSession:Now in this mode, single instance of the service will be
created for each client and since the ConcurrencyMode is set to Multiple, mulitple threads can be
created for each client request.
- InstanceContextMode.PerCall: Now in this mode a new instance is created for every call so
ConcurrencyMode set as Multiple will not have much impact on behavior and every call will be
processed in a single thread.
3. Reentrant
- The Reentrant mode is similar to the Single mode in a way that each thread can create its own
instance but to execute the instance, they will have to wait for any other thread to finish using the
instance. The main difference in this mode is that if the first thread's instance either calls some
other service or process the client callback, the second thread's instance will be given a chance to
execute.
- Now since this is similar to Single mode and allows only one thread to process the instance at a
time, this behavior will be same irrespective of the instance mode. i.e. in
InstanceContextMode.Single, InstanceContextMode.PerSession and
InstanceContextMode.PerCallonly a single thread will be allowed to access the instance of the
WCF service class but as soon as the instance calls any other service or go for processing client
callbacks, the other thread will get a chance to execute its own instance of WCF service class.
- Note: We have only talked about the ConcurrencyModes from a theoretical perspective. In most
cases the ConcurrencyMode.Single is used. Also, it in a stateless scenario, where the default
instance mode is PerCall, making a change in the ConsurrencyMode will not have any
effect/impact and thus there will rarely be a case when we would want to change the default
behavior of the concurrency mode (and even if we change it, it will be futile).

More Related Content

Similar to Wcf concurency

Java threads
Java threadsJava threads
Java threads
javaicon
 

Similar to Wcf concurency (20)

Java threads
Java threadsJava threads
Java threads
 
Java threading
Java threadingJava threading
Java threading
 
Threading.pptx
Threading.pptxThreading.pptx
Threading.pptx
 
econtent thread in java.pptx
econtent thread in java.pptxecontent thread in java.pptx
econtent thread in java.pptx
 
Concurrency Programming in Java - 05 - Processes and Threads, Thread Objects,...
Concurrency Programming in Java - 05 - Processes and Threads, Thread Objects,...Concurrency Programming in Java - 05 - Processes and Threads, Thread Objects,...
Concurrency Programming in Java - 05 - Processes and Threads, Thread Objects,...
 
Threads in Java
Threads in JavaThreads in Java
Threads in Java
 
Thread priorities in java
Thread priorities in javaThread priorities in java
Thread priorities in java
 
thread os.pptx
thread os.pptxthread os.pptx
thread os.pptx
 
Java threads
Java threadsJava threads
Java threads
 
Threading in java - a pragmatic primer
Threading in java - a pragmatic primerThreading in java - a pragmatic primer
Threading in java - a pragmatic primer
 
Thread
ThreadThread
Thread
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
BCA MultiThreading.ppt
BCA MultiThreading.pptBCA MultiThreading.ppt
BCA MultiThreading.ppt
 
Chap2 2 1
Chap2 2 1Chap2 2 1
Chap2 2 1
 
Java-7 Concurrency
Java-7 ConcurrencyJava-7 Concurrency
Java-7 Concurrency
 
Threads ppt
Threads pptThreads ppt
Threads ppt
 
U4 JAVA.pptx
U4 JAVA.pptxU4 JAVA.pptx
U4 JAVA.pptx
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
threads-ppfldkgsh;reghuiregiuhrughet.pptx
threads-ppfldkgsh;reghuiregiuhrughet.pptxthreads-ppfldkgsh;reghuiregiuhrughet.pptx
threads-ppfldkgsh;reghuiregiuhrughet.pptx
 
8.-OBJECT-ORIENTED-PROGRAMMING-USING-JAVA-Multithreading.pptx
8.-OBJECT-ORIENTED-PROGRAMMING-USING-JAVA-Multithreading.pptx8.-OBJECT-ORIENTED-PROGRAMMING-USING-JAVA-Multithreading.pptx
8.-OBJECT-ORIENTED-PROGRAMMING-USING-JAVA-Multithreading.pptx
 

Recently uploaded

Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Lisi Hocke
 

Recently uploaded (20)

Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmux
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdfThe Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdf
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
 

Wcf concurency

  • 1. Understanding WCF Concurrency Modes and Throttling 1. Single: Trong Single mode, sẽ có chỉ có một thread có thể sử dụng các ví dụ của WCF lớp dịch vụ. Nếu bất kỳ chủ đề đã tạo một thể hiện của lớp sau đó tiếp tục yêu cầu đề có thể tạo ra các ví dụ nhưng họ sẽ phải đợi cho chủ đề đầu tiên để kết thúc sử dụng cá thể của nó và sau đó nó sẽ có được một sự thay đổi để thực hiện các hoạt động trên cá thể của nó. Không quan tâm tới thằng InstanceContextMode (per call, per seasion, single). 2. Multiple In Multiple mode, each thread will have its own instance of the WCF service object and they all will be executing at the same time. Now this is the most complicated mode because all the concurrency issues must be handled by the service. Now let us see what is the behavior with various InstanceContext Modes: - InstanceContextMode.Single: In this mode, only one instance will serve all the client requests and since the ConcurrencyMode is also set to Multiple, multiple threads will be created for all the clients. - InstanceContextMode.PerSession:Now in this mode, single instance of the service will be created for each client and since the ConcurrencyMode is set to Multiple, mulitple threads can be created for each client request. - InstanceContextMode.PerCall: Now in this mode a new instance is created for every call so ConcurrencyMode set as Multiple will not have much impact on behavior and every call will be processed in a single thread. 3. Reentrant - The Reentrant mode is similar to the Single mode in a way that each thread can create its own instance but to execute the instance, they will have to wait for any other thread to finish using the instance. The main difference in this mode is that if the first thread's instance either calls some other service or process the client callback, the second thread's instance will be given a chance to execute.
  • 2. - Now since this is similar to Single mode and allows only one thread to process the instance at a time, this behavior will be same irrespective of the instance mode. i.e. in InstanceContextMode.Single, InstanceContextMode.PerSession and InstanceContextMode.PerCallonly a single thread will be allowed to access the instance of the WCF service class but as soon as the instance calls any other service or go for processing client callbacks, the other thread will get a chance to execute its own instance of WCF service class. - Note: We have only talked about the ConcurrencyModes from a theoretical perspective. In most cases the ConcurrencyMode.Single is used. Also, it in a stateless scenario, where the default instance mode is PerCall, making a change in the ConsurrencyMode will not have any effect/impact and thus there will rarely be a case when we would want to change the default behavior of the concurrency mode (and even if we change it, it will be futile).