views:

205

answers:

2

I'm having problems with low performance using a Windows named pipe. The throughput drops off rapidly as the network latency increases. There is a roughly linear relationship between messages sent per second and round trip time. It seems that the client must ack each message before the server will send the next one. This leads to very poor performance, I can only send 5 (~100 byte) messages per second over a link with an RTT of 200 ms.

The pipe is asynchronous, using multiple overlapped write operations (and multiple overlapped reads at the client end), but this is not improving throughput. Is it possible to send messages in parallel over a named pipe? The pipe is created using PIPE_TYPE_MESSAGE, would PIPE_READMODE_BYTE work better? Is there any other way I can improve performance?

This is a deployed solution, so I can't simply replace the pipe with a socket connection (I've read that Windows named pipe aren't recommended for use over a WAN, and I'm wondering if this is why). I'd be grateful for any help with this matter.

+1  A: 

We found that Named Pipes had poor performance from Windows XP onwards.

I don't have a solution for you. But I am concurring with the notion of Named Pipes being useless from XP onwards. We changed our software (in terms of IPC) completely because of it.

Is your comms factored into a separate DLL? Perhaps you could replace the DLL with an interface that looks the same but behaves differently?

Stephen Kellett
Your answer in that link mentions you replaced them with your own shared memory data transport implementation. Did you find the pipes were performing poorly over a network, or were you just using them for local IPC?
MichaelB76
Principally for local IPC. I can't remember the details, it was years ago. I think we did briefly look at network stuff as well. But if its poor locally, its probably going to be worse over the network. We did some searches to find if others had problems with named pipes and sure enough they did and no one had a solution, which is why we changed tack completely. The shared memory solution has been great but it has rather tied our software to working on one machine rather than across a network :-(, which fortunately for us, most of our customers want to work on one machine.
Stephen Kellett
Interesting, but unfortunately that doesn't help me with the problem. We have a deployed solution consisting of 46 servers over 3 continents, using named pipes for IPC.
MichaelB76
A: 

I've implemented a work around, introducing a small (~1ms) fixed delay to buffer up as much data as possible before writing to the pipe. Over a network link with a RTT of 200ms, I can send ten times as much data in about a third of the time.

I send a message down the pipe when it first connects, so the client can determine the comms mode supported by the server and send data accordingly.

MichaelB76