简体   繁体   中英

WCF with netNamedPipeBinding bad performance

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM