Skip to content

examples: add gzip - #16440

Merged
phlax merged 14 commits into
envoyproxy:mainfrom
daixiang0:gzip-example
Jun 1, 2021
Merged

phlax merged 14 commits into
envoyproxy:mainfrom
daixiang0:gzip-example

Conversation

@daixiang0

Copy link
Copy Markdown
Member

Signed-off-by: Long Dai [email protected]

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Commit Message: Add gzip example.
Additional Description:

Some discuess in slack.

Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]

@phlax

phlax commented May 12, 2021

Copy link
Copy Markdown
Member

@daixiang0 first pass this looks good - thanks

im wondering if we could do this without reference to stats as its somewhat confusing - preferably just use a more generic backend

@daixiang0

Copy link
Copy Markdown
Member Author

How about using nginx?

@phlax

phlax commented May 12, 2021

Copy link
Copy Markdown
Member

How about using nginx?

its an option i guess - but probably not the one i would choose

@phlax

phlax commented May 12, 2021

Copy link
Copy Markdown
Member

off the top of my head - how about a flask container that serves a 100MB file of zeros

@phlax phlax self-assigned this May 12, 2021
@daixiang0

Copy link
Copy Markdown
Member Author

Not familiar with flask, would try it later.

@phlax

phlax commented May 12, 2021

Copy link
Copy Markdown
Member

i guess what would be helpful here is to have 2 indentical files with different content types - one should be served compressed and the other not

@daixiang0

Copy link
Copy Markdown
Member Author

It depends on request compressed or not, different file types would make confuse I think.

@phlax

phlax commented May 12, 2021

Copy link
Copy Markdown
Member

It depends on request compressed or not, different file types would make confuse I think.

i dont think so - sure it depends on the accept header - but it also depends on what the server is willing to compress (see #16450 for the kind of problem that this might disambiguate)

@daixiang0

daixiang0 commented May 13, 2021 •

Copy link
Copy Markdown
Member Author

How about config different compressed support type, if not config test/plain, it would still return un-compressed contents?

Also, stats compressed is a common case I think.

@phlax

@phlax

phlax commented May 13, 2021

Copy link
Copy Markdown
Member

How about config different compressed support type, if not config test/plain, it would still return un-compressed contents?

iiuc then yep that is the idea - one file that is compressed and one that is not

Also, stats compressed is a common case I think.

ok, lets keep the stats, but i think its important to show envoy proxying from an upstream with compression

@daixiang0

Copy link
Copy Markdown
Member Author

@phlax please review.

@daixiang0
daixiang0 force-pushed the gzip-example branch 2 times, most recently from 1805d21 to 50b7c4d Compare May 14, 2021 07:03
Comment thread examples/front-proxy/service-envoy.yaml Resolved
Comment thread examples/gzip/Dockerfile-service Resolved
Comment thread examples/gzip/gzip-envoy.yaml Resolved
Comment thread examples/gzip/gzip-envoy.yaml Resolved
Comment thread examples/gzip/service-envoy.yaml Resolved
Comment thread examples/gzip/verify.sh Resolved
Comment thread examples/gzip/service.py Resolved
@phlax

phlax commented May 14, 2021

Copy link
Copy Markdown
Member

@daixiang0 ive done a first review - looking great - it will probably take a few iterations, but this work is really appreciated

@phlax

phlax commented May 14, 2021

Copy link
Copy Markdown
Member

another thing im wondering is whether we should demonstrate decompression

daixiang0 added 5 commits May 16, 2021 16:23
Signed-off-by: Long Dai <[email protected]>
Signed-off-by: Long Dai <[email protected]>
Signed-off-by: Long Dai <[email protected]>
Signed-off-by: Long Dai <[email protected]>
1
Signed-off-by: Long Dai <[email protected]>
@phlax

phlax commented May 17, 2021

Copy link
Copy Markdown
Member

hmm, ok, this works:

$ curl -si -H "Accept-Encoding: gzip" http://localhost:8089/file.json 
HTTP/1.1 200 OK
content-disposition: inline; filename=file.json
content-type: application/json
last-modified: Mon, 17 May 2021 09:53:27 GMT
cache-control: no-cache
date: Mon, 17 May 2021 12:00:54 GMT
server: envoy
x-envoy-upstream-service-time: 3
content-encoding: gzip
vary: Accept-Encoding
transfer-encoding: chunked

@phlax

phlax commented May 17, 2021 •

Copy link
Copy Markdown
Member

im completely baffled as to why -I works when checking brotli on the envoy website but doesnt when checking gzip on this example - but either way i think the pattern we want is

responds_with_header \
    "content-encoding: gzip" \
    http://localhost:8089/file.json \
    -si -H "Accept-Encoding: gzip"

@daixiang0

Copy link
Copy Markdown
Member Author

@phlax hi, I find that it do not mount config as expected as log says. I run it without error at local.

@phlax

phlax commented May 18, 2021

Copy link
Copy Markdown
Member

I find that it do not mount config as expected

you need to make the file world-readable - see other examples

the reason for this is that some devs have strict umask settings (ie only user/group readable) so the tests mimick that environment

@daixiang0

Copy link
Copy Markdown
Member Author

@phlax Hi, could it merged?

@phlax

phlax commented May 19, 2021

Copy link
Copy Markdown
Member

@phlax Hi, could it merged?

this is going to take a couple more iterations i think

i will do a full review shortly

as said - this PR is really appreciated and will be a very welcome addition - but i think it will take a bit more work first

@phlax

phlax commented May 19, 2021

Copy link
Copy Markdown
Member

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks @daixiang0 we are definitely getting there - altho i think a little way to go

i have mostly focused on the docs in this review - next round - once docs are ready - i will look more at the verify.sh script as this needs to match the docs as closely as possible

Comment thread examples/gzip/gzip-envoy.yaml Resolved
Comment thread examples/gzip/gzip-envoy.yaml Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread examples/gzip/gzip-envoy.yaml Resolved
@daixiang0

Copy link
Copy Markdown
Member Author

@phlax wait for your review :)

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks @daixiang0

hopefully this will be the last iteration - lets see...

Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread docs/root/start/sandboxes/gzip.rst Resolved
Comment thread examples/gzip/verify.sh Resolved
Comment thread examples/gzip/verify.sh Resolved
Comment thread examples/gzip/verify.sh Resolved
Comment thread examples/gzip/verify.sh Resolved
Comment thread examples/gzip/verify.sh Resolved
@daixiang0
daixiang0 force-pushed the gzip-example branch 3 times, most recently from a69728a to bc48af1 Compare May 26, 2021 08:28
@phlax

phlax commented May 26, 2021

Copy link
Copy Markdown
Member

@daixiang0 can you fix the trailing whitespace issue - you probably want to fix your editor to prevent this

Comment thread examples/gzip/verify.sh Resolved
Comment thread examples/gzip/verify.sh Resolved

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@daixiang0 a couple of minor nits - once they are fixed should be gtm

@daixiang0

Copy link
Copy Markdown
Member Author

@phlax I fix one about trailing whitespace issue, and do not find more. If miss, please tell me.

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thanks @daixiang0

@rojkov

rojkov commented Jun 1, 2021

Copy link
Copy Markdown
Member

Great example! Thanks!

Another example could be made for brotli compression.

@phlax

phlax commented Jun 1, 2021

Copy link
Copy Markdown
Member

Another example could be made for brotli compression.

that would definitely be helpful - it will require tls in the mix as well i think

@daixiang0 is that something you could take on ?

@phlax
phlax merged commit e898b6e into envoyproxy:main Jun 1, 2021
@daixiang0

Copy link
Copy Markdown
Member Author

I can take it later :)

@daixiang0
daixiang0 deleted the gzip-example branch June 1, 2021 08:55
@phlax

phlax commented Jun 1, 2021

Copy link
Copy Markdown
Member

cool - added a ticket for it here #16747

leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants