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

Add brotli pre-compression #254

Open
9 tasks
ai opened this issue Sep 15, 2024 · 0 comments
Open
9 tasks

Add brotli pre-compression #254

ai opened this issue Sep 15, 2024 · 0 comments

Comments

@ai
Copy link
Contributor

ai commented Sep 15, 2024

We can improve web client loading performance by creating .br files for every asset during the deployment and serving them if client support br compression. We can reach compression level much higher than on-the-fly compression from CDN. Also, it will improve performance for self-hosted solution without CDN.

  • Add Brotli compression to Vite. Seems like we need to use the latest vite-plugin-compression2, but we need further investigation.
    • Be sure that we compress files only during cd web && pnpm build and not during development (check network tab of browser DevTools).
    • Set 11 compression level.
  • Add to the server a check: if user requesting X file has br in Accept-Encoding header and there if X.br file, serve X.br instead with Content-Encoding: br header.
    • Add tests
    • Test that browser handle it without warning in console by running pnpm build (in the root) and cd server && ./scripts/run-image.sh (or by cd server && pnpm production if Docker works in your Dev Container).
  • Add Brotli support to nginx image for static server. Since nginx has no brotli support out of the box (and compile brotli module is hard), we may want to add this hack to nginx config
    • Test that it works by running pnpm build (in the root) and cd web && ./scripts/run-image.sh (or by cd web && pnpm production if Docker works in your Dev Container).
  • Create PR and show before/after transmitted size (by checking network tab in browser’s DevTools from production server tests).
@github-project-automation github-project-automation bot moved this to Ready to Take in Slow Reader Tasks Sep 15, 2024
@ai ai moved this from Ready to Take to Onboarding in Slow Reader Tasks Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Onboarding
Development

No branches or pull requests

1 participant