perf(redis): skip refills behind observed watermarks - #143
Open
lan17 wants to merge 1 commit into
Open
Conversation
This was referenced Aug 29, 2026
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.
Closes #141
Summary
Tracked Redis misses now preserve a trustworthy numeric watermark when the existing authoritative
MGETobserved one. After fallback, DialCache samples one candidate timestamp before serialization:This removes serializer, compression, frame-allocation, network, Redis, replication, and AOF work for refills that are already known to remain unreadable. It adds no Redis command or round trip and changes no key, frame, or watermark encoding.
Design
Adapter boundary
RedisReadResult = DecodedRedisFrame | RedisWatermarkMiss | null.decodeTrackedRedisReadResultfor adapters that intentionally opt into typed watermark misses.decodeTrackedRedisFrameand its establishedDecodedRedisFrame | nullbehavior for legacy custom adapters.RedisWriteRequest.createdAtMs. Adapters returning typed misses must encode a supplied value exactly; ordinary and direct writes that omit it retain adapter-side clock sampling.Core flow
candidateCreatedAtMs <= observedWatermarkMsbefore serializer dump, compression, size observations, frame construction, TTL-clamp reporting, or adapter dispatch.nullmisses.fill_fenced; typed confirmation misses remainsuperseded.Compatibility and safety
DecodedRedisFrame | nullremain correct and keep their prior write request/timestamp behavior; they simply do not receive this optimization.RedisReadResult, optionalRedisWriteRequest.createdAtMs, andfill_fencedare documented public type-surface changes. ExhaustiveShadowValidationOutcomeconsumers must add the new outcome.Validation
corepack pnpm check— 543 unit tests, typecheck, build/declarations, and packed ESM/CJS consumer checks pass.corepack pnpm test:integration— 127 tests pass across node-redis and GLIDE on Redis 6.2 and Valkey 8; the two GLIDE cluster cases skip locally because Docker Desktop cannot route announced container IPs, while CI remains fail-closed for those cases.corepack pnpm benchmark:redis-writeagainst Redis 6.2 — admitted writes remain exactly oneSETeach with zero Lua and zeroTIMEcalls.SETs and admitted refills add no reads.git diff --checkpasses.