Overview
The Fast-Slow store implements a two-tier caching architecture where data is first attempted from a fast store (typically memory or SSD) and falls back to a slow store (typically network or HDD) if not found. This store automatically promotes data from slow to fast storage on reads and mirrors writes to both tiers.Use Cases
- Hybrid storage tiers: Combine fast local storage with durable cloud storage
- Performance optimization: Keep hot data in fast storage, cold data in slow storage
- Cost optimization: Use expensive fast storage sparingly, bulk storage cheaply
- Distributed caching: Local fast cache with shared network slow tier
- Development/production parity: Same configuration works with different storage backends
Performance Characteristics
- Cache hit (fast): Performance of fast store (sub-millisecond for memory)
- Cache miss: Performance of slow store plus promotion cost
- Write performance: Limited by slower of the two stores (typically slow store)
- Automatic warming: Slow store reads automatically populate fast store
- Deduplication: Multiple concurrent requests for same object only download once
Architecture
Read Flow
- Check if object exists in fast store
- If found, return from fast store
- If not found, fetch from slow store
- While streaming from slow store, simultaneously write to fast store (if
fast_directionallows) - Return data to client
Write Flow
- Write to fast store (if
fast_directionallows updates) - Write to slow store (if
slow_directionallows updates) - Both writes happen concurrently
- Success requires both to succeed (or whichever directions are enabled)
Configuration
The fast store that will be attempted first.Typically configured as:
- Memory store for maximum speed
- Filesystem store on SSD for larger capacity
- Local Redis for distributed fast tier
The slow store that serves as the fallback and/or durable storage.Typically configured as:
- S3 or GCS for cloud-backed durable storage
- Filesystem store on HDD for local archival
- Network-attached storage
- Remote GRPC store
Store Direction
TheStoreDirection enum controls read and write behavior for each tier:
The store operates normally - all get and put operations are handled by it.This is the default and most common setting.
Update operations (puts) will persist to this store, but Get operations will be ignored.Use case: Set on fast store for worker nodes that should only write results to slow store, but cache reads locally.
Get operations will persist to this store, but Update operations will be ignored.Use case: Populate fast store from reads without writing to it on updates.
Operate as a read-only store.Use case: Useful for upstream read-only stores or creating a diode configuration.
Configuration Examples
Basic Fast-Slow with Memory and Filesystem
Fast SSD with S3 Slow Tier
Worker Node Configuration (Write-Through)
Worker nodes that should cache reads locally but persist writes to shared storage:Read-Only Upstream Cache
Create a diode configuration with a read-only upstream store:Three-Tier Configuration
Combine memory, SSD, and S3 for a three-tier cache:Implementation Details
Deduplication
The fast-slow store deduplicates concurrent requests for the same object:- First request streams from slow to fast store
- Subsequent requests wait for the first to complete
- All requests share the same download operation
- Prevents duplicate network transfers and disk I/O
Promotion Strategy
On Read:- Data is promoted from slow to fast store during streaming
- Promotion happens concurrently with serving the client
- If promotion fails, the read still succeeds
- Data is written to both stores concurrently
- Write fails if either store fails (unless direction is configured to skip)
Cache Warming
The store automatically warms the fast cache:- Any read from slow store populates fast store
- No manual cache warming required
- Natural workload patterns keep hot data in fast tier
Important Warnings
Best Practices
Worker node configuration: For worker nodes in remote execution, use
fast_direction: "get" to cache downloads locally while ensuring uploads go to shared storage.Performance Tuning
Cache Hit Optimization
- Monitor cache hit rates: Track fast vs slow store access patterns
- Increase fast store size: If hit rate is low, increase
max_bytes - Adjust eviction policy: Tune
max_secondsfor time-based locality - Consider access patterns: Different workloads need different cache sizes
Write Performance
- Use compression on slow tier: Reduce network transfer time
- Tune multipart uploads: Increase
multipart_max_concurrent_uploadsfor S3 - Consider fast_direction: Workers can use
getdirection to avoid fast store writes