Wednesday, May 23, 2018

WCF Transfer Mode

WCF supports the streamed or buffered mode to transfer the request /response message from client to server or vice versa

Type of Transfer Mode :
  1. Buffered - no streaming only buffering  
  2. Streamed - both direction of request message and response message will be streamed.
  3. StreamedRequest - request message send from client to service will be streamed.
  4. StreamedResponse - response message send from service to client will be streamed.
1.       Buffered Mode : 

WCF holds the entire message in local memory buffer until transfer is completed it means a receiver can read message once it is completed delivered.

WCF Configuration:
<basicHttpBinding>
<binding name="BasicHttpBindingService"  maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"   transferMode="Buffered" />
</basicHttpBinding>

2.       Streamed Mode :

WCF hold only the message header only and it start transferring the small part of message body as stream and receive can start read the message, before it is completely delivered.

WCF Configuration:

<basicHttpBinding>
<binding name="BasicHttpBindingService"  maxReceivedMessageSize="2147483647"  transferMode="Streamed"
</basicHttpBinding>

Differences between Buffered and Streamed Transfers


                       Buffered
                       Streamed
client can process or read  the message once it is completely received
Client can start processing the data when it is partially received
Performance will be good when message size is small
Performance will be good when message size is larger(more than 64K)

Note :
  • By default, Streaming is disabled for all bindings
  • TCP, IPC and HTTP Binding support streaming transfer mode
  • For small size Message, by default transfer mode option is good but if message size is larger, you have to choose the streaming mode for better performance
  • No OutOfMemory exceptions anymore for larger size data processing , if you choose streaming mode
Thanks for Visiting!!

No comments:

SQL Server - Identify unused indexes

 In this blog, we learn about the index usage information (SYS.DM_DB_INDEX_USAGE_STATS) and analyze the index usage data (USER_SEEKS, USER_S...