插座与管道的性能 [英] Performance of sockets vs pipes

查看:85
本文介绍了插座与管道的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java程序,该程序使用localhost上的套接字与C ++程序进行通信.我可以期望通过使用本机OS管道来获得任何性能(延迟,带宽或两者)吗?目前,我主要对Windows感兴趣,但是也欢迎与Unix/Linux/OSX相关的任何见解.

I have a Java-program which communicates with a C++ program using a socket on localhost. Can I expect to gain any performance (either latency, bandwidth, or both) by moving to use a native OS pipe? I'm primarily interested in Windows at the moment, but any insight related to Unix/Linux/OSX is welcome as well.

澄清:两个程序都在同一主机上运行,​​当前正在通过套接字进行通信,即通过与localhost的TCP/IP连接.我的问题是,切换为使用(本地)命名管道(Windows)或与Unix等价的管道(AF_UNIX域套接字?)有哪些潜在的性能优势.

Clarification: both programs run on the same host, currently communicating via a socket, i.e. by making a TCP/IP connection to localhost:. My question was what are the potential performance benefits of switching to using (local) named pipes (Windows), or their Unix equivalent (AF_UNIX domain socket?).

推荐答案

肯是正确的.在Windows上,命名管道绝对更快.在UNIX& Linux,您需要UDS或本地管道.同一件事,不同的名字.

Ken is right. Named pipes are definitely faster on Windows. On UNIX & Linux, you'd want a UDS or local pipe. Same thing, different name.

除了套接字以外的任何其他东西对于本地通信来说都将更快.这包括内存映射文件,本地管道,共享内存,COM等.

Anything other than sockets will be faster for local communication. This includes memory mapped files, local pipes, shared memory, COM, etc.

这篇关于插座与管道的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆