Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Ensure that progress reports are sent ASAP #1430

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Apr 13, 2023

Follow-up to 9741e39.

Various layers in the network stack including php-fpm, Apache’s mod_proxy_fcgi and Nginx’s ngx_http_fastcgi_module will buffer responses.
Since the individual events are short compared to buffer sizes, it may happen that PHP keeps holding onto the output, waiting for the response buffer to fill up, and, in the meanwhile, nginx will time out waiting for the contents.
Let’s prevent that by ending all output buffering we can on PHP side.
(There would be ¿up to two? levels: one for output_buffering, one for zlib.output_compression.)

Web server buffering is not that critical (unless there is another layer like a proxy) but it is useful to disable it as well so that progress updates are reflected live. We will do that for nginx, where it can be done simply with a response header (unless disabled in nginx configuration).

Since the response will now start arriving immediately, we need to modify the client so that the promise returned by refreshAll is only fulfilled once the whole body arrives. Otherwise, the refresh icon would stop spinning just after receiving the headers.

@netlify
Copy link

netlify bot commented Apr 13, 2023

Deploy Preview for selfoss canceled.

Name Link
🔨 Latest commit 9a3d7cf
🔍 Latest deploy log https://app.netlify.com/sites/selfoss/deploys/64378814f0187600080cafcc

@jtojnar jtojnar marked this pull request as draft April 13, 2023 03:46
@jtojnar jtojnar mentioned this pull request Apr 13, 2023
@jtojnar jtojnar marked this pull request as ready for review April 13, 2023 04:21
Follow-up to 9741e39.

Various layers in the network stack including php-fpm, Apache’s `mod_proxy_fcgi` and Nginx’s `ngx_http_fastcgi_module` will buffer responses.
Since the individual events are short compared to buffer sizes, it may happen that PHP keeps holding onto the output, waiting for the response buffer to fill up, and, in the meanwhile, nginx will time out waiting for the contents.
Let’s prevent that by ending all output buffering we can on PHP side.
(There would be ¿up to two? levels: one for `output_buffering`, one for `zlib.output_compression`.)

Web server buffering is not that critical (unless there is another layer like a proxy) but it is useful to disable it as well so that progress updates are reflected live. We will do that for nginx, where it can be done simply with a response header (unless disabled in nginx configuration).

Since the response will now start arriving immediately, we need to modify the client so that the promise returned by `refreshAll` is only fulfilled once the whole body arrives. Otherwise, the refresh icon would stop spinning just after receiving the headers.
@jtojnar jtojnar merged commit 9a3d7cf into master Apr 13, 2023
@jtojnar jtojnar deleted the update-buffering branch April 13, 2023 04:49
@jtojnar jtojnar added this to the 2.20 milestone Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant