When benchmarking regular PHP 5.6 through unix socket the results are many order of magnitues better than tcp port.
When I run a command like this:
$ ab -k -n 10000 -c 1000 http://127.0.0.1/api/user/1
I get an avg 3272 reqs per second.
But with tcp port instead of unix socket I get 6.5 reqs per second.
With wrk
$ wrk -t1 -c1000 -d5s http://127.0.0.1:80/api/user/1
on unix socket: 6500 req per second
on tcp port: 300 req per second
How am I supposed to use these benchmarks to get a feel of how my server and code can handle load when I get these kinds of results?
Should I trust the tcp port or unix socket one?
How are you using a Unix socket in your example? The -k
option is http keep alive.
Unix sockets are used for inter-process communication, so I'm almost certain that the primary access method used to access your webserver is via tcp.
Really this is testing the efficiency of your code AND webserver. If you care most about the efficiency of your code, you should consider inspecting xdebug output also.