为什么一台计算机内部的程序通信要使用本地管道而不是套接字?
为什么一台计算机内部的程序通信要使用本地管道而不是套接字?有没有关于谁更快、快多少、哪个更连续或更慢的最新统计数据?
我发现了一个警惕的、古老的、奇怪的、可怕的...... 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
和 这里是一些奇怪的信息(至少对我来说 - Windows 用户)
Why to use local pipes instead of sockets for programs communication inside one computer? Has Any one FRESH stats on who is faster and how nmuch, what is more sequre or less?
I have found a wary old and strange and scary one... 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
And here is some strange info (at least for me - windows user)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
管道应该始终更快,因为它们完全绕过主机操作系统上的网络堆栈。管道被认为更安全,因为它们不侦听来自不受信任的远程计算机的数据(尽管套接字也可以配置为仅侦听环回适配器,从而避免侦听远程计算机)。命名管道不如套接字灵活,因为它们不允许网络通信。无论哪种情况,安全性仍然与您编写代码的程度有关。可以编写比基于套接字的应用程序安全性较低的基于管道的应用程序。
至于一个比另一个快多少,取决于您的硬件和操作系统。
Pipes should always be faster as they completely bypass the network stack on the host operating system. Pipes are thought to be more secure as they do not listen for data from untrusted remote computers (although sockets can also be configured to only listen on the loop-back adapter and thereby avoid listening to remote computers). Named pipes are less flexible than sockets since they do not allow network communication. In either case security is still related to how well you write code. It is possible to write a pipes based application that is less secure than a socket based application.
As for how much faster one is than another that will depend on your hardware and operating system.