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

disableCompression: Expose configuration to toggle Envoy GZIP compression on the responses #6546

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

chaosbox
Copy link

@chaosbox chaosbox commented Jul 9, 2024

For #6511

This PR adds,

  • Listener configuration that exposes a boolean flag to disable compression, by default compression is enabled. This also provides us a way to disable if the users prefer to trade network for CPU, especially when teams want to run lean Envoy instances and rely on horizontal scalability.
  • We will run the test build for a while in our cluster to show the actual cost benefit.

Related #310, there had been mentions about disabling compression, the ticket we had raised shows the reason where disabling compression can bring cost benefits.

@chaosbox chaosbox requested a review from a team as a code owner July 9, 2024 09:04
@chaosbox chaosbox requested review from skriss and sunjayBhatia and removed request for a team July 9, 2024 09:04
@sunjayBhatia sunjayBhatia requested review from a team, rajatvig and davinci26 and removed request for a team July 9, 2024 09:18
Copy link

github-actions bot commented Jul 9, 2024

Hi @chaosbox! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

dependabot bot and others added 2 commits July 9, 2024 10:42
…jectcontour#6543)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@d70bba7...4fd8129)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: chaosbox <ram29@bskyb.com>
…ponse compression

Signed-off-by: chaosbox <ram29@bskyb.com>
Copy link

The Contour project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 14d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the PR is closed

You can:

  • Ensure your PR is passing all CI checks. PRs that are fully green are more likely to be reviewed. If you are having trouble with CI checks, reach out to the #contour channel in the Kubernetes Slack workspace.
  • Mark this PR as fresh by commenting or pushing a commit
  • Close this PR
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 25, 2024
@chaosbox
Copy link
Author

Ping

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 29, 2024
@tsaarni tsaarni added the release-note/small A small change that needs one line of explanation in the release notes. label Aug 2, 2024
# Conflicts:
#	.github/workflows/build_main.yaml
#	.github/workflows/build_tag.yaml
#	.github/workflows/prbuild.yaml
Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

I've included suggestions inline for some linter nags (link).

Please add the new disableCompression option in "Configuration File" chapter in site/content/docs/main/configuration.md.

Please add also a changelog file.

internal/featuretests/v3/compression_test.go Outdated Show resolved Hide resolved
internal/featuretests/v3/compression_test.go Outdated Show resolved Hide resolved
test/e2e/httpproxy/envoy_compression_test.go Outdated Show resolved Hide resolved
test/e2e/httpproxy/envoy_compression_test.go Outdated Show resolved Hide resolved
test/e2e/httpproxy/envoy_compression_test.go Outdated Show resolved Hide resolved
},
ResponseDirectionConfig: &envoy_filter_http_compressor_v3.Compressor_ResponseDirectionConfig{
CommonConfig: &envoy_filter_http_compressor_v3.Compressor_CommonDirectionConfig{
ContentType: []string{
Copy link
Member

Choose a reason for hiding this comment

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

Possible alternative approach could be to leave the compressor filter in the chain but disable it by setting default to false in ResponseDirectionConfig.CommonConfig.Enabled

Enabled: &envoy_config_core_v3.RuntimeFeatureFlag{
	// If compression is enabled add compressor filter
	DefaultValue: wrapperspb.Bool(!b.disableCompression),
	RuntimeKey:   "contour.compression.response.enabled",
},

but since we do not have "per route" setting, which would override the default, it make sense to me that the whole filter is excluded from the chain when disabled, like suggested in this PR currently.

Copy link

@geomacy geomacy Aug 21, 2024

Choose a reason for hiding this comment

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

Yes, given

since we do not have "per route" setting

the thought in this PR is to work at the level of the whole filter. The functionality could be extended as described above if needed in future but that would best be left to another PR.

@geomacy
Copy link

geomacy commented Aug 19, 2024

Thanks very much for the feedback @tsaarni 🙇 we'll have a look at this and try to get back with updates as soon as possible.

@geomacy
Copy link

geomacy commented Aug 21, 2024

Many thanks for taking the time to provide the lint fixes. We'll update the docs and add the changelog as soon as possible.

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.77%. Comparing base (db432cc) to head (72e0e9c).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
cmd/contour/serve.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6546   +/-   ##
=======================================
  Coverage   81.76%   81.77%           
=======================================
  Files         133      133           
  Lines       15944    15954   +10     
=======================================
+ Hits        13037    13046    +9     
- Misses       2614     2615    +1     
  Partials      293      293           
Files with missing lines Coverage Δ
cmd/contour/servecontext.go 85.98% <100.00%> (+0.03%) ⬆️
internal/envoy/v3/listener.go 98.47% <100.00%> (+0.01%) ⬆️
internal/xdscache/v3/listener.go 92.20% <100.00%> (+0.08%) ⬆️
pkg/config/parameters.go 88.03% <ø> (ø)
cmd/contour/serve.go 22.63% <0.00%> (-0.04%) ⬇️

@geomacy geomacy force-pushed the main branch 3 times, most recently from 619ac16 to 16f72d7 Compare August 22, 2024 16:38
Geoff Macartney and others added 5 commits August 22, 2024 17:46
Co-authored-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Co-authored-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Co-authored-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Co-authored-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Co-authored-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
geomacy added 3 commits August 22, 2024 17:50
This change is solely a formatting change and does not change any of the text of the table

Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
@geomacy
Copy link

geomacy commented Aug 22, 2024

Hello @tsaarni I have made the changes to the documentation you mentioned.

The first commit 934ca48 is a pure format change to tidy the table borders; the diff therefore looks worse than it is, but is more readable with whitespace diff comparison turned off. The actual addition of the flag to the docs is a one-liner in 2efb693.

Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

Looks good! Just small documentation comments.

Comment on lines +351 to +352
// DisableCompression disables GZIP compression HTTP filter from the default Listener filters
// Setting this true will enable Envoy skip "Accept-Encoding: gzip,deflate" request header and always return uncompressed response
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// DisableCompression disables GZIP compression HTTP filter from the default Listener filters
// Setting this true will enable Envoy skip "Accept-Encoding: gzip,deflate" request header and always return uncompressed response
// DisableCompression disables GZIP compression HTTP filter from the default Listener filters.
// Setting this true will enable Envoy skip "Accept-Encoding: gzip,deflate" request header and always return uncompressed response.

@@ -0,0 +1 @@
Add disableCompression boolean flag to disable GZIP compression HTTP filter from the default Listener filters.
Copy link
Member

Choose a reason for hiding this comment

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

The changelog entry could mention where the flag can be found

Suggested change
Add disableCompression boolean flag to disable GZIP compression HTTP filter from the default Listener filters.
Add disableCompression boolean flag in the ContourConfiguration CRD and in configuration file to disable GZIP compression HTTP filter, forcing Envoy to always return uncompressed response.

Copy link
Contributor

@davinci26 davinci26 left a comment

Choose a reason for hiding this comment

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

sorry for commenting so late in the process but I think given that there are a lot of compression algorithms supported by envoy. Some of them much better than gzip like zstd I think we might want to change the api to allow the user to choose the compression algorithm and have an option called nocompression that disables it

@aecay
Copy link

aecay commented Aug 27, 2024

@davinci26 that's an interesting idea. It goes beyond what was mentioned in #310 which -- although it's far from a formal design process (so early in contour's lifecylce) -- is at least some semblance of a "blessing" of the API change in this PR. If we were to go for the alternative API you proposed (which is IMO richer/better overall), would it require going through the proposal process since it's not something that has been (afaik) so far envisioned/discussed?

Signed-off-by: Geoff Macartney <geoff.macartney@sky.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/small A small change that needs one line of explanation in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants