5 steps to Optimizing WCF Services

4,515 views
4,314 views

Published on

Presentation by Punit Ganshani on 5 quick steps to Optimizing your WCF services

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,515
On SlideShare
0
From Embeds
0
Number of Embeds
386
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

5 steps to Optimizing WCF Services

  1. 1. 5-steps toOptimizing WCFservicesPunit Ganshani
  2. 2. Twitter - @ganshani @codetails LinkedIn - Connect SlideShare – View Presentations Blog Sites – www.ganshani.com www.codetails.com Open Source – CodeInject, Workflow Extractor, dI.HookPunit GanshaniPunit Ganshani is a Technology Evangelist practising application design &development on C#, WCF, WP8, WinRT and Open Source. He is an open-source contributor on CodePlex, has several applications on Windows PhoneStore, author of a book, and 18+ whitepapers in international magazines.
  3. 3. Choose the right binding Source: http://weblogs.asp.net/blogs/spano/WCFBindings.JPG
  4. 4. Choosing the Encoder Text Default encoder• BasicHttpBinding and WsHttpBinding• Uses XML UTF-8 encoding MTOM Interoperable format• More optimized transmission of binary blobs• Not base-64 encoded, hence faster Binary Default encoder w/binary format• NetTcpBinding and NetNamedPipeBinding• Avoids base64 encoding and use Session Encoders• Uses a dictionary-based algorithm to avoid data duplication
  5. 5. Which Encoder?▪ Supports the right binding▪ Size of the message ▪ Choose one that shortens your message ▪ Smaller the size of message, faster it will be transferred▪ Check the CPU load ▪ Encoding takes time and CPU cycles▪ Keep it Simple Stupid (KISS) ▪ Remove redundant attributes / properties from message ▪ Keep it binary if possible▪ Interoperable ▪ MTOM – check for interoperability with non-WCF services
  6. 6. Session Encoders.. Build / reuse▪ Binary encoder has Session Encoders ▪ Builds a dictionary based on pattern of messages ▪ Uses dictionary and analysis pattern for encoding ▪ Optimizes speed as time goes by▪ Other encoders ▪ Build your own session encoder
  7. 7. Compress after encoding▪ A right encoder reduces message size by 4-5 times▪ But the shorter the message, the better ▪ WAS/IIS Hosted Service: Use IIS compression ▪ Others: Uses GZip and Deflate mechanisms for all outgoing/incoming messages▪ For custom compression, hook the encoder and apply compression techniques
  8. 8. Cache▪ Register your dependencies, and locate them when required▪ Consider caching data, ▪ In memory Cache - ▪ Ideal for small sized application hosted on a single instance/server ▪ WAS/IIS Hosted Services: Use ASP.NET Caching Services or Runtime Caching ▪ Self hosted: Use Enterprise Library ▪ App-Fabric: ▪ Ideal for distributed hosted applications ▪ Overcomes several problems such as sticky sessions, component-dependent caching, dirty cache and cache- synchronizing
  9. 9. Small things, big difference▪ Load Balance: ▪ Increases scalability ▪ Increases performance▪ Use GPU for data computing: ▪ Accelerator by Microsoft ▪ CUDA by NVIDIA

×