Skip to content

Optimize(Web): gzip pre-compression#653

Open
Marc-Andrieu wants to merge 3 commits intomainfrom
web/nginx-gzip
Open

Optimize(Web): gzip pre-compression#653
Marc-Andrieu wants to merge 3 commits intomainfrom
web/nginx-gzip

Conversation

@Marc-Andrieu
Copy link
Member

Description

Summary

The web version can be unbearably slow. One way to fix it is compression.

  • Compression = fewer data is transferred over the network = faster loading times (even more blatant in slow networks)
  • Pre-compression = compressed once (here I included this in the building of the Docker image), served instantly from disk, no CPU overhead, and allows more aggressive levels without downsides for the client (source: the creator of gzip himself said so on StackOverflow) = even faster
  • gzip = already in Nginx by default. Brotli may be even faster to decompress, and supported everywhere as well, but building a Nginx+Brotli image really is unmaintainable for us.

Sources:

Before/after

A video is better than 1000 words: ~30% faster with a fast connection.
Can go up to 2x faster in slower networks.
Consistently 12.0-12.2s for https://titan.dev.eclair.ec-lyon.fr and 8.7-9.0s for https://titan-1.dev.eclair.ec-lyon.fr

Enregistrement.de.l.ecran.2026-02-07.204811.mp4

Issues/PR dependencies

Subset of the draft #646 for Nginx pre-compression.

Changes Made

  • Nginx config: gzip config: gzip & gunzip, static, level 9, >512 bytes, mime types to take text-based files & avoid images,
  • Dockerfile: include the compression there, for >512 bytes file, take text-based files & avoid image
  • Consistent params between the Nginx config and the compression during image build.
  • Re-run flutter pub run pdfx:install_web to regenerate the PDF script

Classification

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🔨 Refactor (non-breaking change that neither fixes a bug nor adds a feature)
  • 🔧 Infra CI/CD (changes to configs of workflows)
  • 💥 BREAKING CHANGE (fix or feature that require a new minimal version of the front-end)
  • 😶‍🌫️ No impact for the end-users
  • Optimization

Impact & Scope

  • Core functionality changes
  • Single module changes
  • Multiple modules changes
  • Other: Dockerfile, Nginx config, index.html

Testing

  • 1. Tested this locally: built and run my Docker image
  • 2. Added/modified tests that pass the CI (or tested in a downstream fork)
  • 3. Tested in a local client using a pre-prod backend
  • 4. Created the 1st Titan pre-prod for the occasion
  • 0. Untestable (exceptionally), will be tested in prod directly

Documentation

  • Updated the docs accordingly :
  • // Comments
  • No documentation needed

@Marc-Andrieu Marc-Andrieu self-assigned this Feb 7, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.88%. Comparing base (27a10d9) to head (cf1ad2c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #653   +/-   ##
=======================================
  Coverage   50.88%   50.88%           
=======================================
  Files         167      167           
  Lines        3797     3797           
=======================================
  Hits         1932     1932           
  Misses       1865     1865           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants