Skip to content

feat(cache): compress large Redis payloads with Brotli - #1239

Merged
ayomideadeniran merged 1 commit into
StellarDevHub:mainfrom
aurorabini:feat/issue-1139-redis-compression
Aug 31, 2026
Merged

feat(cache): compress large Redis payloads with Brotli#1239
ayomideadeniran merged 1 commit into
StellarDevHub:mainfrom
aurorabini:feat/issue-1139-redis-compression

Conversation

@aurorabini

Copy link
Copy Markdown
Contributor

Summary

Optimises Redis memory usage by Brotli-compressing large cached payloads (issue #1139).

  • Brotli codec: new src/cache/PayloadCodec.ts compresses serialized values >1KB (COMPRESSION_MIN_BYTES) with native Node.js zlib before writing to Redis.
  • Transparent decompression: CacheService.get transparently returns the original object on read — in both the Redis binary path (getBuffer) and the string-only memory-store fallback.
  • Backward compatible: plain-JSON entries already in cache still decode correctly.
  • Benchmark: benchmarks/compression-savings.ts measures ~95% memory savings across 1,000 course curriculum trees (7.16 MB → 0.35 MB).
  • Tests: src/cache/PayloadCodec.test.ts covers small-payload passthrough, big-payload round-trips (Redis + memory-store), backward compatibility, and confirmed savings.

Closes #1139

Add a payload codec that Brotli-compresses cached values above 1KB before they
are written to Redis and transparently decompresses on read, in both the Redis
binary path and the string-only memory-store fallback. Adds unit tests plus a
benchmark measuring ~95% memory savings across 1,000 curriculum trees.

Closes StellarDevHub#1139
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@aurorabini Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@aurorabini is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

@ayomideadeniran
ayomideadeniran merged commit 469e6b6 into StellarDevHub:main Aug 31, 2026
1 check failed
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.

[Redis & Queues] Implement Compressed Binary Payload Storage for Large Curriculum Trees

2 participants