This may appear like an already discussed/answered question. But I am specifically looking for info which I couldn't find anywhere answered clearly.

I have an Nginx + php-fpm setup which uses unix sockets to talk Nginx to backend php-fpm fastcgi processes. Recently I heard unix socket based connections are not as scalable as tcp-based connections. Not sure what is the limiting factor here, especially when I run everything from the same host.

I can increase the max file descriptor per system or an user(nginx). I can also increase this limit per nginx worker processes. Is max file descriptor the limiting factor?

I have very few websites configured in this setup and the max sockets (one per website). I use less than 50. Is there a max concurrent connections limit per socket when multiple nginx threads talking to multiple php-fpm instances in the backend under high load? Or what can actually limit a socket from allowing these connections if concurrency is very high?

Are there any other factors which can affect performance like locks, disk io performance etc?

  • What exactly doesn't work? As written, your question is rather broad and thus hard to answer. – vonbrand Jan 24 '14 at 17:22
  • A statement like "domain sockets are not as scalable as network sockets" sounds like rubbish to me. I think results would depend greatly on workload and configuration. With a quick Google search I could find actual tests done which showed no difference for one person, and which showed domain sockets were faster than network sockets for another person. You don't seem to have any actual problem and show no evidence of approaching a scalability barrier. You're asking for "just in case" tuning for a problem you haven't hit yet. – suprjami Jul 3 '14 at 10:57

I heard unix socket based connections are not as scalable as tcp-based connections

It's the other way round. Unix sockets are more scalable than TCP connection. Because when you use TCP you have to use the whole network stack. Even if you're on the same machine each packet has to be encapsulated and decapsulated. With Unix sockets you're doing process to process communication.

However, in many cases not using TCP packets is just a micro-optimization, the real bottleneck is elsewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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