about buffer and flush problem(apache mod_fastcgi+ php)

Xuefer Tinys <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
there's already some discuss about this problem, here's the summary:
problem:
small buffer=php have to waiting all buffer is sent to client(user)
big buffer=eat memory + can't do flush();

apache is "sender", mod_fastcgi is "bridge", and php-fcgi is "generator"
for static file, apache read+send file itself
for dynamic, apache only send, mod_fastcgi only pull data from
generator(php) and push it to apache(to be sent)

this is simple, but why problem?
imho, fastcgi should think its buffer as "bridge data storage", not
for "to buffer"(can be config to be a real "buffer")
fastcgi should pull as much data as possible from generator(php), and
push it to sender.
"pusing" may block and indirectly block the generator, the question
is: can we make it non-blocking? if we can, when pushing would-block,
stop pushing, BUT still pull.

when all data is pulled from generator, the generator is free accept
another request. slow client won't affect generator, only bridge and
sender.
flush() problem is also fixed because we push whenever possible, not
only when buffer is full(because we don't think it's buffer)
php itself can do buffer, which improve network performance.

even save data in file, is better than blocking generator, because
generator mostly takes up more resource than sender and bridge, e.g.:
database connection, memory pool

how about your idea?

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.