Ensure fast flush of HTTP headers and HTML head#2045
Conversation
The fast flush optimisation done in FreshRSS#1133 does not seem to work anymore (need to check if it is related to a PHP version). Work-around when PHP flush() is not working Can be tested by adding a `sleep(5);` after: https://github.com/FreshRSS/FreshRSS/blob/ee902ee7c4370421802768c3105ba269a4f97b16/app/layout/layout.phtml#L27 Follow-up of the performance checks of FreshRSS#2040
|
This is quite strange.
Turning on/off Apache DEFLATE makes a difference when PHP runs as CGI, not when running as module. Documentation:
In my tests, it looks like To test in FreshRSS, add a delay after FreshRSS/app/layout/layout.phtml Line 27 in ee902ee To test outside FreshRSS: <html>
<body>
<pre>
Before...
<?php flush(); sleep(5); ?>
Between...
<?php flush(); sleep(5); ?>
End.
</pre>
</body>
</html>curl -v -N 'http://example.net/flush.php'
# And
curl -v -N --compressed 'http://example.net/flush.php'You are supposed to see an output with HTTP headers and the first part of the HTML, then a pause, then some more. If you only see one long pause and get all the output at once, it is wrong. Additional help / testing welcome. |
Flush a bit later, to be compatible with the default value of 4096 for PHP output_buffering, and thus avoid the need of tuning the value.
|
The fast flush speed optimisation works fine together with compression when PHP runs as Apache module (like we do in the Docker image). |
* Ensure fast flush of HTTP headers and HTML head The fast flush optimisation done in FreshRSS#1133 does not seem to work anymore (need to check if it is related to a PHP version). Work-around when PHP flush() is not working Can be tested by adding a `sleep(5);` after: https://github.com/FreshRSS/FreshRSS/blob/ee902ee7c4370421802768c3105ba269a4f97b16/app/layout/layout.phtml#L27 Follow-up of the performance checks of FreshRSS#2040 * output_buffering in .user.ini for PHP CGI / FPM * Reuse .user.ini for Docker PHP config * Longer flush Flush a bit later, to be compatible with the default value of 4096 for PHP output_buffering, and thus avoid the need of tuning the value.
The fast flush optimisation done in #1133 does not seem to work anymore (need to check if it is related to a PHP version).
Work-around when PHP flush() is not working.
Can be tested by adding a
sleep(5);after:FreshRSS/app/layout/layout.phtml
Line 27 in ee902ee
Follow-up of the performance checks of #2040