Add Zstd compression support and fix compression ratio metric bug#194
Open
janewang1680 wants to merge 9 commits into
Open
Add Zstd compression support and fix compression ratio metric bug#194janewang1680 wants to merge 9 commits into
janewang1680 wants to merge 9 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CompressionAlgorithm enum (GZIP, ZSTD) to EVCacheSerializingTranscoder with magic-byte auto-detection on decode for full backward compatibility. EVCacheTranscoder wires algorithm and zstd level from Fast Properties. Fixes compression ratio metric which was always reporting 100%. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix decompress() to always delegate non-zstd data to super (removes redundant gzip magic-byte check). Add three EVCacheTranscoder FP tests that inject a fresh DefaultSettableConfig per test to avoid Archaius property caching between test runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Coda page] (https://coda.io/d/EVCache-Zstd-Support_dMpMIEBGnG5/EVCache-Zstd-Support_survVvtu#_luv_j_Y4)
Summary
CompressionAlgorithmenum onEVCacheSerializingTranscoder, with magic-byte auto-detection on decode so existing gzip-compressed cache entriescontinue to decode correctly. Algorithm and zstd level are configurable via two new fast properties:
default.evcache.compression.algorithm(defaultGZIP)default.evcache.compression.zstd.level(default3)compressed.length / b.lengthalways evaluated to 1.0 becausebwas reassigned tocompressedbefore the ratio calculation. The metric now uses thecaptured
originalLength, producing accurate ratios.Test plan
./gradlew :evcache-core:test --tests "com.netflix.evcache.EVCacheSerializingTranscoderTest"— 17 tests covering enum values, default constructor, gzip/zstd round-trip, cross-decode (gzip-written read by zstdtranscoder and vice versa), and FP wiring.
COMPRESSION_RATIOtimer) reports realistic ratios (not always ~100%) in a canary.