Performance of unix sockets vs TCP ports
Solution 1
Beware though that sockets are only reachable from programs that are running on the same server (there's no network support, obviously) and that the programs need to have the necessary permissions to access the socket file.
Solution 2
When you are using TCP, you are also using the whole network stack. Even if you are on the same machine, this implies that packets are encapsulated and decapsulated to use the network stack and the related protocols.
If you use unix domain sockets, you will not be forced to go through all the network protocols that are required otherwise. The sockets are identified solely by the inodes on your hard drive.
Related videos on Youtube
Jason
Updated on September 18, 2022Comments
-
Jason over 1 year
For example on php-fpm:
#listen = 127.0.0.1:9000 listen = /var/run/php-fpm/php-fpm.sock
Is there any major performance differences between using unix socket-based listeners over TCP ports? (Not just for PHP but in general. Is it different for each service?)