Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example on php-fpm:

#listen =
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?)

share|improve this question

UNIX domain sockets should offer better performance than TCP sockets over loopback interface (less copying of data, fewer context switches).

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.

share|improve this answer

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.

share|improve this answer
Copy-paste detected – poige May 6 '15 at 18:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.