Sockets – TCP loopback connection vs Unix Domain Socket performance

loopbacksocketstcpunixunix-socket

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)

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

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

Best Answer

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.

Related Topic