Performance test - Web Services vs. .NET Remoting
Against any sources I have found so far the Web Services with XML and SOAP seems to be a little faster than .NET Remoting with TcpChannel.
Here is what I got:
Iterations WS TcpRemoting
100 00:09:21.6504501 00:10:47.2276639
1000 01:32:33.1492575 01:47:14.6432660
In both cases I send a DataSet through the wire. The data set has all the fields from a SQL table and 5,000 records.
[635 byte] By [
DanielP] at [2008-1-29]
Hi,
You are correct this has been documented elsewhere as well. The WebServices are faster when you go with SOAP Formatter for .NET Remoting. .NET Remoting on TCP-IP with binary formatter should give you a better performance.
Take a look here:
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=4544
Also:
See last para in the article below: I have pasted below as well.
http://www.thinktecture.com/Resources/Articles/REMOTINGVS.ASP.NETWEBSERV.html
If you are going to go cross-platform or you have the requirment of supporting SOAP via HTTP, you should definitely go for ASP.NET web services as .NET Remoting's SOAP performance isn't quite the best (not shown here, but it is a little slower than ASP.NET).
Regards,
Vikram
Thanks Vikram but I'm still confused since I used the binary formatter and TcpChannel and it is still slower than WS with SOAP and XML.
Here is the server side code:
static void Main(string[] args)
{
BinaryServerFormatterSinkProvider serverProv =
new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv =
new BinaryClientFormatterSinkProvider(); IDictionary props =
new Hashtable(); props[
"port"] = 8085; TcpChannel chan =
new TcpChannel( props, clientProv, serverProv ); ChannelServices.RegisterChannel( chan );
RemotingConfiguration.RegisterWellKnownServiceType(
Type.GetType(
"TcpRemotingServer.TestTcpRemotingObject"),
"GetDataSet", WellKnownObjectMode.SingleCall ); System.Console.WriteLine(
"Hit <enter> to exit..."); System.Console.ReadLine();
}
I believe most of the existing benchmarks are based on Remoting hosted in IIS 5/IIS 5.1. Are you using IIS 6.0 ? It maybe so that IIS 6.0 provides a superior performance as compared to the earlier versions.
Also, IIS maybe doing some kind of caching because of which the results maybe getting a bit blurred.
Regards,
Vikram
Yes, I'm using IIS 6.0 and I do not use any explicit caching unless, as you said, IIS 6 is doing it behind the scene.
Hmm, thats interesting. If its not an issue, you can share the code with me and I will run the tests on my machine and let you know what I find out
You can send the code to my email id: vikram404(at)gmail.com
Regards,
Vikram