2. Twitter -
@ganshani
@codetails
LinkedIn -
Connect
SlideShare –
View Presentations
Blog Sites –
www.ganshani.com
www.codetails.com
Open Source –
CodeInject, Workflow
Extractor, dI.Hook
Punit Ganshani
Punit 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 Phone
Store, author of a book, and 18+ whitepapers in international magazines.
3. Choose the right binding
Source: http://weblogs.asp.net/blogs/spano/WCFBindings.JPG
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. 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. 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. 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. 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. Small things, big difference
▪ Load Balance:
▪ Increases scalability
▪ Increases performance
▪ Use GPU for data computing:
▪ Accelerator by Microsoft
▪ CUDA by NVIDIA