-
Notifications
You must be signed in to change notification settings - Fork 16
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
compress .metadata files if client supports #134
Conversation
pairs with pypi/warehouse#13649 |
# Perform compression if the client claims to understand it | ||
if (req.http.Accept-Encoding == "gzip") { | ||
set beresp.gzip = true; | ||
} else if (req.http.Accept-Encoding == "br") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! 👋
Is there a particular reason to prefer gzip over brotli? Especially for perdominantly English vocabulary, brotli outperforms gzip both in terms of time and compression ratio.
Here's a quick benchmark I did recently: illagrenan/django-brotli#117
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the more general question is: what happens if the client accepts multiple encodings?
Like requests and aiohttp and probably most others do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any reason to prefer gzip over brotli, though I suspect the answer is that it doesn't matter regardless because 99% of the traffic will be gzip anyways because the primary consumer will almost certainly be pip, which uses requests which, afaik, doesn't support brotli by default (requires extra libraries, and likely would get disabled in pip anyways because C libraries cant be upgraded on Windows if pip imports them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the point in the request that this happens, the Accept-Encoding
header is normalized to only be a single encoding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the elaborate response!
No description provided.