When to use Nginx PHP Fast CGI with a TCP socket instead of a UNIX socket?
Posted
by
user64204
on Server Fault
See other posts from Server Fault
or by user64204
Published on 2012-05-31T08:56:20Z
Indexed on
2012/05/31
10:43 UTC
Read the original article
Hit count: 264
I've followed this guide to setup PHP in FastCGI mode with Nginx. This guide describes 2 ways of doing it: TCP socket and UNIX socket.
I've ran some Apache Benchmark on my locale machine and here are the results:
Below tests ran multiple times to get better average statistics:
$ ab -c 200 -n 100000 http://....
APACHE: 1800 req/sec
NGINX (TCP socket): 2500 req/sec
NGINX (UNIX socket): 15000 req/sec
As far as I understand, there is overhead with using a TCP socket rather than a UNIX socket, hence the better performance with the latter. However I was not expecting such a performance difference given that the TCP socket is on the localhost, and therefore would like to ask the following question:
Q: Given the huge performance gain with using a UNIX socket, what are the configuration scenarios where it would make sense to use a TCP socket instead?
© Server Fault or respective owner