Comparison Of Different Channels In WCF

Few months back, we did some measurement of different WCF channel to get the precise idea about the performance in the different channel stack.

Following is the definition of the environment:

  1. WCF service and client is hosted in the same Windows 2003 Server.
  2. 537 Users exist in the system.
  3. WCF service is hosted in Windows Service.
  4. System.Diagnostics.Stopwatch is used to measure time elapsed in Millisecond.
  5. Two user credentials are used: one domain user & the local system account on which the server was running.

Primary goal was to measure the time required for each GetUsers() call( in milliseconds) for combination Binding and InstanceContextMode. That’s why, we took average of 10 Test Run (in different scenario) for each combination where in each Test Run, we call the GetUsers() 100×10 Times . Here comes the result:

Comparison of different channels

Comparison of different channels

  • From the graph above, it’s quite obvious that NetTcpBinding(PerSession) is the best performer, which is quite expected as per its channel behavior. Interestingly, if we look at the WsHttpBinding(PerSession), it is taking more time than session unaware BasicHttpBinding. There is a similarity in the trend of BasicHttpBinding (PerCall by default) , WsHttpBinding(PerCall) and NetTcpBinding(PerCall) in the first TestRun; as the first GetUsers() is setting up the whole channel stack, its taking more time than its usual time. On the other hand, WsHttpBinding(PerSession), and NetTcpBinding(PerSession) are more consistent in every Test Run because of the reusability of the Session. We measure that 15ms is the time taken on average to create a new Application specific session in our system.

  • Following is the Chart of the average time taken per request in milliseconds for each combination:

Average time taken per request in Milliseconds

Average time taken per request in Milliseconds

I would recommend you to visit Wcf Binding Comparision List and Supported Features (Reference)
for a quick comparison of different channel in terms of Transport Protocol, Message Encoding, and Message Versioning and so on.

Hope it helps to you to choose the right channel stack for your application.

Cheers! J


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s