Overview
The Redis store provides distributed in-memory storage using Redis or Redis-compatible services. It’s ideal for sharing cache across multiple NativeLink instances while maintaining high performance. The store supports Redis standalone, cluster, and sentinel modes.Use Cases
- Distributed action cache: Share build action results across multiple workers
- Small object caching: Cache frequently accessed small objects (< 256MB)
- Shared state: Coordination between NativeLink instances
- Fast distributed tier: Alternative to memory store that survives restarts
- Scheduler backend: Store scheduler state in Redis with pub/sub support
Performance Characteristics
- Read performance: Sub-millisecond for network-local Redis (1-5ms typical)
- Write performance: Sub-millisecond for small objects
- Durability: Configurable (in-memory, RDB snapshots, AOF)
- Availability: High with Redis Sentinel or Cluster
- Size limits: Most Redis services limit objects to 256MB-512MB
Configuration
List of Redis server addresses in the format:
redis://[username:password@]host:port[/database_id]Examples:redis://127.0.0.1:6379/(local, default DB)redis://username:password@redis-server:6380/99(authenticated, DB 99)redis://redis-cluster:6379/(cluster node)
Redis operation mode.Available options:
"standard": Standard Redis (not cluster or sentinel)"cluster": Redis Cluster mode"sentinel": Redis Sentinel mode
"standard"Optional prefix to prepend to all keys in this store.Useful for:
- Organizing data by namespace
- Multi-tenant configurations
- Separating environments (dev, staging, prod)
"nativelink:cas:"Default: "" (no prefix)The amount of data to read from Redis at a time (in bytes).Used to limit memory usage when reading large objects and prevent
command_timeout_ms from being triggered on slow connections.Important: If this value is too high, the command_timeout_ms might be triggered if latency or throughput to Redis is too low.Default: 64KB (65536 bytes)The number of connections to keep open to the Redis server(s).More connections can improve throughput but increase resource usage.Default: 3
The maximum number of upload chunks to allow per update.Used to limit memory usage when uploading large objects. A good rule of thumb:
AVAIL_MEMORY / (read_chunk_size * max_chunk_uploads_per_update) ≈ THEORETICAL_MAX_CONCURRENT_UPLOADSDivide AVAIL_MEMORY by ~10 to account for other memory usage.Default: 10Time in milliseconds until the Redis store considers a command timed out.This triggers a retry and potentially a reconnection to the Redis server.Default: 10000ms (10 seconds)
Time in milliseconds until the Redis store considers the connection unresponsive.This triggers a reconnection to the Redis server.Default: 3000ms (3 seconds)
Maximum number of permitted actions to the Redis store at any one time.Prevents timeout issues from too many inflight actions.Default: 500
The COUNT value passed when scanning keys in Redis.Used to hint the amount of work per response when scanning large keyspaces.Default: 10000
Maximum number of items returned per cursor for search indexes.May reduce thundering herd issues with worker provisioner at higher node counts.Default: 1500
Retry configuration for failed Redis operations.Default configuration:See Retry Configuration for details.
Optional Redis channel to publish write events to.If set, every write operation publishes an event to this channel. If unset, writes still occur but events aren’t published.Experimental feature.Default: Not set (no events published)
Deprecated Configuration
Deprecated: Use
command_timeout_ms instead.The response timeout for Redis connections in seconds.Deprecated: Use
connection_timeout_ms instead.The connection timeout for Redis connections in seconds.Deprecated: No longer used by redis-rs.
Retry Configuration
Maximum number of retries. Setting to 0 means unlimited retries.Default: 0 (unlimited)
Base delay in seconds for exponential backoff.Default: 0.1 (100ms)
Jitter as a percentage (0.0 to 1.0) to add to delays.Default: 0.5 (50%)
Redis Mode Configuration
Standard Mode
Single Redis instance or simple replication.Cluster Mode
Redis Cluster for horizontal scaling and automatic sharding.Sentinel Mode
Redis Sentinel for high availability and automatic failover.Configuration Examples
Basic Redis Store
With Authentication and Custom Database
Optimized for Large Objects
Size-Partitioned with Redis for Small Objects
Redis as Fast Tier with S3 Slow Tier
With Pub/Sub for Distributed Notifications
Production Configuration with Tuning
Size Limitations
Recommended Size Limits
| Redis Deployment | Max Object Size | Recommended Use |
|---|---|---|
| Managed Redis (AWS ElastiCache, etc.) | 256MB | Action Cache, small CAS objects |
| Self-hosted Redis | 512MB | Action Cache, medium CAS objects |
| Redis with size partitioning | No limit | Combined with S3/filesystem for large objects |
Best Practices
Set key_prefix for multi-tenancy: Use different prefixes for different environments or tenants sharing the same Redis instance.
Performance Tuning
Network Latency
- Co-locate with compute: Place Redis close to NativeLink instances to minimize latency
- Use connection pooling: Increase
connection_pool_sizefor better throughput - Tune timeouts: Adjust
command_timeout_msbased on network characteristics
Memory Management
- Set Redis maxmemory: Configure Redis
maxmemoryand eviction policy - Use LRU eviction: Configure Redis with
maxmemory-policy allkeys-lru - Monitor memory: Track Redis memory usage and adjust limits
Throughput Optimization
- Increase chunk size: Larger
read_chunk_sizereduces round trips but increases memory - Tune concurrency: Adjust
max_client_permitsandmax_chunk_uploads_per_update - Use pipelining: Redis store automatically pipelines operations