Streaming/Chunked upstream responses are buffered when pagespeed is on #1163
Comments
Hmm. That's not supposed to happen: we should be passing through flushes from the origin, not buffering, and we should do that even if you had all the rewriters on. (And we actually have some pretty complicated logic in our rewriters to make sure we can safely handle a flush anywhere.) I just tested this with the echo module though, and I'm seeing exactly what you're seeing:
This is with:
|
I had thought we had a test for this case, but all I'm seeing is Headers are not destroyed by a flush event. |
@jeffkaufman there are some changes around flushing behavior contained in #936 |
I have a nice test for this; I'll send it out after lunch |
Actually, your test in #936 is good, and mine is too complicated. The root of the problem here is that we never set the flush flag, in nginx. Thinking now, we should probably set the flush flag whenever it's set on the buffer chain coming in? Looking over #936 and apache/incubator-pagespeed-mod#1066, it's not actually clear to me whether this would fix #1163 by default? (I poked @morlovich again about reviewing apache/incubator-pagespeed-mod#1066 -- I'm sorry it's taking so long!) |
On flushing behaviour for the proposed change -- from https://github.com/pagespeed/ngx_pagespeed/pull/936/files#r28490250 :
The argument for optionizing it is that when we would have very chunky incoming content, it may be nice to have an option to not follow that. But I think defaulting to following flushes would be good? |
I'm not sure we need an option not to follow upstream flushes; we've always followed them for apache with no complaints. We could add an option not to follow them, but then either:
|
If Apache always behaved like that without trouble, that makes me think the option is overkill too. But Perhaps remove the |
Background: This is already all controllable via options->idle_flush_time_ms() and On Fri, Mar 25, 2016 at 4:05 PM, Otto van der Schaaf <
|
I'm seeing significantly elevated TTFB (200ms instead of 70ms with ?PageSpeed=off for ~260kb of HTML) using 1.11.33.0 on nginx 1.9.15 with fastcgi. This is a new install so I have no previous data for comparison. In my case, enabling the inline_images filter seems to reduce TTFB by 50ms. All details and debug log can be found here. Any chance this is the same buffering issue (I'd expect pagespeed to at least flush the header asap) or just unavoidable parsing overhead? |
I have an upstream Django server which flushes html in chunks and then optimized by ngx_pagespeed. Config looks like below
NPS_VERSION=1.10.33.6
NGINX_VERSION=1.8.1
Nginx alone without pagespeed doesn't do any buffering.
I have tried the same with Apache ModPageSpeed and there is no buferring with Apache and the optimzied html is flushed immediately
Is there any configuration that I am missing with nginx?
The text was updated successfully, but these errors were encountered: