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

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

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-09-06 13:11:42] dmi...@php.net

Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&revision=303072
Log: Fixed bug #46723 (FastCGI persistent connection is incredibly slow
due to TCP ack delay).

------------------------------------------------------------------------
[2010-09-04 11:33:51] jost_boekemeier at users dot sf dot net

> Also, which web server 



A Java servlet. It uses a persistent fcgi connection and establishes a
new connection after FCGI_MAX_REQUESTS. 





> and fastcgi manager do you use?



Usually php-cgi. Some people are currently using the software with PHP's
new new fcgi manager, but I don't have any experience with that.





> strace shows huge delay (up to 30 sec) on write() syscal



Could be some other problem, probably not related to PHP. MAX_REQUESTS
reached or a kernel bug or something. 



Although NDELAY isn't an elegant solution, the alternative, a 64K write
buffer, may cause more problems. Is 64k enough these days?

------------------------------------------------------------------------
[2010-09-02 17:22:22] dmi...@php.net

Also, which web server and fastcgi manager do you use?

------------------------------------------------------------------------
[2010-09-02 14:35:23] dmi...@php.net

Thanks a lot. Now I'm able to reproduce the issie.



It occurs only in case of persistent FastCGI connections (byte number 11
in you array is 1) and large output.



Unfortunately, your patch didn't fix the bug. From time to time 1/10000
strace shows huge delay (up to 30 sec) on write() syscall.



netstat -neo



Proto Recv-Q Send-Q Local Address   Foreign Address State       Timer

tcp    90501 277632 127.0.0.1:1234  127.0.0.1:59195 ESTABLISHED probe
(1.11/0/0)

tcp   556640 118784 127.0.0.1:59195 127.0.0.1:1234  ESTABLISHED probe
(0.88/0/0)



I'll think about it.

------------------------------------------------------------------------
[2010-08-28 18:37:09] jost_boekemeier at users dot sf dot net

Test script below:

------------- ack_delay.php ---

<?php

$data=array(0x1,0x1,0x0,0x1,0x0,0x8,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x1,0x4,0x0,0x1,0xe,0x65,0x0,0x0,0x4,0x5,0x54,0x45,0x52,0x4d,0x78,0x74,0x65,0x72,0x6d,0x14,0xe,0x48,0x54,0x54,0x50,0x5f,0x41,0x43,0x43,0x45,0x50,0x54,0x5f,0x4c,0x41,0x4e,0x47,0x55,0x41,0x47,0x45,0x65,0x6e,0x2d,0x75,0x73,0x2c,0x65,0x6e,0x3b,0x71,0x3d,0x30,0x2e,0x35,0x10,0x13,0x53,0x45,0x52,0x56,0x45,0x52,0x5f,0x53,0x49,0x47,0x4e,0x41,0x54,0x55,0x52,0x45,0x41,0x70,0x61,0x63,0x68,0x65,0x20,0x54,0x6f,0x6d,0x63,0x61,0x74,0x2f,0x37,0x2e,0x30,0x2e,0x32,0x12,0x9,0x48,0x54,0x54,0x50,0x5f,0x43,0x41,0x43,0x48,0x45,0x5f,0x43,0x4f,0x4e,0x54,0x52,0x4f,0x4c,0x6d,0x61,0x78,0x2d,0x61,0x67,0x65,0x3d,0x30,0xf,0x3d,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x5f,0x4d,0x41,0x4e,0x41,0x47,0x45,0x52,0x6c,0x6f,0x63,0x61,0x6c,0x2f,0x75,0x6e,0x69,0x78,0x3a,0x40,0x2f,0x74,0x6d,0x70,0x2f,0x2e,0x49,0x43,0x45,0x2d,0x75,0x6e,0x69,0x78,0x2f,0x32,0x31,0x32,0x32,0x2c,0x75,0x6e,0x69,0x78,0x2f,0x75,0x6e,0x69,0x78,0x3a,0x2f,0x74,0x6d,0x70,0x2f,0
 
x2e,0x49,0x43,0x45,0x2d,0x75,0x6e,0x69,0x78,0x2f,0x32,0x31,0x32,0x32,0x18,0x12,0x47,0x4e,0x4f,0x4d,0x45,0x5f,0x44,0x45,0x53,0x4b,0x54,0x4f,0x50,0x5f,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x5f,0x49,0x44,0x74,0x68,0x69,0x73,0x2d,0x69,0x73,0x2d,0x64,0x65,0x70,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0xb,0x5,0x52,0x45,0x4d,0x4f,0x54,0x45,0x5f,0x50,0x4f,0x52,0x54,0x35,0x38,0x39,0x32,0x31,0x14,0xc,0x48,0x54,0x54,0x50,0x5f,0x41,0x43,0x43,0x45,0x50,0x54,0x5f,0x45,0x4e,0x43,0x4f,0x44,0x49,0x4e,0x47,0x67,0x7a,0x69,0x70,0x2c,0x64,0x65,0x66,0x6c,0x61,0x74,0x65,0x4,0x16,0x4d,0x41,0x49,0x4c,0x2f,0x76,0x61,0x72,0x2f,0x73,0x70,0x6f,0x6f,0x6c,0x2f,0x6d,0x61,0x69,0x6c,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0xa,0x5,0x47,0x44,0x4d,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x67,0x6e,0x6f,0x6d,0x65,0x12,0x3d,0x58,0x44,0x47,0x5f,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x5f,0x43,0x4f,0x4f,0x4b,0x49,0x45,0x64,0x33,0x33,0x66,0x38,0x66,0x62,0x61,0x38,0x62,0x33,0x65,0x37,0x64,0x33,0x64,0x39,0x64,0x38,0x35,0x34,0x37,0x66,0x36,0
 
x34,0x39,0x33,0x31,0x33,0x65,0x34,0x36,0x2d,0x31,0x32,0x38,0x33,0x35,0x34,0x32,0x32,0x34,0x35,0x2e,0x32,0x30,0x33,0x36,0x34,0x36,0x2d,0x31,0x34,0x36,0x35,0x36,0x36,0x36,0x31,0x31,0x31,0xb,0x9,0x53,0x45,0x52,0x56,0x45,0x52,0x5f,0x4e,0x41,0x4d,0x45,0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74,0xf,0x3,0x52,0x45,0x44,0x49,0x52,0x45,0x43,0x54,0x5f,0x53,0x54,0x41,0x54,0x55,0x53,0x32,0x30,0x30,0x3,0x20,0x50,0x57,0x44,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x61,0x70,0x61,0x63,0x68,0x65,0x2d,0x74,0x6f,0x6d,0x63,0x61,0x74,0x2d,0x37,0x2e,0x30,0x2e,0x32,0x8,0x15,0x48,0x4f,0x53,0x54,0x4e,0x41,0x4d,0x45,0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74,0x2e,0x6c,0x6f,0x63,0x61,0x6c,0x64,0x6f,0x6d,0x61,0x69,0x6e,0x7,0x3,0x43,0x56,0x53,0x5f,0x52,0x53,0x48,0x73,0x73,0x68,0xb,0x2b,0x48,0x54,0x54,0x50,0x5f,0x43,0x4f,0x4f,0x4b,0x49,0x45,0x4a,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x49,0x44,0x3d,0x44,0x41,0x35,0x30,0x34,0x33,0x35,0x44,0x45,0x46,0x38,0x31,0x36,0x37,0x41,0x46,0x30
 
,0x46,0x30,0x33,0x42,0x46,0x35,0x41,0x32,0x44,0x41,0x32,0x43,0x32,0x34,0x45,0xb,0x9,0x53,0x45,0x52,0x56,0x45,0x52,0x5f,0x41,0x44,0x44,0x52,0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74,0x12,0x1,0x47,0x5f,0x42,0x52,0x4f,0x4b,0x45,0x4e,0x5f,0x46,0x49,0x4c,0x45,0x4e,0x41,0x4d,0x45,0x53,0x31,0xf,0x8,0x53,0x45,0x52,0x56,0x45,0x52,0x5f,0x50,0x52,0x4f,0x54,0x4f,0x43,0x4f,0x4c,0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x7,0x1d,0x4e,0x4c,0x53,0x50,0x41,0x54,0x48,0x2f,0x75,0x73,0x72,0x2f,0x64,0x74,0x2f,0x6c,0x69,0x62,0x2f,0x6e,0x6c,0x73,0x2f,0x6d,0x73,0x67,0x2f,0x25,0x4c,0x2f,0x25,0x4e,0x2e,0x63,0x61,0x74,0x14,0x1a,0x47,0x4e,0x4f,0x4d,0x45,0x5f,0x4b,0x45,0x59,0x52,0x49,0x4e,0x47,0x5f,0x53,0x4f,0x43,0x4b,0x45,0x54,0x2f,0x74,0x6d,0x70,0x2f,0x6b,0x65,0x79,0x72,0x69,0x6e,0x67,0x2d,0x61,0x6f,0x30,0x34,0x31,0x6a,0x2f,0x73,0x6f,0x63,0x6b,0x65,0x74,0x7,0xc,0x49,0x4e,0x50,0x55,0x54,0x52,0x43,0x2f,0x65,0x74,0x63,0x2f,0x69,0x6e,0x70,0x75,0x74,0x72,0x63,0x8,0x4,0x48,0x49,0x53,0x54,0x53,0x49,0x5a,0x4
 
5,0x31,0x30,0x30,0x30,0x15,0x4,0x58,0x5f,0x4a,0x41,0x56,0x41,0x42,0x52,0x49,0x44,0x47,0x45,0x5f,0x52,0x45,0x44,0x49,0x52,0x45,0x43,0x54,0x39,0x32,0x36,0x37,0xb,0x1e,0x53,0x43,0x52,0x49,0x50,0x54,0x5f,0x4e,0x41,0x4d,0x45,0x2f,0x4a,0x61,0x76,0x61,0x42,0x72,0x69,0x64,0x67,0x65,0x2f,0x73,0x65,0x73,0x73,0x69,0x6f,0x6e,0x53,0x68,0x61,0x72,0x69,0x6e,0x67,0x2e,0x70,0x68,0x70,0x4,0x5f,0x50,0x41,0x54,0x48,0x2f,0x75,0x73,0x72,0x2f,0x6b,0x65,0x72,0x62,0x65,0x72,0x6f,0x73,0x2f,0x62,0x69,0x6e,0x3a,0x2f,0x75,0x73,0x72,0x2f,0x6c,0x6f,0x63,0x61,0x6c,0x2f,0x62,0x69,0x6e,0x3a,0x2f,0x75,0x73,0x72,0x2f,0x62,0x69,0x6e,0x3a,0x2f,0x62,0x69,0x6e,0x3a,0x2f,0x75,0x73,0x72,0x2f,0x6c,0x6f,0x63,0x61,0x6c,0x2f,0x73,0x62,0x69,0x6e,0x3a,0x2f,0x75,0x73,0x72,0x2f,0x73,0x62,0x69,0x6e,0x3a,0x2f,0x73,0x62,0x69,0x6e,0x3a,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x62,0x69,0x6e,0xd,0x33,0x44,0x4f,0x43,0x55,0x4d,0x45,0x4e,0x54,0x5f,0x52,0x4f,0x4f,0x54,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0
 
x64,0x6f,0x72,0x61,0x2f,0x61,0x70,0x61,0x63,0x68,0x65,0x2d,0x74,0x6f,0x6d,0x63,0x61,0x74,0x2d,0x37,0x2e,0x30,0x2e,0x32,0x2f,0x77,0x65,0x62,0x61,0x70,0x70,0x73,0x2f,0x4a,0x61,0x76,0x61,0x42,0x72,0x69,0x64,0x67,0x65,0x13,0x1e,0x48,0x54,0x54,0x50,0x5f,0x41,0x43,0x43,0x45,0x50,0x54,0x5f,0x43,0x48,0x41,0x52,0x53,0x45,0x54,0x49,0x53,0x4f,0x2d,0x38,0x38,0x35,0x39,0x2d,0x31,0x2c,0x75,0x74,0x66,0x2d,0x38,0x3b,0x71,0x3d,0x30,0x2e,0x37,0x2c,0x2a,0x3b,0x71,0x3d,0x30,0x2e,0x37,0xb,0x9,0x52,0x45,0x4d,0x4f,0x54,0x45,0x5f,0x48,0x4f,0x53,0x54,0x31,0x32,0x37,0x2e,0x30,0x2e,0x30,0x2e,0x31,0xf,0xa,0x48,0x54,0x54,0x50,0x5f,0x43,0x4f,0x4e,0x4e,0x45,0x43,0x54,0x49,0x4f,0x4e,0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69,0x76,0x65,0x9,0xe,0x48,0x54,0x54,0x50,0x5f,0x48,0x4f,0x53,0x54,0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74,0x3a,0x38,0x30,0x38,0x30,0x15,0x4,0x50,0x48,0x50,0x5f,0x46,0x43,0x47,0x49,0x5f,0x4d,0x41,0x58,0x5f,0x52,0x45,0x51,0x55,0x45,0x53,0x54,0x53,0x35,0x30,0x30,0x30,0x8,0xb,0x47,0x44,0x4d
 
,0x5f,0x4c,0x41,0x4e,0x47,0x65,0x6e,0x5f,0x55,0x53,0x2e,0x55,0x54,0x46,0x2d,0x38,0xa,0x2c,0x58,0x41,0x55,0x54,0x48,0x4f,0x52,0x49,0x54,0x59,0x2f,0x76,0x61,0x72,0x2f,0x72,0x75,0x6e,0x2f,0x67,0x64,0x6d,0x2f,0x61,0x75,0x74,0x68,0x2d,0x66,0x6f,0x72,0x2d,0x66,0x65,0x64,0x6f,0x72,0x61,0x2d,0x36,0x62,0x4f,0x76,0x61,0x54,0x2f,0x64,0x61,0x74,0x61,0x62,0x61,0x73,0x65,0x14,0x3f,0x58,0x5f,0x4a,0x41,0x56,0x41,0x42,0x52,0x49,0x44,0x47,0x45,0x5f,0x43,0x4f,0x4e,0x54,0x45,0x58,0x54,0x36,0x40,0x25,0x32,0x46,0x68,0x6f,0x6d,0x65,0x25,0x32,0x46,0x66,0x65,0x64,0x6f,0x72,0x61,0x25,0x32,0x46,0x61,0x70,0x61,0x63,0x68,0x65,0x2d,0x74,0x6f,0x6d,0x63,0x61,0x74,0x2d,0x37,0x2e,0x30,0x2e,0x32,0x25,0x32,0x46,0x77,0x65,0x62,0x61,0x70,0x70,0x73,0x25,0x32,0x46,0x4a,0x61,0x76,0x61,0x42,0x72,0x69,0x64,0x67,0x65,0x8,0x6,0x55,0x53,0x45,0x52,0x4e,0x41,0x4d,0x45,0x66,0x65,0x64,0x6f,0x72,0x61,0xb,0x26,0x53,0x53,0x48,0x5f,0x41,0x53,0x4b,0x50,0x41,0x53,0x53,0x2f,0x75,0x73,0x72,0x2f,0x6c,0x69,0x62,0x65,0x78,0x65,0x63,0x
 
2f,0x6f,0x70,0x65,0x6e,0x73,0x73,0x68,0x2f,0x67,0x6e,0x6f,0x6d,0x65,0x2d,0x73,0x73,0x68,0x2d,0x61,0x73,0x6b,0x70,0x61,0x73,0x73,0xf,0x66,0x48,0x54,0x54,0x50,0x5f,0x55,0x53,0x45,0x52,0x5f,0x41,0x47,0x45,0x4e,0x54,0x4d,0x6f,0x7a,0x69,0x6c,0x6c,0x61,0x2f,0x35,0x2e,0x30,0x20,0x28,0x58,0x31,0x31,0x3b,0x20,0x55,0x3b,0x20,0x4c,0x69,0x6e,0x75,0x78,0x20,0x69,0x36,0x38,0x36,0x3b,0x20,0x65,0x6e,0x2d,0x55,0x53,0x3b,0x20,0x72,0x76,0x3a,0x31,0x2e,0x39,0x2e,0x30,0x2e,0x34,0x29,0x20,0x47,0x65,0x63,0x6b,0x6f,0x2f,0x32,0x30,0x30,0x38,0x31,0x31,0x31,0x32,0x31,0x37,0x20,0x46,0x65,0x64,0x6f,0x72,0x61,0x2f,0x33,0x2e,0x30,0x2e,0x34,0x2d,0x31,0x2e,0x66,0x63,0x31,0x30,0x20,0x46,0x69,0x72,0x65,0x66,0x6f,0x78,0x2f,0x33,0x2e,0x30,0x2e,0x34,0x5,0x1,0x53,0x48,0x4c,0x56,0x4c,0x33,0xb,0x3f,0x48,0x54,0x54,0x50,0x5f,0x41,0x43,0x43,0x45,0x50,0x54,0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x2c,0x61,0x70,0x70,0x6c,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x2f,0x78,0x68,0x74,0x6d,0x6c,0x2b,0x78,0x6d,0x6c,0x2c,0x61,
 
0x70,0x70,0x6c,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x2f,0x78,0x6d,0x6c,0x3b,0x71,0x3d,0x30,0x2e,0x39,0x2c,0x2a,0x2f,0x2a,0x3b,0x71,0x3d,0x30,0x2e,0x38,0xf,0x3,0x48,0x54,0x54,0x50,0x5f,0x4b,0x45,0x45,0x50,0x5f,0x41,0x4c,0x49,0x56,0x45,0x33,0x30,0x30,0xf,0x1a,0x58,0x46,0x49,0x4c,0x45,0x53,0x45,0x41,0x52,0x43,0x48,0x50,0x41,0x54,0x48,0x2f,0x75,0x73,0x72,0x2f,0x64,0x74,0x2f,0x61,0x70,0x70,0x2d,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x73,0x2f,0x25,0x4c,0x2f,0x44,0x74,0x9,0xe,0x43,0x4f,0x4c,0x4f,0x52,0x54,0x45,0x52,0x4d,0x67,0x6e,0x6f,0x6d,0x65,0x2d,0x74,0x65,0x72,0x6d,0x69,0x6e,0x61,0x6c,0xf,0xa,0x53,0x45,0x52,0x56,0x45,0x52,0x5f,0x53,0x4f,0x46,0x54,0x57,0x41,0x52,0x45,0x4a,0x61,0x76,0x61,0x42,0x72,0x69,0x64,0x67,0x65,0x7,0x6,0x4c,0x4f,0x47,0x4e,0x41,0x4d,0x45,0x66,0x65,0x64,0x6f,0x72,0x61,0x8,0x8,0x57,0x49,0x4e,0x44,0x4f,0x57,0x49,0x44,0x36,0x35,0x30,0x33,0x36,0x36,0x33,0x34,0xf,0x46,0x53,0x43,0x52,0x49,0x50,0x54,0x5f,0x46,0x49,0x4c,0x45,0x4e,0x41,0x4d,0x45,0x2f,0x68,0x6f,0x6d,0x65,0
 
x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x61,0x70,0x61,0x63,0x68,0x65,0x2d,0x74,0x6f,0x6d,0x63,0x61,0x74,0x2d,0x37,0x2e,0x30,0x2e,0x32,0x2f,0x77,0x65,0x62,0x61,0x70,0x70,0x73,0x2f,0x4a,0x61,0x76,0x61,0x42,0x72,0x69,0x64,0x67,0x65,0x2f,0x73,0x65,0x73,0x73,0x69,0x6f,0x6e,0x53,0x68,0x61,0x72,0x69,0x6e,0x67,0x2e,0x70,0x68,0x70,0x1,0x22,0x5f,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x6a,0x72,0x65,0x31,0x2e,0x36,0x2e,0x30,0x5f,0x32,0x31,0x2f,0x2f,0x62,0x69,0x6e,0x2f,0x6a,0x61,0x76,0x61,0xa,0xe,0x58,0x4d,0x4f,0x44,0x49,0x46,0x49,0x45,0x52,0x53,0x40,0x69,0x6d,0x3d,0x69,0x6d,0x73,0x65,0x74,0x74,0x69,0x6e,0x67,0x73,0xe,0x3,0x52,0x45,0x51,0x55,0x45,0x53,0x54,0x5f,0x4d,0x45,0x54,0x48,0x4f,0x44,0x47,0x45,0x54,0xd,0x17,0x53,0x53,0x48,0x5f,0x41,0x55,0x54,0x48,0x5f,0x53,0x4f,0x43,0x4b,0x2f,0x74,0x6d,0x70,0x2f,0x6b,0x65,0x79,0x72,0x69,0x6e,0x67,0x2d,0x61,0x6f,0x30,0x34,0x31,0x6a,0x2f,0x73,0x73,0x68,0xf,0x6f,0x4c,0x44,0x5f,0x4c,0x49,0x42,0x52,0x41,0x52,0x59,0x5f,0x50,0x
 
41,0x54,0x48,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x6a,0x72,0x65,0x31,0x2e,0x36,0x2e,0x30,0x5f,0x32,0x31,0x2f,0x6c,0x69,0x62,0x2f,0x69,0x33,0x38,0x36,0x2f,0x63,0x6c,0x69,0x65,0x6e,0x74,0x3a,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x6a,0x72,0x65,0x31,0x2e,0x36,0x2e,0x30,0x5f,0x32,0x31,0x2f,0x6c,0x69,0x62,0x2f,0x69,0x33,0x38,0x36,0x3a,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x6a,0x72,0x65,0x31,0x2e,0x36,0x2e,0x30,0x5f,0x32,0x31,0x2f,0x2e,0x2e,0x2f,0x6c,0x69,0x62,0x2f,0x69,0x33,0x38,0x36,0x11,0x1,0x50,0x48,0x50,0x5f,0x46,0x43,0x47,0x49,0x5f,0x43,0x48,0x49,0x4c,0x44,0x52,0x45,0x4e,0x35,0x5,0x9,0x53,0x48,0x45,0x4c,0x4c,0x2f,0x62,0x69,0x6e,0x2f,0x62,0x61,0x73,0x68,0x18,0x48,0x44,0x42,0x55,0x53,0x5f,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x5f,0x42,0x55,0x53,0x5f,0x41,0x44,0x44,0x52,0x45,0x53,0x53,0x75,0x6e,0x69,0x78,0x3a,0x61,0x62,0x73,0x74,0x72,0x61,0x63,0x74,0x3d,0x2f,0x74,0x6d,0x70,0x2f,0x64,0x62,0x75,0x73
 
,0x2d,0x34,0x30,0x5a,0x45,0x48,0x6a,0x4b,0x63,0x62,0x62,0x2c,0x67,0x75,0x69,0x64,0x3d,0x33,0x32,0x38,0x33,0x62,0x38,0x37,0x39,0x30,0x34,0x61,0x37,0x31,0x61,0x37,0x65,0x33,0x38,0x34,0x31,0x33,0x61,0x31,0x34,0x34,0x63,0x38,0x31,0x34,0x63,0x65,0x35,0x11,0x4,0x47,0x4e,0x4f,0x4d,0x45,0x5f,0x4b,0x45,0x59,0x52,0x49,0x4e,0x47,0x5f,0x50,0x49,0x44,0x32,0x31,0x31,0x37,0xb,0x4,0x53,0x45,0x52,0x56,0x45,0x52,0x5f,0x50,0x4f,0x52,0x54,0x38,0x30,0x38,0x30,0xc,0x2d,0x47,0x54,0x4b,0x5f,0x52,0x43,0x5f,0x46,0x49,0x4c,0x45,0x53,0x2f,0x65,0x74,0x63,0x2f,0x67,0x74,0x6b,0x2f,0x67,0x74,0x6b,0x72,0x63,0x3a,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x2e,0x67,0x74,0x6b,0x72,0x63,0x2d,0x31,0x2e,0x32,0x2d,0x67,0x6e,0x6f,0x6d,0x65,0x32,0xb,0x9,0x52,0x45,0x4d,0x4f,0x54,0x45,0x5f,0x41,0x44,0x44,0x52,0x31,0x32,0x37,0x2e,0x30,0x2e,0x30,0x2e,0x31,0x8,0x19,0x4a,0x52,0x45,0x5f,0x48,0x4f,0x4d,0x45,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x2f,0x6a,0x72,0x65,0x31,0x2e,0x36,
 
0x2e,0x30,0x5f,0x32,0x31,0x2f,0xf,0x5,0x44,0x45,0x53,0x4b,0x54,0x4f,0x50,0x5f,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x67,0x6e,0x6f,0x6d,0x65,0x7,0x4,0x44,0x49,0x53,0x50,0x4c,0x41,0x59,0x3a,0x30,0x2e,0x30,0x4,0x6,0x55,0x53,0x45,0x52,0x66,0x65,0x64,0x6f,0x72,0x61,0x4,0xc,0x48,0x4f,0x4d,0x45,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x66,0x65,0x64,0x6f,0x72,0x61,0x8,0x18,0x4c,0x45,0x53,0x53,0x4f,0x50,0x45,0x4e,0x7c,0x2f,0x75,0x73,0x72,0x2f,0x62,0x69,0x6e,0x2f,0x6c,0x65,0x73,0x73,0x70,0x69,0x70,0x65,0x2e,0x73,0x68,0x20,0x25,0x73,0x11,0x7,0x47,0x41,0x54,0x45,0x57,0x41,0x59,0x5f,0x49,0x4e,0x54,0x45,0x52,0x46,0x41,0x43,0x45,0x43,0x47,0x49,0x2f,0x31,0x2e,0x31,0x9,0x80,0x0,0x4,0x36,0x4c,0x53,0x5f,0x43,0x4f,0x4c,0x4f,0x52,0x53,0x6e,0x6f,0x3d,0x30,0x30,0x3a,0x66,0x69,0x3d,0x30,0x30,0x3a,0x64,0x69,0x3d,0x30,0x30,0x3b,0x33,0x34,0x3a,0x6c,0x6e,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x70,0x69,0x3d,0x34,0x30,0x3b,0x33,0x33,0x3a,0x73,0x6f,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x64,0x6f,0x3d,0x30,0x30,0x3b,0x33,0x
 
35,0x3a,0x62,0x64,0x3d,0x34,0x30,0x3b,0x33,0x33,0x3b,0x30,0x31,0x3a,0x63,0x64,0x3d,0x34,0x30,0x3b,0x33,0x33,0x3b,0x30,0x31,0x3a,0x6f,0x72,0x3d,0x34,0x30,0x3b,0x33,0x31,0x3b,0x30,0x31,0x3a,0x6d,0x69,0x3d,0x30,0x31,0x3b,0x30,0x35,0x3b,0x33,0x37,0x3b,0x34,0x31,0x3a,0x73,0x75,0x3d,0x33,0x37,0x3b,0x34,0x31,0x3a,0x73,0x67,0x3d,0x33,0x30,0x3b,0x34,0x33,0x3a,0x63,0x61,0x3d,0x33,0x30,0x3b,0x34,0x31,0x3a,0x74,0x77,0x3d,0x33,0x30,0x3b,0x34,0x32,0x3a,0x6f,0x77,0x3d,0x33,0x34,0x3b,0x34,0x32,0x3a,0x73,0x74,0x3d,0x33,0x37,0x3b,0x34,0x34,0x3a,0x65,0x78,0x3d,0x30,0x30,0x3b,0x33,0x32,0x3a,0x2a,0x2e,0x74,0x61,0x72,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x74,0x67,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x73,0x76,0x67,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x61,0x72,0x6a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x74,0x61,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x6c,0x7a,0x68,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x6c,0x7a,0x6d,0x61,0x3d,0x30,0x30,0
 
x3b,0x33,0x31,0x3a,0x2a,0x2e,0x7a,0x69,0x70,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x5a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x64,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x67,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x62,0x7a,0x32,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x74,0x62,0x7a,0x32,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x62,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x74,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x64,0x65,0x62,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x72,0x70,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x6a,0x61,0x72,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x72,0x61,0x72,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x61,0x63,0x65,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x7a,0x6f,0x6f,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x63,0x70,0x69,0x6f,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x37,0x7a,0x3d,0x30,0x30,0x3b,
 
0x33,0x31,0x3a,0x2a,0x2e,0x72,0x7a,0x3d,0x30,0x30,0x3b,0x33,0x31,0x3a,0x2a,0x2e,0x6a,0x70,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6a,0x70,0x65,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x67,0x69,0x66,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x62,0x6d,0x70,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x70,0x62,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x70,0x67,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x70,0x70,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x74,0x67,0x61,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x78,0x62,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x78,0x70,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x74,0x69,0x66,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x74,0x69,0x66,0x66,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x70,0x6e,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x6e,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x70,0x63,0x78,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e
 
,0x6d,0x6f,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x70,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x70,0x65,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x32,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x6b,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6f,0x67,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x70,0x34,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x34,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6d,0x70,0x34,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x76,0x6f,0x62,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x71,0x74,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x6e,0x75,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x77,0x6d,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x61,0x73,0x66,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x72,0x6d,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x72,0x6d,0x76,0x62,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x66,0x6c,0x63,0x3d,0x3
 
0,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x61,0x76,0x69,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x66,0x6c,0x69,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x67,0x6c,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x64,0x6c,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x78,0x63,0x66,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x78,0x77,0x64,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x79,0x75,0x76,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x73,0x76,0x67,0x3d,0x30,0x30,0x3b,0x33,0x35,0x3a,0x2a,0x2e,0x61,0x61,0x63,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x61,0x75,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x66,0x6c,0x61,0x63,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x6d,0x69,0x64,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x6d,0x69,0x64,0x69,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x6d,0x6b,0x61,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x6d,0x70,0x33,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x6d,0x70,0x63,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x
 
2e,0x6f,0x67,0x67,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x72,0x61,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0x2a,0x2e,0x77,0x61,0x76,0x3d,0x30,0x30,0x3b,0x33,0x36,0x3a,0xf,0x11,0x4f,0x52,0x42,0x49,0x54,0x5f,0x53,0x4f,0x43,0x4b,0x45,0x54,0x44,0x49,0x52,0x2f,0x74,0x6d,0x70,0x2f,0x6f,0x72,0x62,0x69,0x74,0x2d,0x66,0x65,0x64,0x6f,0x72,0x61,0xb,0x1e,0x52,0x45,0x51,0x55,0x45,0x53,0x54,0x5f,0x55,0x52,0x49,0x2f,0x4a,0x61,0x76,0x61,0x42,0x72,0x69,0x64,0x67,0x65,0x2f,0x73,0x65,0x73,0x73,0x69,0x6f,0x6e,0x53,0x68,0x61,0x72,0x69,0x6e,0x67,0x2e,0x70,0x68,0x70,0x4,0xb,0x4c,0x41,0x4e,0x47,0x65,0x6e,0x5f,0x55,0x53,0x2e,0x55,0x54,0x46,0x2d,0x38,0x1,0x4,0x0,0x1,0x0,0x0,0x0,0x0,0x1,0x5,0x0,0x1,0x0,0x0,0x0,0x0);

$dataStr="";

for($i=0; $i<count($data); $i++) {

  $dataStr.=chr($data[$i]);

}



$fp = fsockopen("127.0.0.1", 9667, &$errno, &$errstr) or
die("fsockopen");

for ($k=0; $k<100; $k++) {

  fwrite($fp, $dataStr) or die("send");

  $n=10536;

  do {

    $c=strlen(fread($fp, $n));

    if (feof($fp)) die("fread");

    $n-=$c;

  } while($n>0);

}

fclose($fp);

-----------end of ack_delay.php------------



REDIRECT_STATUS="200" PHP_FCGI_CHILDR="5" PHP_FCGI_MAX_REQUESTS="50000"
~/php-cgi533.patched -b 127.0.0.1:9667



#unpatched

time ~/php ack_delay.php

real    0m4.135s

user    0m0.020s

sys     0m0.023s



#patched

real    0m0.140s

user    0m0.022s

sys     0m0.028s



Which means php fastcgi > 5.1.4 is more 30 times slower than 5.1.4.



To reproduce:
http://sourceforge.net/projects/php-java-bridge/files/RHEL_FC%20SecurityEnhancedLinux/php-java-bridge_6.2.1rc2/



PHP test script created from:
http://php-java-bridge.cvs.sourceforge.net/viewvc/php-java-bridge/php-java-bridge/server/php/java/bridge/http/FCGIConnectionOutputStream.java?revision=1.2&view=markup&sortby=date
and
http://php-java-bridge.cvs.sourceforge.net/viewvc/php-java-bridge/php-java-bridge/server/php/java/bridge/http/FCGIConnectionInputStream.java?revision=1.2&view=markup&sortby=date



Test system: Fedora 10, Linux kernel 

Linux version 2.6.27.5-117.fc10.i686
(mockbu...@x86-7.fedora.phx.redhat.com) (gcc version 4.3.2 20081105 (Red
Hat 4.3.2-7) (GCC) ) #1 SMP Tue Nov 18 12:19:59 EST 2008







> I don't know what is the "ack delay". As I know TCP_NODELAY just
disables the > Nagle algorithm and this makes packets to be always sent
ASAP. As result it 

> may produce more packets. Probably it may affect FastCGI only in some


> specific scenarios.



Please see http://en.wikipedia.org/wiki/Nagle%27s_algorithm



"With both algorithms enabled, applications which do two successive
writes to a TCP connection, followed by a read which will not be
fulfilled until after the data from the second write has reached the
destination, experience a constant delay of up to 500 milliseconds, the
"ACK delay"."





Regards,

Jost Bökemeier

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=46723


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

Reply via email to