How do I maximize performance for my wcf service? Is it possible to take advantage of multicore? or multi-threading?
Thanks!!
How do I maximize performance for my wcf service? Is it possible to take advantage of multicore? or multi-threading?
Thanks!!
This is a very broad question that is difficult to answer. It will depend on what your service is doing and how it is implemented. But as a general rule of thumb you should avoid long running operations which could monopolize worker threads.
If you host your WCF service in IIS, then IIS will place each call on it's own thread, giving you the advantage mulitcores on your server.
If you want a single call to run on many threads, then you need to program this yourself in your code. You would only need this if your service is doing a lot of calculations.
The following Behavior properties default to the simplest (single threaded) solution, changing them from their default values will give you multiple threading, including self-hosted services.
Single
(single threaded)True
(effectively single threaded in UI self hosted scenario)You may want to also look at InstanceContextMode also this MSDN article gives a starting point on WCF Concurrency.