Skip to content

perf(images): optimize high-traffic training assets - #334

Merged
carlospolop merged 3 commits into
masterfrom
optimize/high-traffic-images
Aug 10, 2026
Merged

perf(images): optimize high-traffic training assets#334
carlospolop merged 3 commits into
masterfrom
optimize/high-traffic-images

Conversation

@carlospolop

@carlospolop carlospolop commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Problem

CloudFront logs attributed 13.371 GB (25.5% of a deduplicated two-day sample) to the 1,326,124-byte summer banner across the Wiki traffic sample. The most frequent promotional images had no long-lived cache metadata.

Changes

  • Add versioned WebP assets and update the banner/discount references.
  • Summer image: 1,326,124 → 123,344 bytes (90.7% smaller); the sampled 13.371 GB would become ~1.244 GB at the same request count.
  • Certification badges: 99.3–99.6% smaller at 4× their 24px display height.
  • Publish only these versioned files with Cache-Control: public,max-age=31536000,immutable and Content-Type: image/webp.
  • Cover both English and translated deployments, including translation branches that do not yet contain the new theme/assets.
  • Keep all old PNG URLs to avoid breaking cached/older pages.

Validation

  • Visually compared PNG/WebP outputs; transparency, text, colors, and layout remain intact.
  • Upload helper exercised with a fake AWS CLI: four correct uploads per prefix.
  • Workflow YAML parsed; shell and JS syntax checks passed; git diff --check passed.

Created by Hermes after the AWS Wiki cost audit.

2026-08-04 safety re-review

The immutable upload helper now checks ETag, Cache-Control, and Content-Type before writing. Unchanged correctly-tagged assets incur only a HEAD request and are not uploaded again; a missing object or metadata mismatch is repaired. Mocked skip/repair tests, shell syntax, JavaScript syntax, workflow YAML parsing, git diff --check, and a full mdbook build all pass.

@carlospolop
carlospolop merged commit 8d665a4 into master Aug 10, 2026
@carlospolop
carlospolop deleted the optimize/high-traffic-images branch August 10, 2026 11:34
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.

1 participant