【发布时间】:2011-03-04 12:52:33
【问题描述】:
为什么在一台计算机内使用本地管道而不是套接字进行程序通信?有任何一个 FRESH 统计数据,关于谁更快、多少 nm,哪个更sequre 或更少?
我发现了一个谨慎的古老、奇怪和可怕的...http://home.iae.nl/users/mhx/pipes&socks.html
There is a noticeable difference in performance between sockets and named pipes.
Benchmark 1: 20 Mbytes copied between two iForths on machine 1;
Benchmark 2: 20 Mbytes copied from an iForth on machine 2 to an iForth on machine 1.
Systems for sock test: Windows XP Pro, running on (1) an Intel PIV 3GHz/1GB and (2) an Intel Core 2 Duo 2.66 GHz/2GB. The PC's were networked using motherboard Realtek network adapters (100 Mbit/s).
Systems for npipe test: Windows NT 4.0, running on (1) an Intel Pentium 166MHz/48MB and (2) an Intel Pentium 200MHz/48MB. The PC's were networked using cheap NE2000 clones (10 Mbit/s).
benchmark | process A read | process B write
===========+================+================
sock bm 1 | 72 MB/sec | 732 MB/sec
sock bm 2 | 11.5 MB/sec | 2.857 GB/sec
npipe bm 1 | 15 MB/sec | 15 MB/sec
npipe bm 2 | 715 KB/sec | 715 KB/sec
而here 是一些奇怪的信息(至少对我来说——Windows 用户)
【问题讨论】:
-
命名管道不适用于大块数据。如果你发送的消息最多只有几十个字节,管道的性能是一样的
标签: sockets statistics ipc named-pipes