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

Enable Brotli in CloudFront settings for docs.rust-lang.org #63

Open
jsha opened this issue Feb 20, 2021 · 3 comments
Open

Enable Brotli in CloudFront settings for docs.rust-lang.org #63

jsha opened this issue Feb 20, 2021 · 3 comments

Comments

@jsha
Copy link
Contributor

jsha commented Feb 20, 2021

(Moving from rust-lang/rust#82286)

We can achieve a significant decrease in file size by enabling Brotli compression, which is an option in CloudFront: https://aws.amazon.com/about-aws/whats-new/2020/09/cloudfront-brotli-compression/

Brotli has been supported in major browsers since 2016: https://en.wikipedia.org/wiki/Brotli

search-index1.50.0.js is currently served as 272,247 gzip bytes, but it could be served as 140,170 brotli bytes.

$ curl https://doc.rust-lang.org/search-index1.50.0.js --header "Accept-Encoding: gzip" -o search-index.js.gz
$ zcat search-index.js.gz | brotli > search-index.js.br
$ ls -l search-index.js.*
-rw-rw-r-- 1 jsha jsha 140170 Feb 18 23:56 search-index.js.br
-rw-rw-r-- 1 jsha jsha 272247 Feb 18 23:56 search-index.js.gz

@Mark-Simulacrum
Copy link
Member

Based on a bit of digging it looks like we'll need to switch to the new policies to do this (vs. legacy caching) on the relevant endpoints. It does seem like a good win!

@jsha
Copy link
Contributor Author

jsha commented Feb 28, 2021

Also I should mention: .woff, .woff2, and .png files should be excluded since they are already compressed. There's a good chance CloudFront's config is smart enough to do this already, but worth checking.

@jsha
Copy link
Contributor Author

jsha commented Sep 30, 2021

Bump on this?

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

No branches or pull requests

2 participants