TCP 环回连接与 Unix 域套接字性能 [英] TCP loopback connection vs Unix Domain Socket performance

查看:29
本文介绍了TCP 环回连接与 Unix 域套接字性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在开发基于 Android 和 iOS 的应用程序,这些应用程序需要与运行在同一设备上的服务器进行通信.目前使用TCP环回连接与App和Server进行通信(用户层编写的App,使用Android NDK用C++编写的服务器)

Working on an Android and iOS based application which require communication with a server running in the same device. Currently using TCP loopback connection for communicating with App and Server (App written in user layer, server written in C++ using Android NDK)

我想知道用 Unix 域套接字替换内部通信是否会提高性能?

I was wondering if replacing inter communication with Unix Domain socket would improve the performance?

或者总的来说,是否有任何证据/理论证明 Unix 域套接字会比 TCP 环回连接提供更好的性能?

Or in-general is there any evidence/theory that proves that Unix Domain socket would give better performance then TCP loopback connection?

推荐答案

是的,unix 域套接字的本地进程间通信应该比环回 localhost 连接的通信更快,因为 TCP 开销更少,请参阅 这里.

Yes, local interprocess communication by unix domain sockets should be faster than communication by loopback localhost connections because you have less TCP overhead, see here.

这篇关于TCP 环回连接与 Unix 域套接字性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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