Skip to content

feat: add gzip pre-compression for static assets to improve load time - #761

Open
RomanNikitenko wants to merge 5 commits into
che-incubator:mainfrom
RomanNikitenko:reduce-ide-loading
Open

feat: add gzip pre-compression for static assets to improve load time#761
RomanNikitenko wants to merge 5 commits into
che-incubator:mainfrom
RomanNikitenko:reduce-ide-loading

Conversation

@RomanNikitenko

@RomanNikitenko RomanNikitenko commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

  • Pre-compresses JS/CSS/HTML/JSON files during Docker build (gzip -9)
  • Serves .gz files directly when client supports Accept-Encoding: gzip
  • Falls back to uncompressed files if .gz is missing or on any error
  • Adds CODE_DISABLE_STATIC_GZIP=1 env variable as kill switch

Expected improvement:

  • workbench.js transfer drops from ~16MB to ~4.4MB: (~3.7x reduction),
  • significantly reducing white screen time https://redhat.atlassian.net/browse/CRW-10327
  • zero risk of regression: if .gz files don't exist or env variable is set, the server behaves exactly as before

Before:
Screenshot 2026-07-22 at 14 09 10

After:
Screenshot 2026-07-22 at 14 14 01

What issues does this PR fix?

https://redhat.atlassian.net/browse/CRW-10327

How to test this PR?

Does this PR contain changes that override default upstream Code-OSS behavior?

  • the PR contains changes in the code folder (you can skip it if your changes are placed in a che extension )
  • the corresponding items were added to the CHANGELOG.md file
  • rules for automatic git rebase were added to the .rebase folder

Assisted-by: Cursor AI

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Click here to review and test in web IDE: Contribute

@tolusha

tolusha commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm che-ai-assistant — I help with your pull requests.

Available commands:

  • /che-ai-assistant generate-che-doc — Generate a documentation PR based on this PR's changes
  • /che-ai-assistant ok-pr-review — Run a comprehensive PR review (summary, code review, deep review, impact analysis)
  • /che-ai-assistant check-pr-test-failures — Analyze failing CI checks, identify root causes, and suggest fixes
  • /che-ai-assistant update-che-e2e-tests — Update Eclipse Che e2e tests
  • /che-ai-assistant help — Show this help message

@github-actions

Copy link
Copy Markdown
Contributor

@rgrunber

Copy link
Copy Markdown
Collaborator

I'm not seeing a huge improvement in speed, but there's definitely less data being transferred. It might make a difference on slower connections.

Before

workbench.js dom load finish (s) total transfer
1.24s 334ms 4.39s 19.64s 19.82MB
770ms 436ms 3.94s 16.65s 19.82MB
508ms 447ms 3.85s 16.32s 19.82MB
1.05s 502ms 4.22s 17.09s 19.82MB
3.27s 437ms 6.36s 19.15s 19.82MB

After

workbench.js dom load finish (s) total transfer
894ms 447ms 4.24s 18.03s 6.40MB
793ms 287ms 4.03s 18.09s 6.40MB
635ms 437ms 3.89s 17.78s 6.36MB
567ms 362ms 3.78s 18.50s 6.36MB
472ms 232ms 3.64s 17.25s 6.36MB

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Assisted-by: Cursor AI
Ensure the Promise in tryServeCompressedFile settles when the client
disconnects or a stream error occurs after headers are sent. Previously
these scenarios left the Promise pending, which could hang the request
handler.

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
@github-actions

Copy link
Copy Markdown
Contributor

@RomanNikitenko
RomanNikitenko marked this pull request as ready for review July 22, 2026 11:15
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@RomanNikitenko, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c500f87-c8c1-4244-b448-804ea42dee57

📥 Commits

Reviewing files that changed from the base of the PR and between d2d7be6 and aad2768.

📒 Files selected for processing (6)
  • .rebase/replace/code/src/vs/server/node/webClientServer.ts.json
  • build/dockerfiles/linux-libc-ubi8.Dockerfile
  • build/dockerfiles/linux-libc-ubi9.Dockerfile
  • build/dockerfiles/linux-musl.Dockerfile
  • code/src/vs/server/node/che/webClientServer.ts
  • code/src/vs/server/node/webClientServer.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

RomanNikitenko and others added 3 commits July 22, 2026 15:13
Skip gzip serving when the client explicitly refuses gzip by setting
quality value to zero (e.g. Accept-Encoding: gzip;q=0).

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add Vary header before ETag/304 conditional so shared caches correctly
distinguish compressed and uncompressed variants. Include responseHeaders
in 304 response to propagate Vary to the client.

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…nges

Add rebase replace rules to cover the Che-specific modifications to
code/src/vs/server/node/webClientServer.ts introduced for HTTP
pre-compression support:

- Import tryServeCompressedFile from che/webClientServer.js
- Add Vary: Accept-Encoding header before ETag check
- Pass responseHeaders to 304 response for proper cache behavior
- Insert tryServeCompressedFile call before raw file streaming

These rules ensure the compression changes survive upstream rebases
without manual conflict resolution.

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Comment thread code/src/vs/server/node/che/webClientServer.ts
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

Successfully merging this pull request may close these issues.

3 participants