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 compression #89

Open
Nuklon opened this issue Dec 15, 2021 · 7 comments
Open

Enable Brotli compression #89

Nuklon opened this issue Dec 15, 2021 · 7 comments

Comments

@Nuklon
Copy link
Contributor

Nuklon commented Dec 15, 2021

Right now only gzip compression is enabled, perhaps brotli can also be enabled? This significantly reduces matomo.js file size.

@crazy-max
Copy link
Owner

Should be handled upstream first like it was done for gzip matomo-org/matomo#13633. Suggest to open an issue there.

@Nuklon
Copy link
Contributor Author

Nuklon commented Dec 15, 2021

I meant to enable it in nginx, similar to gzip is done right now (

).

@crazy-max
Copy link
Owner

I meant to enable it in nginx

We would need to compile the module as it's not available in its current state. Also I don't think it brings any real benefit against gzip (at most 17% from what I see from different benchmark).

@crazy-max
Copy link
Owner

crazy-max commented Dec 15, 2021

We would need to compile the module as it's not available in its current state.

Oh my bad it's in the alpine: https://git.alpinelinux.org/aports/tree/main/nginx/APKBUILD?h=3.15-stable#n150

@crazy-max
Copy link
Owner

Let me know if you want to open a PR and make some tests with this sample configuration.

@Nuklon
Copy link
Contributor Author

Nuklon commented Dec 15, 2021

I think the images need to be built with brotli module, https://github.com/nginxinc/docker-nginx/tree/master/modules (I don't know how to do that though).
With just the config it doesn't work as the brotli module doesn't seem present on the image (at least the brotli module import fails as it (and also I) cannot find the brotli module on the image). I will experiment a little with this and see if I can get something working.

Regarding the savings, the matomo js file is ~30% smaller when compressed with Brotli.

@Nuklon
Copy link
Contributor Author

Nuklon commented Dec 17, 2021

I don't know how to enable in your dockerfile, but I have tried the original matomo docker image and it works there without problems (at least I couldn't find any).
Right now gzip is 23.96KB, with Brotli that goes down to 19.73KB. But it doesn't only save on size, decompression speed is also ~1.5x better. That's quite noticable on slower phones.

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