Skip to content

Add an optional TTL for keys a redis store writes - #2688

Merged
amankrx merged 1 commit into
TraceMachina:mainfrom
amankrx:feat/redis-store-key-ttl
Aug 14, 2026
Merged

Add an optional TTL for keys a redis store writes#2688
amankrx merged 1 commit into
TraceMachina:mainfrom
amankrx:feat/redis-store-key-ttl

Conversation

@amankrx

@amankrx amankrx commented Aug 13, 2026

Copy link
Copy Markdown
Member

Description

Keys a redis store writes never expire, so a store whose consumer stops keeps everything it ever wrote. One deployment reached 1.79M keys with expires=0 after its BEP consumer stalled, and the Redis node ran out of memory.

The store already supports a TTL, but only on the versioned write path used by the scheduler. The plain update() path a BEP store takes has no expire call at all.

Adds key_ttl_s to the redis store config. When set, update() expires the key after the rename. Default is 0, meaning no expiry, so nothing changes for any existing store.

Deliberately per store, not global. The same store type backs the CAS fast tier and the scheduler, and expiring scheduler state would drop in-flight actions.

Note this trades data for a bound: anything not consumed inside the window is deleted, so the value has to exceed the longest consumer outage you want to survive. That is called out in the config docs.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added unit tests, one for the TTL being set and one for the default staying
off. The first fails if you revert the fix.

Checklist

  • Updated documentation if needed
  • Tests added/amended
  • bazel test //... passes locally
  • PR is contained in a single commit, using git amend see some docs

This change is Reviewable

@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nativelink Ready Ready Preview Aug 14, 2026 1:10am
nativelink-aidm Ready Ready Preview Aug 14, 2026 1:10am

Request Review

Comment thread nativelink-config/src/stores.rs
Comment thread nativelink-store/src/redis_store.rs
Comment thread nativelink-store/src/redis_store.rs
Comment thread nativelink-store/tests/redis_store_test.rs
Comment thread nativelink-store/src/redis_store.rs
@amankrx
amankrx merged commit 5c1a042 into TraceMachina:main Aug 14, 2026
44 checks passed
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.

2 participants