NativeLink provides a powerful and flexible storage abstraction that supports multiple backend types, composition strategies, and optimization layers. Stores are used for both Content Addressable Storage (CAS) and Action Cache (AC).Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TraceMachina/nativelink/llms.txt
Use this file to discover all available pages before exploring further.
Store Types
NativeLink supports a wide variety of storage backends, each optimized for different use cases.Memory Store
Ultra-fast in-memory storage using hashmaps.Pros
- Extremely fast access
- Zero latency
- Simple configuration
Cons
- Volatile (lost on restart)
- Limited by available RAM
- Not shared across machines
- Fast local cache tier
- Development and testing
- Small projects
Filesystem Store
Persistent disk-based storage.- content_path: Where blobs are stored permanently
- temp_path: Temporary location for uploads (must be on same filesystem for atomic moves)
- block_size: Filesystem block size (affects size calculations)
- max_concurrent_writes: Limit concurrent writes to prevent I/O saturation
On startup, the filesystem store scans
content_path and rebuilds the index. Large stores may take time to initialize.- Local persistent cache
- Single-node deployments
- CI runners with local disk
Cloud Object Stores
Distributed cloud storage for sharing across machines.- Amazon S3
- Google Cloud Storage
- NetApp ONTAP S3
- key_prefix: Namespace for objects (useful for multi-tenant buckets)
- retry: Configure retry behavior for transient failures
- multipart_max_concurrent_uploads: Parallel upload chunks for large files
- consider_expired_after_s: Treat objects older than this as expired (for external cleanup)
- Distributed teams
- CI/CD pipelines
- Multi-region deployments
- Persistent shared cache
Redis Store
Fast remote key-value storage.- standard: Single Redis instance
- cluster: Redis Cluster mode
- sentinel: Redis Sentinel for high availability
- Metadata storage
- Action Cache backend
- Small blob cache
- Scheduler backend (experimental)
GRPC Store
Proxy to a remote NativeLink store via gRPC.- Federated deployments
- Hybrid cloud setups
- Separating CAS from scheduler
Noop Store
Discards all data (writes to /dev/null).- Discarding large objects in size partitioning
- Testing configurations
- Debug scenarios
Experimental Stores
MongoDB Store
MongoDB Store
Store Composition
NativeLink’s power comes from composing stores to create sophisticated storage strategies.FastSlow Store
Two-tier caching with fast and slow backends.- Read: Check fast store, fallback to slow, promote to fast on hit
- Write: Write to both stores simultaneously
- both
- update
- get
- read_only
Normal operation for both reads and writes.
Compression Store
Transparently compresses data before storing.- Extremely fast compression/decompression
- Moderate compression ratio
- Ideal for network-backed stores
Recommendation: Use compression before network stores (S3, GCS) to reduce transfer costs and time.
- ✅ Uncompressed build artifacts (executables, object files)
- ✅ Text files (logs, source code)
- ❌ Already compressed files (zips, jpegs, videos)
Dedup Store
Content-defined chunking for efficient storage of similar files.- Splits input into variable-size chunks using rolling hash
- Computes hash of each chunk
- Stores unique chunks in
content_store - Stores chunk index in
index_store
- Deduplicate similar files (e.g., slightly modified binaries)
- Reduce storage for incremental changes
- Efficient delta-like storage
- Large binaries with small changes
- Docker layers
- Compiled artifacts with incremental updates
Shard Store
Distribute load across multiple backend stores.- Distribute across multiple disks
- Load balancing
- Gradual migration between stores
Size Partitioning Store
Route objects to different stores based on size.- Objects < 128 MiB →
lower_store(Redis) - Objects ≥ 128 MiB →
upper_store(S3)
Use Case: Redis for small blobs (fast), S3 for large blobs (scalable).
Verify Store
Validate uploads to prevent corruption.- verify_size: Ensure uploaded size matches digest size
- verify_hash: Recompute hash and verify it matches digest
CAS Stores
Enable both
verify_size and verify_hashPrevents corrupt data from entering the cache.AC Stores
Disable both checksAction results are not content-addressed.
Completeness Checking Store
Ensure AC results reference existing CAS objects.Strongly recommended for AC stores to prevent incomplete cache hits.
Existence Cache Store
Cachehas() calls to reduce latency.
Ref Store
Reference a named store from the global store manager.Eviction Policies
Control when data is removed from stores.Setting
evict_bytes creates a low watermark to prevent thrashing when near the limit.Advanced Patterns
Three-Tier Cache
- Memory (2 GB) - Ultra-fast
- Filesystem (50 GB) - Fast local persistent
- S3 (Unlimited) - Slow shared cloud
Compressed Cloud Storage
- Reduce network transfer time
- Lower cloud storage costs
- Faster uploads/downloads
Partitioned Redis + S3
- Small blobs (< 256 MB) in Redis for speed
- Large blobs (≥ 256 MB) in compressed S3 for scalability
Best Practices
-
CAS Configuration:
- Use
verifystore with both checks enabled - Consider
compressionfor network stores - Use
fast_slowfor multi-tier caching
- Use
-
AC Configuration:
- Use
completeness_checkingto ensure integrity - Disable
verify_sizeandverify_hash - Keep AC smaller and faster than CAS
- Use
-
Production Deployments:
- Use cloud storage (S3/GCS) for shared CAS
- Local fast tier (memory/filesystem) for performance
- Compression to reduce costs
- Eviction policies to prevent unbounded growth
-
Performance:
- Memory > Filesystem > Redis > S3/GCS (latency)
- Use
existence_cachefor slow backends - Set
max_concurrent_writeson filesystem stores
Next Steps
Build Cache
Learn how CAS and AC work together
Architecture
Understand the full system design