开发者

How output buffering blocks in PHP/Apache works?

开发者 https://www.devze.com 2022-12-16 07:07 出处:网络
Suppose I am echoing random data from PHP to browser. Total amount of random data is about XGb and echo is done in YKb chunks. ob_start() is not used. Will echo calls block after PHP and Apache buffer

Suppose I am echoing random data from PHP to browser. Total amount of random data is about XGb and echo is done in YKb chunks. ob_start() is not used. Will echo calls block after PHP and Apache buffers are full (client is not capable of consuming data with the same speed it is generated)? If so, how much in size PHP and Apache buffers? Do I understand correctly, the process:

  • PHP echo is sending bytes to php output buffer until it is full. After that echo starts to block until some buffer is sent to Apache and thus cleared
  • PHP is sending data from it's output buffer until Apache buffer is开发者_JAVA技巧 full. After that Apache stops receiving data from PHP and waits, until part the buffer is sent to client and cleared.

P.S. If you are suprised by the stupidity of the task I am going to achieve, I can say, that I am writting small traffic balancing script for a dedicatied server with certain traffic rules applied (IN/OUT traffic ratio should be kept at certain value).


This can be related to the SendBufferSize Directive.

Maybe this will help http://fplanque.com/dev/linux/why-echo-is-slow-in-php-how-to-make-it-really-fast

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号