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

feat(booster-http): --compression-level flag for piece & frisbii, fix GzipHandler usage #1736

Closed
wants to merge 10 commits into from

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Oct 9, 2023

This is a stacked PR on top of #1676; one of a couple I'm going to do to consolidate and address some things with the two primary HTTP handler paths.

This one does a few things:

  • New --compression-level flag with a default of 1. Allows users to turn it off if they're going to do this in a reverse proxy (recommended, really).
  • Plumb through the same level to Frisbii as well as the piece handler
  • Replace the direct usage of gziphandler.GzipResponseWriter in the piece HandlerFunc with a gziphandler.MustNewGzipLevelHandler() as a Handler, wrapping the HandlerFunc - this does two things: (1) lets us set a compression level, the default we're getting now is a basic deflate (1), and (2) lets us use the gzip pool that gziphandler manages at the level of Handler.
  • Add a couple of extra headers for the piece handler, including a Cache-Control.
  • A bunch of tests to make sure it's working - the existing test just sets a header and adds a gzip reader, which is already done internally (transparently) by the Go HTTP client; so the tests added here to a variety of on and off for compression.

I've set the default to 1 but I'd rather set it to 6 for better results, with a small amount of CPU impact. I chose 1 because that's all users are getting now.

@rvagg
Copy link
Member Author

rvagg commented Oct 9, 2023

test failing because of a minor compatibility problem with [email protected], going to cut a new version soon with some other updates for my next PR so I'll roll that in here and the test will turn green

@rvagg rvagg changed the title feat: --compression-level flag for piece & frisbii, fix GzipHandler usage feat(booster-http): --compression-level flag for piece & frisbii, fix GzipHandler usage Oct 9, 2023
@rvagg
Copy link
Member Author

rvagg commented Oct 9, 2023

released [email protected], updated to that in #1676 and that should address the CI problems here

@nonsense nonsense requested review from nonsense and masih October 9, 2023 15:20
Copy link
Member

@masih masih left a comment

Choose a reason for hiding this comment

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

I will review the final PR against main more closely. Based on a quick look this looks fine 👍

@rvagg
Copy link
Member Author

rvagg commented Oct 10, 2023

I've pulled this in to #1676, it car be reviewed there as part of the mega-changeset but is still a separate commit that can be viewed separately if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants