-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Allow tuning of Brotli compression level #106
Comments
Would you like to send a PR? |
From a quick look at the code, the solution didn't seem obvious, but if I wind up with time to circle back to this (we're going with gzip/deflate now) I'll try for a PR if one hasn't yet been built. |
SystemDisc
added a commit
to SystemDisc/fastify-compress
that referenced
this issue
May 29, 2020
4 tasks
mcollina
pushed a commit
that referenced
this issue
Jun 26, 2020
* Support passing zlibOptions and brotliOptions #106 * Update tests, types, and docs Co-authored-by: Blake Sager <blake.sager@activeprospect.com>
Closed in #113. |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 Feature Proposal
Add ability to specify brotli compression level, preferably globally
Motivation
Brotli is great for compressing static assets, where you can amortize the cost of compression across multiple responses, however in its default configuration it takes an extremely (multiple orders of magnitude vs. gzip) long time to compress data, making it a hard sell for dynamic content, particularly compared to near-instant compression provided by gzip/deflate. Given that in e.g. NestJS the compression phase happens after responses are pulled from cache on the Nest side, even aggressively server-side cached responses can't amortize exprensive compression operations across multiple requests.
Turning down the compression level on brotli may allow for acceptable compression times while still maintaining a compression ratio superior to gzip/deflate.
Example
When specifying brotli as a compression method, add a
level
parameter to the object. I'm guessing that the default is maximum compression (11?), and for BC reasons it'd be reasonable to keep that default if thelevel
parameter wasn't provided.The text was updated successfully, but these errors were encountered: