A question of fastcgi_pass method
mdounin at mdounin.ru
Sun Oct 17 15:52:30 MSD 2010
On Sun, Oct 17, 2010 at 06:42:51PM +0800, SanCao Jie wrote:
> I use webbench to do this test : webbench -c 100 http://IP/
> This is the result:
> USE TCP Method:
> Speed=5730 pages/min, 14038 bytes/sec.
> Requests: 2865 susceed, 0 failed.
> USE UNIX SOCKET Method:
> Speed=5548 pages/min, 13592 bytes/sec.
> Requests: 2774 susceed, 0 failed.
> Why the test shows that TCP method is faster than Unix Socket ?
There are no real reasons why tcp over loopback should be slower
than unix sockets. It's up to OS implementation details.
In your particular case it looks like the speed is limited by your
fastcgi app, not by nginx or OS. The difference (if any, as your
test results don't include statistical errors) is most likely due
to different connection queueing with different sockets used by OS.
> And an other quertion is :during the TCP Method test ,I typed : netstat -an
> | grep 9000 ,this were many ports shows
> TIME WAIT .almost over 3,000 . when the webbench is over ,zhe TIME WAIT
> ports number is decrease.
> Why this ,And is it safe ?
This is per TCP, see RFC 973 for details.
See your OS guides to find out what will happen if all possible
(src, srcport, dst, dstport) between frontend and backend happen
to be in TIME-WAIT. Usually it's good idea to tune portrange and
check for tw reuse/recycle options if you are going to work with
high backend connection rates.
More information about the nginx