跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 进程间通信用 Unix Domain Socket 比 loopback 好在哪?
未分類
30 3 月 2021

进程间通信用 Unix Domain Socket 比 loopback 好在哪?

进程间通信用 Unix Domain Socket 比 loopback 好在哪?

資深大佬 : zhoudaiyu 0

为了性能?还是为了 sock 文件权限便于控制?

大佬有話說 (15)

  • 資深大佬 : unixeno

    性能更高,也方便权限控制

  • 資深大佬 : guo4224

    你还能跑出性能差别来?

  • 主 資深大佬 : zhoudaiyu

    @guo4224 明显我这是疑问句

  • 主 資深大佬 : zhoudaiyu

    @unixeno 性能差距真的有这么大么

  • 資深大佬 : lcdtyph

    内核处理 unix domain socket 的时候没有 routing netfilter 这些没用的步骤,所以会比 loopback 更快一些

    文件相比 listening socket 更方便控制权限,还能省一个端口号

  • 主 資深大佬 : zhoudaiyu

    @lcdtyph 省端口确实没想到

  • 資深大佬 : lcdtyph

    @lcdtyph

    不过性能差距在高负载的时候才能体现出来

  • 資深大佬 : nightwitch

    获得一定的性能提升。
    损失了一定的跨平台性,直到 Win10 17063 版本以后才支持 AF_UNIX.

    天下没有免费的午餐。

  • 資深大佬 : sherlock1122

    UDS 可以传输 fd,实现内存共享。
    虚拟化中 vhost user 强依赖这个特性。

  • 資深大佬 : wzb0909

    https://lists.freebsd.org/pipermail/freebsd-performance/2005-February/001143.html

  • 資深大佬 : Wincer

    https://github.com/rigtorp/ipc-bench

    Here you have the results on a single CPU 3.3GHz Linux machine :

    TCP average latency: 6 us

    UDS average latency: 2 us

    PIPE average latency: 2 us

    TCP average throughput: 0.253702 million msg/s

    UDS average throughput: 1.733874 million msg/s

    PIPE average throughput: 1.682796 million msg/s

  • 資深大佬 : ch2

    Loopback 可以跨操作系统,unix_domain_socket 顾名思义

  • 資深大佬 : cubecube

    @ch2 win 上也有了。。就是这么神奇。java 也支持了

  • 資深大佬 : julyclyde

    @Wincer 奇怪,凭什么比 pipe 快??

  • 資深大佬 : Wincer

    @julyclyde 和机器或者操作系统也有关吧,我这是从 StackOverflow 上摘抄的,下面有评论也说他测试 pipe 比 uds 更好的。https://stackoverflow.com/questions/14973942/tcp-loopback-connection-vs-unix-domain-socket-performance

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具