Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Add option to make ProxyFetch forward incoming flushes#1336

Closed
oschaaf wants to merge 1 commit intomasterfrom
oschaaf-master-flushing
Closed

Add option to make ProxyFetch forward incoming flushes#1336
oschaaf wants to merge 1 commit intomasterfrom
oschaaf-master-flushing

Conversation

@oschaaf
Copy link
Copy Markdown
Member

@oschaaf oschaaf commented Jul 4, 2016

ngx_pagespeed currently buffers when rewriting HTML. This adds an
option to make ProxyFetch follow up on any incoming Flush calls
by requesting a Flush on it's associated RewriteDriver. This option
is on by default, on parity with mod_pagespeed's behaviour.

Includes a gtest for ensuring ProxyFetch complies and system tests
to test for consistent default flushing behaviour accross modules.

Will be accompanied by a PR to ngx_pagespeed's repository.
Edit:
The nps pull is:
apache/incubator-pagespeed-ngx#1217

@morlovich
Copy link
Copy Markdown
Contributor

Hmm, how does the integration test work with the timer-based auto-flusher? It seems like there is a potential for flakes there.

(Also I hope that works properly in nginx? Though I suppose it's not that effective when local end is producing a lot of data --- it was mostly meant for proxy use anyway)

@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Jul 6, 2016

I did not test the timer-based auto-flusher, but I also think it's not enabled by default, so I wouldn't expect the test from this PR to be affected.

To enable the timer-based flushing, you would need to configure as follows, right?:

pagespeed FlushHtml on;

I can't find FlushHtml in the current test configuration. As far as I can tell, there currently is no integration test for this option in ngx_pagespeed.

@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Jul 6, 2016

With regard to the timer-based flushing, I think FlushHtml is not documented today. It's a nice option indeed for those using ngx_pagespeed in a proxy setup, and perhaps worth adding to the docs?

Comment thread pagespeed/apache/mod_instaweb.cc Outdated
"wildcard_spec for referer urls which trigger blocking "
"rewrites"),
APACHE_CONFIG_OPTION(kModPagespeedFollowFlushes,
"Attempt to mirror incoming flushes for html streams in the output"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to just give the option a name when registering this, then no code in the file is needed for mod_pagespeed to pick it up.
(Also it won't be inconsistent on whether it's directory vs. global or whatever.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Though the description is likely to be confusing, since mod_pagespeed doesn't generally use ProxyFetch, and I am pretty sure InstawebContext does pass through all the Apache flushes unconditionally.

(Also this doesn't follow the style guide --- can't have one line with arguments indented and another at +4).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

ngx_pagespeed currently buffers when rewriting HTML. This adds an
option to make ProxyFetch follow up on any incoming Flush calls
by requesting a Flush on it's associated RewriteDriver. This option
is on by default, on parity with mod_pagespeed's behaviour.

Includes a gtest for ensuring ProxyFetch complies and system tests
to test for consistent default flushing behaviour accross modules.

Accompanied by a PR in ngx_pagespeed's repo:
apache/incubator-pagespeed-ngx#1217
@oschaaf oschaaf force-pushed the oschaaf-master-flushing branch from a834d30 to 1ddb563 Compare July 6, 2016 22:10
@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Jul 6, 2016

@morlovich addressed your comments and force pushed, PTAL?

const char kModPagespeedForceCaching[] = "ModPagespeedForceCaching";
const char kModPagespeedExperimentVariable[] = "ModPagespeedExperimentVariable";
const char kModPagespeedExperimentSpec[] = "ModPagespeedExperimentSpec";
const char kModPagespeedFollowFlushes[] = "ModPagespeedFollowFlushes";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused now.

@morlovich
Copy link
Copy Markdown
Contributor

Looks good, though I am not certain we need yet another flush knob. Shall I merge this in?

@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Jul 7, 2016

@morlovich It would be great if you could merge it.. Will you take care of removing kModPagespeedFollowFlushes in that case?

@morlovich
Copy link
Copy Markdown
Contributor

Yeah. (Will also need to emulate your PHP thing in google-specific tests, which may take a bit..)

@morlovich
Copy link
Copy Markdown
Contributor

Hmm, this actually fails in Apache for me ---- the PHP flushes don't seem to produce APR_BUCKET_IS_FLUSH buckets for me....

@morlovich
Copy link
Copy Markdown
Contributor

Looks like it can be made to work with mod_Fastcgid handling PHP via:
FcgidOutputBufferSize 0

As hinted by this mod_fcgid changelog entry:
"If FCGI_Fflush() is called in your application, please add "OutputBufferSize 0" in you
httpd.conf, which will not keep any CGI output in cache buffer."

Should be easy enough to add this into debug.conf.template guarded by an

(Though I am having a different test fail afterwards, seemingly unrelated, but investigating)

@morlovich
Copy link
Copy Markdown
Contributor

... And the "unrelated failure" was because some debug output I added was confusing the grep'ing of the debug log in that test.

morlovich added a commit that referenced this pull request Jul 12, 2016
#1336
The tests are tweaked slightly to work with fcgid on Apache and some additional
test environments.
@morlovich
Copy link
Copy Markdown
Contributor

Err, I think I pushed a merge of this, but somehow doesn't seem to show up in the Web gui.

@morlovich
Copy link
Copy Markdown
Contributor

... And now that I complained it does.
Merged slightly tweaked as 02de03e

@morlovich morlovich closed this Jul 12, 2016
@jeffkaufman jeffkaufman deleted the oschaaf-master-flushing branch December 6, 2016 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants