Geeks With Blogs
Clara's Notes on Technology Notes to me and the world

This week we need to choose the most appropriate communication technology for one of our projects.

The project constraints are the following:

  • .NET on both client and server
  • client and server on same LAN
  • A lot of information to be passed from server to client and vice-versa
  • Performance is important
  • Typed DataSets will be used on server side
  • Presentation layer is developed with WPF
  • Security is needed (sensitive or confidential data)

The options we have are the following:

  1. ASMX Web Services
  2. .NET Remoting
  3. WCF

I clearly favour option 3. First, given that this is considered a .NET 3.0 project (the presentation layer will be developed in WPF), I prefer to be consistent and use WCF. Second, the .NET Remoting option is not really an option. We have no experience with it and its future does not seem promising (given the arrival of WCF). If we have to learn something new, we might as well go for WCF.

The advantages of the ASMX Web Service option is that we have a lot of experience with it. However, WCF offers better performance. Given the amount of data that will need to be transferred, I am worried about performance. This MSDN paper compares the performance of WCF with existing technologies. The conclusions are the following:

  • WCF (basicHttpBinding) is 25%-50% faster than ASMX Web Services
  • WCF is approximately 25% faster than .NET Remoting

 

So, now within WCF, what are our options?

  1. basicHttpBinding : Basically the equivalent of ASMX Web Services in .NET 3.0
  2. wsHttpBinding : Web Services implementing WS-Security. They offer message-level security: authentication, encryption and signing.
  3. netTcpBinding: The "equivalent" of .NET Remoting in .NET 3.0, with the advantage that it is easier to code (given the standardization of all communication techniques)

For a table comparing the different bindings, here or this MSDN article.

I have not been able to find a Microsoft article comparing the performance of the different bindings (besides this one) but this is what I have picked up from different blogs and forums. 

  •  netTcpBinding should be the fastest, given the binary serialization (vs. Text in basicHttpBinding). However, you should we aware of their different default settings when comparing them. netTcpBinding and wsHttpBinding both have security enabled by default (at transport and message level respectively), and the later has ReliableSessions turned on (source: here and here). I read somewhere (sorry ... lost the URL) that it is 25%-50% faster than basicHttpBinding.
  • basicHttpBinding gives pretty good performance compared to ASMX Web Services and, given that there is no security, even compared to wsHttpBinding and netTcpBinding. A couple of extra tips to increase its performance even more:
    • do not send the DataSet schema
    • use MTOM encoding instead of Text ("MTOM is a mechanism for transmitting large binary attachments with SOAP messages as raw bytes, allowing for smaller messages")

In my opinion, netTcpBinding is a very good option for us given its good performance and security options. On the other hand, it does not respect the tenets of SOA. But ... do we really need SOA? We are dealing with an application that will be deployed inside a LAN and where both client and server are implemented in .NET. Moreover, if we are going to send typed DataSets from server to client (very probable), we have already broken the tenets of SOA.

As for security options in netTcpBinding that might reduce the performance advantage, we can go for the lightest option which is transport security (source: here).

I don't think basicHttpBinding with MTOM encoding is good option for us because MTOM is particularly interesting when sending large binary items (such as pictures, videos, etc.): "the MTOM standard allows for externalizing large data elements that are contained in a message and to carry them with the message as binary data without any special encoding" (source: MSDN). And not sending the DataSet schema reduces message size significantly only when few data is sent. As the message contains more data, the proportion of space taken up by the schema drastically diminishes.

The wsHttpBinding is very interesting if you need to implement the WS-* standards, which is not our case. Admittedly, you can also use wsHttpBindings if you want Web Services (to be SOA compliant) and you need full security. But the whole WS-* paraphernalia clearly impacts performance ...

 

To finish up, just a link to one of the leading WCF experts: Michele Leroux Bustamante (she must have some Spanish blood with a surname like that!) 

 

Technorati tags: , ,
Posted on Monday, May 28, 2007 4:42 PM | Back to top


Comments on this post: Choosing a Communication Technology

# re: Choosing a Communication Technology
Requesting Gravatar...
Good analysis:)
Left by Ray Zhang on Oct 15, 2007 11:41 AM

# re: Choosing a Communication Technology
Requesting Gravatar...
Nicely Explained!
Left by Syed Raza on Feb 14, 2008 11:31 PM

# re: Choosing a Communication Technology
Requesting Gravatar...
It seems strange that TCP Binding is only 25-50% faster because i'm finding wshttp very slow. Need to did down and look for tweaks I guess.
Left by ecards on Dec 08, 2008 10:41 PM

# re: Choosing a Communication Technology
Requesting Gravatar...
Hi,
I'm building one component (windows service) at my company where WCF is hosted to publish data to outside. In somewhere, my customer can be used and access database with authentication. I'm confusing with which protocols are used in this case (basicHttpBinding, wsHttpBinding, netTcpBinding)?


The performance and security are in prior that I care the best

Could you tell me our ideas?

Thank you very much
Left by Khoa Diep on Jun 06, 2010 11:16 PM

Your comment:
 (will show your gravatar)


Copyright © Clara Oscura | Powered by: GeeksWithBlogs.net