I'm evaluating various interprocess communication methods for a couple of .NET 2.0 processes residing on the same machine. Naturally, .Net Remoting is a candidate, and theoretically the fastest configuration should be IpcChannel (named pipes) + BinaryFormatter.
My benchmarks really do show that Remoting over IpcChannel could mostly be faster than TcpChannel, but IpcChannel shows a steep drop in throughput as messages get bigger (around 30 MB):
Message Size 30 MB 3 MB 300 KB 3 KB Remoting / TCP 120 MB/s 115.4 MB/s 109.5 MB/s 13.7 MB/s Remoting / IPC 55 MB/s 223.3 MB/s 218.5 MB/s 20.3 MB/s
Does anyone have any idea why, or any idea how to optimize performance of either channel? I do need to pass 30 MB BLOBs around, and would like to avoid having to deal with shared memory / memory mapped files. Also, I can't afford writing these to disk (much slower).
The following method was used for the benchmarks (called repeatedly, measured total time, divided total payload size by total time).
private byte[] _bytes = null;
public byte[] HelloWorld(long size)
{
if (_bytes == null || _bytes.Length != size)
_bytes = new byte[size];
return _bytes;
}