简体   繁体   中英

WCF TCP binding or Named pipes for grid computing?

I'm building a distributed system. There are several applications (some are .Net based (C#), others are C++ based (NOT C++/CLI!)). Those apps will be installed on each computer in cluster (currently Windows-driven). On local PC I use for IPC: MemoryMappedFiles for C# apps, Shared Memory for C++ apps, Named Pipes for IPC between C# and C++. Over internet I use WCF TCP binding, using C# apps as bridges for C++ apps.

What would be better to use for LAN communication? MPICH2, it seems, use TCP... Are typical named pipes quicker than WCF TCP binding with optimizations (disabled security, etc.)? The messages will be extremely large, mostly of double type. WCF is extremely convenient in my situation (all mathematical methods are simply contracts), but it's performance is a question.

Read this, http://weblogs.asp.net/spano/archive/2007/10/02/choosing-the-right-wcf-binding.aspx .

You can see that the choice depends where the service is located. Hope it helps.

You are mixing two different layers, you can run WCF over NamedPipes also. Named pipes (while can work with a lot of setup word) are not designed to communicate between two processes on two computers.

See this MSDN page on Choosing a Transport to help you understand when to use what transport.

Advantages of Each Transport

This section describes the main reasons for choosing any one of the three main transports, including a detailed decision chart for choosing among them.

When to Use HTTP Transport

HTTP is a request/response protocol between clients and servers. The most common application consists of Web-browser clients that communicate with a Web server. The client sends a request to a server, which listens for client request messages. When the server receives a request, it returns a response, which contains the status of the request. If successful, optional data, such as a Web page, an error message, or other information is returned. For more information about the HTTP protocol, see HTTP - Hypertext Transfer Protocol.

The HTTP protocol is not connection-based—once the response is sent, no state is maintained. To handle multiple-page transactions, the application must persist any necessary state.

In WCF, the HTTP transport binding is optimized for interoperability with legacy non-WCF systems. If all communicating parties are using WCF, the TCP-based or named pipes-based bindings are faster. For more information, see NetTcpBinding and NetNamedPipeBinding.

When to Use the TCP Transport

TCP is a connection-based, stream-oriented delivery service with end-to-end error detection and correction. Connection-based means that a communication session between hosts is established before exchanging data. A host is any device on a TCP/IP network identified by a logical IP address.

TCP provides reliable data delivery and ease of use. Specifically, TCP notifies the sender of packet delivery, guarantees that packets are delivered in the same order in which they are sent, retransmits lost packets, and ensures that data packets are not duplicated. Note that this reliable delivery applies between two TCP/IP nodes, and is not the same thing as WS-ReliableMessaging, which applies between endpoints, no matter how many intermediate nodes they may include.

The WCF TCP transport is optimized for the scenario where both ends of the communication are using WCF. This binding is the fastest WCF binding for scenarios that involve communicating between different machines. The message exchanges use the BinaryMessageEncodingBindingElement for optimized message transfer. TCP provides duplex communication and so can be used to implement duplex contracts, even if the client is behind network address translation (NAT).

When to Use the Named Pipe Transport

A named pipe is an object in the Windows operating system kernel, such as a section of shared memory that processes can use for communication. A named pipe has a name, and can be used for one-way or duplex communication between processes on a single machine.

When communication is required between different WCF applications on a single computer, and you want to prevent any communication from another machine, then use the named pipes transport. An additional restriction is that processes running from Windows Remote Desktop may be restricted to the same Windows Remote Desktop session unless they have elevated privileges.

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