WCF tuning tips

To obtain significantly better response time and decreased the load on the service, you apply a set of best practices depending on your needs.
1. If you do not need sessions in your services, you may want to disable them to reduce the memory consumption of the service.
2. If you are transfering large amounts of data between client and server, the minimum is to enable MTOM enconding. MTOM is an optimized encoding for transmitting binary data. And even better than MTOM, you can also use streaming for the data transfers. Streaming avoids loading the complete message in memory which is what happens when you do not use streaming. Performance will be vastly increased when dealing with large amounts of binary data.
3. If you have control over client and server, you may also want to choose a more efficient but less interoperable binding (like NetTcpBinding for example). This will avoid the overhead that comes with all the WS-* protocols.
4. Be carefull when modifying the instance and concurrency mode. A single instance and a single thread will avoid concurrency issues but will only serve one request at a time. Multiple instances and multiple threads per instances will enable much more requests to be processed simultaneously but it will need a really good concurrency management system. Depending on the constraints, the "good" solution lies between those two models.

These are the basic checks you can apply on your services.
Happy coding :)

Popular posts from this blog

Handling exceptions the right way in WCF (part 2)

Adding a delay before processing Textbox events

Change the deployment URL of a ClickOnce application