none
WCF vs Memory Mapped Files RRS feed

  • Question

  • I have an API I'm working with that models objects managed by a third-party exe.  This API could be used by an external exe we build.  For this API to work, there will also be a dll that is loaded into the third-party exe.  I hope this doesn't sound too confusing.  As I build this, I've gone the direction of WCF Net Named Pipes.  I was just doing some reading earlier today and ran across memory mapped files.  Doing a little more digging I found that the MMF approach that's evidently been around for a while but fairly new to the managed world of .NET, is about 10x faster than WCF.  Now the document I read might have been referring to TCP or HTTP communications, I don't recall.  I also read somewhere a reference to the fact that Net Named Pipes use MMF.  This leaves me at a crossroad here.  What is better?  WCF NP? or MMF?  If the two truly are different or are the same then when does it make sense to use one over the other?  I think I even read that MMF could be used across machines in a distributed architecture?  Some people were so high on MMF they acted like they were going to drop their use of WCF.  Is there that big a difference?  Or maybe they're statements are based on the evolution of the two technologies? 

    I'm trying to figure out how these should be used so that I can make the decision that makes the most sense for my API.  Any help is greatly appreciated.


    Jason

    Thursday, April 3, 2014 8:34 PM

All replies

  • Thanks for the reply.  That's a good blog post, but I'm really looking for the practical advice on the differences and what makes to use one technology over the other.

    Jason

    Friday, April 4, 2014 11:23 AM
  • Hi,

    You don't have to do anything special to use shared memory. WCF netNamedPipeBinding internally uses memory mapped files to communicate between two processes running on the same computer -  it is the quickest way two processes running on same computer can communicate via WCF.

    For more information, please see this article.

    However, at the same time, it is also a limitation, that because it uses shared memory object (memory mapped file), both communicating parties have to be running on same computer.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 7, 2014 2:37 AM
    Moderator
  • Great article. I noticed that it states the shared memory is used for the naming when it says "it creates a shared memory object based on the listen address uri to store this GUID" but then may be referring to the named pipe communcations on shared memory when it says " and creates some instances of the named pipe to listen to the requests."  I hope I'm assuming correctly that that's what he means.

    Thank you for the information.


    Jason

    Monday, April 7, 2014 11:38 AM
  • Okay, in the comments of that article I asked Mr. Viana if I was assuming correctly that the Shared Memory was being used for inter-process communications of WCF netNamedPips.  It turns out I assumed wrong.  The shared memory is only used to store and retrieve the real name of the pipe, not for inter-process communications.  Hopefully this statement will be helpful to others who were wondering the same thing.

    So I guess this brings me full circle then.  What's the best practice for using one technology over the other? (shared memory vs WCF NetNamedPipes)


    Jason


    • Edited by HuffCAD Monday, April 7, 2014 4:55 PM
    Monday, April 7, 2014 4:54 PM