Edit report at http://bugs.php.net/bug.php?id=46723&edit=1

 ID:                 46723
 User updated by:    jost_boekemeier at users dot sf dot net
 Reported by:        jost_boekemeier at users dot sf dot net
 Summary:            FastCGI is incredibly slow due to TCP ack delay
-Status:             Feedback
+Status:             Assigned
 Type:               Bug
 Package:            CGI related
 Operating System:   *
 PHP Version:        5CVS, 6CVS (2008-12-08)
 Assigned To:        dmitry
 Block user comment: N

 New Comment:

Test machine was FC10 with a fedora-patched kernel 2.6.25.



It is possible to eliminate the ack delay on kernel-level (e.g. make
NDELAY default for local tcp connections). But in fc9, fc10 and fc11 the
problem was, and in FreeBSD the problem is, very visible.



Bridge0 was identical to Bridge except for the NDELAY patch.





An alternative approach would be to add a write cache which grows
dynamically, and which is flushed each time read() is called. But I
think this is too much overhead.


Previous Comments:
------------------------------------------------------------------------
[2010-08-25 14:55:39] dmi...@php.net

I've tested your patch on Linux 2.6.27 and it doesn't make any visible
difference.



May be you used different URLs? (In your last post JavaBridge !=
JavaBridgeO)



Also it would be better to use special programs to benchmark (e.g. ab or
http_load)

------------------------------------------------------------------------
[2010-03-20 18:41:35] jost_boekemeier at users dot sf dot net

Please excuse the delay. I didn't noticed that you were asking for a
patch.



After applying the patch fastcgi renders 900 pages in 1m8.095s, compared
to 1m40.428s before.





[notice for me]



$ time for i in `seq 900`; do wget -O/dev/null -o/dev/null
http://localhost:8080/JavaBridge/sessionSharing.php; done



real    1m40.428s

user    0m1.587s

sys     0m3.108s

$ time for i in `seq 900`; do wget -O/dev/null -o/dev/null
http://localhost:8080/JavaBridgeO/sessionSharing.php; done



real    1m8.095s

user    0m1.212s

sys     0m2.485s

------------------------------------------------------------------------
[2009-01-29 01:00:16] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2009-01-21 19:27:40] j...@php.net

Patches are always welcome, you don't need to wait for a request..:)

------------------------------------------------------------------------
[2008-11-30 17:42:32] jost_boekemeier at users dot sf dot net

Description:
------------
The PHP side of a socket-based FastCGI communication is unbuffered since
PHP 5.1.4 (maybe earlier). 



write/write/read cycles have a huge performance impact, on the latest
Linux kernel the FastCGI SAPI is actually slower than executing a CGI
for each request!



The actual problem is caused by the two unbuffered write() operations,
which run into a delayed ack and therefore cause a latency of 40000us on
FC10 and 500ms(!) on FreeBSD.



As an immediate fix I suggest to switch on NDELAY for the PHP FastCGI
socket communication. I can provide a patch if you want me to.





Regards,

Jost Bökemeier





Reproduce code:
---------------
-

Expected result:
----------------
-

Actual result:
--------------
-


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=46723&edit=1
  • Bug #46723 [Fbk->Asn]: FastCGI ... jost_boekemeier at users dot sf dot net

Reply via email to