While I agree with Justin's answer, I believe that here you can shed some light on how WCF works.
You make a specific statement:
I have a feeling that the service will wait until it processes one request, go to the next. How can I use multithreading in WCF to speed up actions?
A serviceโs concurrency service (the number of calls it can receive at a time) depends on the ConcurrencyMode value for the ServiceBehavior attached to the service. By default, this value is ConcurrencyMode.Single , that is, it will serialize calls one by one.
However, this may not be as much as you think. If your InstanceContextMode service is equal to InstanceContextMode.PerCall then this is not a problem; A new instance of your service will be created for each call and will not be used for other calls.
If you have a singleton or session-based service object, then calls to this service implementation instance will be serialized.
You can always change the ConcurrencyMode , but keep in mind that if you do this, you will have to handle the concurrency problems and access your resources manually since you explicitly told WCF that you would do it.
Itโs important that you donโt change them just because you think it will lead to better performance. Although not so much for concurrency, the installation aspect of your service is a very large part of the serviceโs identification information (if it is session-based or not session-based), and changing them affects customers who consume this service, do it easily.
Of course, this does not say anything about whether the code that actually implements the service is effective. This is definitely what you need to study when you indicate that it is.
casperOne
source share