WCF vs. Remoting (with DataSet)- performance comparison

In the last blog I wrote about Windows Communication Foundation performance comparison. The document available here: A Performance Comparison of Windows Communication Foundation (WCF) with Existing Distributed Communication Technologies. I am mainly interested in the comparison of WCF and.NET Remoting. I decided to perform my own research on that topic. Here is what I tested:

  1. SingleCall service - the simplest.NET Remoting service type
  2. Data Transfer Object is DataSet - I believe it is the common medium of sending data
  3. Client and Server are both placed on a single machine
  4. TCP channel - this one allows to communicate two machines with.NET on both sides

Let me describe the client and server applications:

Server

  • The service in general: - contains one method that takes one argument and returns DataSet (the DataSet contains as many rows as method argument says) - DataSet contains 4 columns - ID (long), Name (string), Description (string) and CreatedOn (DateTime)
  • The.Net Remoting version of the service: - it's a wellknown server activated object with SingleCall activation mode - the channel is TCP with binary serialization
  • The WCF version of the service: - it uses netTcpBinding

Client

  • Invokes each of the service (WCF and Remoting) 100 times on a single thread (sequential invocation in a loop)
  • Passes to the service number of rows to generate in the DataSet (1, 100 and 200)
  • I measured creation of the service proxy, method invocation and proxy close (with WCF service)

Performance results of the services

I tested four ways of the DataSet serialization settings:

  1. Binary serialization; Schema not included in the DataSet
  2. Xml serialization; Schema not included in the DataSet
  3. Binary serialization; Schema included in the DataSet
  4. Xml serialization; Schema included in the DataSet

Here are sample results displayed on charts:

o binary noschemao xml withschema

Explantion: The charts show time (in miliseconds) of method invocation so - the lower the better.

I chose here the fastest and the slowest of my tests: binary + no schema and xml + schema. As you can see in each of the cases the Remoting service is the fastest one (probably because the DataSet native serialization is better to the one provided with WCF).

Conclusion

Sending DataSet with.NET Remoting is faster (in any of cases I tested) than sending it with WCF. Maybe there is some other way to improve the WCF in case of sending DatSet but I haven't found it yet. I'll post the test project somewhere (maybe on codeproject) so it could be examined.

This article is part of the GWB Archives. Original Author: Marcin Celej

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.