From: jost_boekemeier at users dot sf dot net Operating system: Irrelevant PHP version: 5.3.0alpha2 PHP Bug Type: Performance problem Bug description: FastCGI is incredibly slow due to TCP ack delay
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 bug report at http://bugs.php.net/?id=46723&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46723&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46723&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46723&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46723&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46723&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46723&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46723&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46723&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46723&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46723&r=support Expected behavior: http://bugs.php.net/fix.php?id=46723&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46723&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46723&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46723&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46723&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46723&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46723&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46723&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46723&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46723&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46723&r=mysqlcfg