4

I'm using a WCF service with netNamedPipeBinding to transfer a large amount of data (very long list of objects) to the client (which is on the same machine, off course). The problem is that it takes around 20 seconds for the entire call to transfer ~250MB of data, which is about 10+MB per second. I expected the transfer rates to be much much faster when sharing memory. Does anyone know how can I improve my performance and transfer rate? Here is my app.config file:

      <netNamedPipeBinding>
    <binding name="NetNamedPipeBinding_IDataService" closeTimeout="00:10:00"
      openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
      transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
      hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
      maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
        maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport protectionLevel="None" />
      </security>
    </binding>
  </netNamedPipeBinding>

Thanks a lot!

Omri
  • 1,058
  • 3
  • 14
  • 26
  • 2
    Shared memory is very fast, but Named Pipes is not shared memory. – vcsjones Jan 25 '12 at 20:12
  • OK. You a re correct, but never mind the back-end implementation of the binding. These rates is what I would expect from basic http binding and not named pipe binding which should be much faster. – Omri Jan 26 '12 at 04:26
  • How are you measuring the throughput? Are you sure it is really the data transfer time and not serialization/deserialization of your "very long list of objects"? – Chris Dickson Feb 23 '12 at 09:40

1 Answers1

1

Like the comments say it is probably not the transfer rate that is causing the problem, it is more the serialization.

There are 3 things to consider:

  • the CPU usage of serializing and deserializing
  • the holding of the objects in memory
  • the transfer rate

To send the 250 MB over it will first be serialized, then sent over, then deserialized. This could result in 3 copies of the data in memory, which could lead to disk thrashing.

We had a similar problem a few years back, and ended up switching to calling the dll's directly, passing a memory reference to the list would take ca. 1 millisec.

Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252