Five steps to optimize WCF Service – Easy WCF
Skip to content

Five steps to optimize WCF Service

Step 1 : Choose the correct binding for your WCF Service.

WCF Bindings

Step 2 : Choose the correct Encoding for your WCF Service.



Step 3 : Compress after Encoding

  • Right encoder reduces message size by 4-5 times
  • Use IIS comression, If the message is shorter and hosted in WAS/IIS else use GZip and Deflate mechanism  for all outgoing and Incoming message
  • For custom compression,hook the encoder and apply custom compression mechanism


Step 4 : Choose the correct data Caching in your WCF Service.

You can consider caching data:

  • In memory cache:
    • Ideal for small sized application hosted on a single instance/server 
    • Use caching services or runtime caching for WAS/IIS hosted service:
    • Use Enterprise Library for self hosted service
  • App-Fabric:
    • Ideal for distributed application
    • Resolve several problems like sticky sessions, component-dependent caching, Cache synchronization etc


Step 5 : Performance Optimization

  • If your WCF service is hosted on IIS you can turn on IIS compression for static and dynamic content to improve performance.
  •  You can use the Windows Performance Monitor to analyse the performance bottlenecks. You can enable WCF performance counters in config file
  • Take advantage of NetTCP binding to boost the throughput of your WCF services.
  • Use light-weight data exchange formats, i.e., JSON in your WCF service to minimize the network traffic that your WCF service would otherwise need to consume if SOAP were used as a data exchange format.
  • You should always use DataContract Serializer in lieu of XMLSerializer for better performance.
  • You can also explore the possibilities of using binary serialization formats like MessagePack to minimize the traffic even further.
  • You can also compress the data transferred over the wire to cut down on the network traffic between the service provider and the service consumers.
  • Since there is no built in way to cache service responses in WCF, you can write custom code to cache service responses.
  • You should set WCF service throttling and service configuration appropriately to improve service performance


You can go through the WCF Best Practices to create responsive WCF Service.


© 2015, admin. All rights reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *