Skip to content

Add compression stats and ratio threshold for ZSTD dict#7000

Merged
romange merged 1 commit into
mainfrom
AddZSetStats
Mar 29, 2026
Merged

Add compression stats and ratio threshold for ZSTD dict#7000
romange merged 1 commit into
mainfrom
AddZSetStats

Conversation

@romange
Copy link
Copy Markdown
Collaborator

@romange romange commented Mar 27, 2026

Summary

  • Expose QList compression stats as Prometheus metrics (list_compression_attempts, list_compressed_bytes)
  • Skip storing incompressible blobs with a 30% savings ratio threshold in CompressNodeWithDict
  • Fix malloc_size_ tracking in CompressWithZstdDict by computing per-node deltas instead of a second loop

Follow-up to #6967.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 27, 2026 18:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes QList compression statistics via Prometheus, adds a savings-ratio threshold to avoid storing poorly-compressible blobs with the ZSTD dictionary path, and adjusts malloc_size_ tracking during bulk ZSTD dict compression.

Changes:

  • Add Prometheus metrics for QList compression attempts and compressed/raw byte counts.
  • Add a “30% savings required” ratio gate to reject low-benefit ZSTD dict compression results.
  • Switch CompressWithZstdDict from a full malloc_size_ recomputation loop to per-node delta updates.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/server/server_family.cc Exposes QList compression stats as Prometheus metrics.
src/core/qlist.cc Adds ratio-based rejection for ZSTD dict compression and changes how malloc_size_ is updated during bulk compression.
src/core/qlist_test.cc Adds tests covering incompressible-data rejection and stats invariants.

Comment thread src/core/qlist.cc
Comment thread src/core/qlist.cc
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Mar 27, 2026

🤖 Augment PR Summary

Summary: Improves QList compression observability and tightens ZSTD-dictionary compression behavior.

Changes:

  • Expose QList compression attempt/failure counters and current compressed/raw byte gauges via Prometheus.
  • Add a 30% savings ratio guard in CompressNodeWithDict to avoid storing near-incompressible blobs.
  • Update bulk ZSTD-dict compression to adjust malloc_size_ using per-node deltas instead of a full recompute loop.
  • Add unit tests covering incompressible inputs and stat tracking invariants.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/core/qlist.cc
Comment thread src/core/qlist.cc
Comment thread src/core/qlist_test.cc Outdated
@romange romange force-pushed the AddZSetStats branch 2 times, most recently from c940225 to 59e3f8f Compare March 28, 2026 10:24
Expose QList compression stats as Prometheus metrics:
- list_compression_attempts{type=total|fail}
- list_compressed_bytes{type=compressed|raw}

Skip storing incompressible blobs by adding a 30% savings
ratio threshold to CompressNodeWithDict. Track attempts
and failures using the existing shared compression counters.

Fix malloc_size_ tracking in CompressWithZstdDict by computing
per-node deltas instead of a full recalculation loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@romange
Copy link
Copy Markdown
Collaborator Author

romange commented Mar 28, 2026

Fixed some bugs as well.

Results, based on https://github.com/romange/python_queue_benchmark I forked and improved to have also non-python frameworks.

→ Celery: 197 MB → 18 MB (10.7x reduction)
→ Laravel: 106 MB → 17 MB (6.1x reduction)
→ Sidekiq: 34 MB → 6.8 MB (5x reduction)

TBD: streams - they are being used by some of the frameworks like bullmq and others.

@romange romange merged commit b51493a into main Mar 29, 2026
20 of 21 checks passed
@romange romange deleted the AddZSetStats branch March 29, 2026 12:12
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