How do I maximize performance for my wcf开发者_StackOverflow中文版 service? Is it possible to take advantage of multicore? or multi-threading?
Thanks!!
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.
- ConcurrencyMode default is
Single
(single threaded) - UseSynchronizationContext default is
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.
Here is a related article, gives some metrics around performance so you can benchmark.
WCF Service Performance
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.
精彩评论