TCP loopback connection vs Unix Domain Socket performance

Rohit picture Rohit · Feb 20, 2013 · Viewed 75.4k times · Source

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?

Answer

0x4a6f4672 picture 0x4a6f4672 · Apr 11, 2013

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.