AFAIK, there exist two methods for IPC over sockets. Unix sockets and TCP/IP sockets.
UNIX domain sockets know that they’re executing on the same system, so they can avoid some checks and operations (like routing); which makes them faster and lighter than IP sockets. They also transfer the packets over the file system, meaning disk access is a natural part of the process (AFAIU, from what using file system means).
IP sockets (especially TCP/IP sockets) are a mechanism allowing communication between processes over the network. In some cases, you can use TCP/IP sockets to talk with processes running on the same computer (by using the loopback interface).
My question is: in the latter case, where does the transfer of packets occur exactly? If they are being passed over the memory, although it seems like there is a logical overhead, IP sockets are actually more performant than UNIX sockets.
Is there something that I am missing? I understand that logically IP sockets introduce an overhead, I want to understand what happens to a message in both cases.
Advertisement
Answer
UNIX domain sockets … They also transfer the packets over the file system, meaning disk access is a natural part of the process
This is wrong. While there is a special socket file in the file system it only regulates access to the socket by using file system permissions for it. The data transfer itself is done purely in memory.
IP sockets … where does the transfer of packets occur exactly?
Also in memory.