Looking at some more syscall call traces, I'm seeing that
the flush buckets used by php_apache_sapi_ub_write() are
causing very small packets even for script-generated output,
not just for blocks of static text.

For example, I just compared the write patterns for 2.0.37
and 1.3.24, both with the default configuration for PHP-4.2.1,
while delivering a file consisting solely of:
  <?phpinfo() ?>

1.3:

writev(3, [{"HTTP/1.1 200 OK\r\nDate: Sat, 08 J"..., 4089}, {"28\r\n", 
4}, {"<tr valign=\"baseline\" bgcolor=\"#"..., 40}, {"\r\n", 2}], 4) = 4135
write(3, "ffb\r\n<td bgcolor=\"#ccccff\"><b>as"..., 4098) = 4098
writev(3, [{"fdd\r\ntd bgcolor=\"#ccccff\"><b>hig"..., 4068}, {"22\r\n", 
4}, {"</b><br /></td><td align=\"center"..., 34}, {"\r\n", 2}], 4) = 4108
writev(3, [{"ff2\r\n/usr/sbin/sendmail -t -i </"..., 4089}, {"22\r\n", 
4}, {"</b><br /></td><td align=\"center"..., 34}, {"\r\n", 2}], 4) = 4129
(followed by a few more 4KB writes)


2.0:

writev(8, [{"HTTP/1.1 200 OK\r\nDate: Sat, 08 J"..., 220}, {"47\r\n", 
4}, {"<!DOCTYPE HTML PUBLIC \"-//W3C//D"..., 71}, {"\r\n", 2}], 4) = 297
writev(8, [{"6\r\n", 3}, {"<head>", 6}, {"\r\n", 2}], 3) = 11
writev(8, [{"1c\r\n", 4}, {"<style type=\"text/css\"><!--\n", 28}, 
{"\r\n", 2}], 3) = 34
writev(8, [{"1d\r\n", 4}, {"a { text-decoration: none; }\n", 29}, 
{"\r\n", 2}], 3) = 35
writev(8, [{"28\r\n", 4}, {"a:hover { text-decoration: under"..., 40}, 
{"\r\n", 2}], 3) = 46
writev(8, [{"55\r\n", 4}, {"h1 { font-family: arial, helveti"..., 85}, 
{"\r\n", 2}], 3) = 91
writev(8, [{"55\r\n", 4}, {"h2 { font-family: arial, helveti"..., 85}, 
{"\r\n", 2}], 3) = 91
writev(8, [{"49\r\n", 4}, {"body, td { font-family: arial, h"..., 73}, 
{"\r\n", 2}], 3) = 79
writev(8, [{"56\r\n", 4}, {"th { font-family: arial, helveti"..., 86}, 
{"\r\n", 2}], 3) = 92
writev(8, [{"e\r\n", 3}, {"//--></style>\n", 14}, {"\r\n", 2}], 3) = 19
(followed by a thousand more tiny writes)

It looks like "unbuffered" PHP output in 1.3 is benefitting from the
httpd's own buffering.  And "unbuffered" output in 2.0, in contrast,
is really, really not buffered, because of the flush buckets inserted
by php_apache_sapi_ub_write.  And the tiny packets that result in the
2.0 case are likely a major cause of reports of slowness under 2.0.

--Brian




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to