Introduction
In the modern era of massive data serving, distributed key-value (KV) stores like Redis and Memcached are foundational. However, managing billions of users introduces a significant challenge: cost-efficiency at scale. Engineers must constantly balance the high performance and cost of RAM against the lower cost and higher capacity of disks. Traditional cost models often fail to account for specific workload characteristics, such as data access skewness, leading to over-provisioning and wasted resources.
To address this, researchers at Ant Group developed TierBase, a distributed KV store that utilizes a novel "Space-Performance Cost Model" to optimize storage and processing expenses dynamically. By integrating tiered storage, pre-trained data compression, and elastic threading, TierBase achieves up to a 62% cost reduction in production environments while maintaining sub-millisecond latency.
The Space-Performance Cost Model
The core theoretical contribution of TierBase is the Space-Performance Cost Model. The authors define the total cost of a workload as the maximum of its Performance Cost (PC) (encompassing CPU, I/O, and network) and its Space Cost (SC) (encompassing RAM and disk).
According to the Optimal Cost Theorem, the most cost-effective configuration is achieved when performance and space costs are balanced ($PC \approx SC$). If one cost dominates, the system is over-provisioned in the other dimension, representing an opportunity for optimization. For example, if a system has idle CPU but is memory-constrained, that CPU can be leveraged for aggressive data compression to reduce the space cost.
TierBase Architecture
TierBase implements this model through a disaggregated architecture consisting of three primary layers:
- Tiered Storage: The system separates a high-speed Cache Tier (utilizing DRAM or Persistent Memory/PMem) from a high-capacity Storage Tier (SSD/HDD). This allows the system to keep only the "hottest" data in expensive memory while offloading the bulk of the data to cheaper storage.
- Pattern-Based Compression (PBC): Unlike standard online compression, TierBase uses PBC to train dictionaries offline on data samples. This allows for significantly higher compression ratios with lower CPU overhead during real-time serving, effectively trading CPU cycles for reduced space costs.
- Elastic Threading: To maximize CPU efficiency, TierBase operates in a single-threaded event loop by default to avoid locking overhead. It dynamically "boosts" into multi-threaded mode only during workload spikes, ensuring performance without permanent over-provisioning.
Evaluation and Key Insights
The system was evaluated using standard benchmarks (YCSB) and real-world production traces from Ant Group, including a read-heavy User Info Service handling 16 million reads per second.
A key insight from these evaluations is the power of exploiting workload skewness. By maintaining only the hottest 1% of data in the cache tier, TierBase can achieve an 80% hit rate, drastically reducing the reliance on expensive memory. Furthermore, the PBC method outperformed standard Zstd compression by 43% in average compression ratios for KV datasets.
Key Results
In production case studies, TierBase demonstrated substantial economic benefits. For the User Info Service, TierBase achieved a 62% cost reduction compared to a raw baseline. As shown in the figure below, various optimizations—including the use of PMem, PBC, and tiered caching—progressively drive down the normalized total cost by balancing space and performance requirements.
Conclusion and Future Work
TierBase proves that any imbalance between performance and space costs is an opportunity for optimization. While the system is highly effective, future work aims to automate the configuration process. Currently, finding the exact optimal cache ratio requires a sample-and-replay framework; the authors hope to implement real-time, automated mapping of workload features to optimization strategies to further simplify deployment in diverse environments.
Summary updated