K
K
kastaneda2011-08-17 08:17:23
.NET
kastaneda, 2011-08-17 08:17:23

Using a Web Service client in a multi-threaded application?

We have an application whose task is to execute requests to a SOAP service in several threads. We noticed that with an increase in the number of threads, the time to execute each request increases by an order of magnitude. To understand the reason, we wrote a SOAP-extension - as a result, it turned out that even with 5 threads on a 16-processor server, the serialization time is approximately 95% of the request time, with 10 threads, the request did not wait for the request to complete (with 1 thread, the time for serialization request is approximately 150ms).
Who faced similar behavior? There is a suspicion that "dead" locks occur inside the web service, or inside the serializer.
PS For each thread, a separate instance of the web service is created.
PPS The number of threads does not seem to affect deserialization.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vadim911, 2011-08-17
@vadim911

If we are talking about using a WCF service, then we must take into account that by default, without additional attributes, the service works in PerCall instance mode, but at the same time in Single concurrency mode. Which under load leads to the fact that the threads line up in a queue. Therefore, to improve the performance of the service, I recommend setting ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple).
You can read more about this here: www.codeproject.com/KB/WCF/WCFConcurrency.aspx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question