TL;DR
This paper introduces an enhanced batch query architecture for real-time recommendation systems, featuring a novel "NeighborHash" data structure and a hybrid NVMe/memory storage system. This architecture significantly boosts query throughput and reduces resource consumption, as demonstrated by its successful deployment in Bilibili's recommendation system.
What Problem Does This Paper Address?
Modern recommendation systems, especially those serving massive user bases like Bilibili, face a critical challenge: processing billions of items and features to deliver personalized recommendations in milliseconds. This requires extremely fast retrieval of user and item data, often involving complex feature stores and embedding tables that can reach terabyte scales. Traditional storage and query architectures struggle to keep up with the increasing data volume and the demand for real-time updates, leading to performance bottlenecks and high resource costs. The paper specifically targets the need for a high-performance, scalable, and consistent batch query service that can handle the demands of deep learning-based recommendation systems.
Methods
The core of the proposed solution is a new hash table structure called NeighborHash. It's an optimization of Coalesced Hashing designed to minimize cacheline accesses during batch queries. Key innovations include:
- Cacheline-Aware Neighbor Probing: Instead of linear probing, NeighborHash probes within the same cacheline first, then expands bidirectionally to nearby cachelines. This reduces cross-cache-line accesses, a major bottleneck.
- Lodger Relocation: This strategy dynamically places colliding elements within the "address region" of the hash table, eliminating a dedicated "cellar" and minimizing probing sequence lengths (PSL).
- Inline Chaining with Relative Offsets: NeighborHash uses the high 12 bits of its value field to store relative offsets, enabling efficient conflict resolution and reducing the overall memory footprint.
Complementing NeighborHash, the architecture also incorporates:
- Hybrid NVMe/Memory Storage: Hot data (frequently accessed) is stored in memory, while cold data resides on NVMe. This balances performance and cost. The NeighborHash structure stores a bit indicating whether the data is in memory or NVMe, with memory pointers for hot data and file system offsets for cold data.
- Batch Query Subsystem: This is a multi-sharded, multi-replica framework designed for horizontal scalability. It supports automatic sharding and rolling updates with a focus on maintaining data consistency during these updates, crucial for real-time learning.
- Vectorization (AMAC): The system leverages AMAC (Asynchronous Memory Access Chaining) for inter-query vectorized lookups, further accelerating batch query performance, especially on larger datasets.
Datasets
The paper does not explicitly mention specific public datasets used for training or initial benchmarking. However, the core evaluation is performed on:
- Simulated Datasets: Experiments for NeighborHash and its components are conducted on various dataset sizes (e.g., 256KB, 2MB, 16MB, 256MB, 2GB, 16GB) with a load factor of 80%. These datasets are described as uniformly distributed, with some mention of testing skewed data as well.
- Bilibili's Real-world Recommendation System: The architecture's effectiveness is validated through deployment and A/B testing within Bilibili's production environment, which serves hundreds of millions of users. This includes a high-traffic storage table for item features (40M items, 1KB per-item).
Key Insights and Ideas
- Cacheline-Awareness is King for Batch Queries: The paper strongly demonstrates that optimizing for cacheline locality is paramount for achieving high throughput in batch query scenarios, significantly outperforming traditional probing strategies.
- Dynamic Cellar Management is Effective: Eliminating a fixed "cellar" in coalesced hashing and dynamically relocating colliding elements (lodger relocation) proves to be a robust strategy for maintaining low probe lengths.
- Hybrid NVMe/Memory is a Practical Necessity: For large-scale industrial systems, a tiered storage approach is essential for balancing performance and cost, and the proposed method for managing this within the hash table is a key enabler.
- Consistency is Crucial for Real-time Updates: The paper highlights that maintaining data consistency during rolling updates, especially for embedding tables, directly impacts recommendation effectiveness (e.g., CTR), showing tangible benefits from their consistency protocols.
- Real-world Deployment Validates Gains: The successful integration into Bilibili's system, supporting a 10x increase in model computation with minimal resource growth, is a strong testament to the architecture's practical value.
Key Results
- NeighborHash Throughput: NeighborHash achieves up to 90% of the query throughput of random memory access when parallel optimization is applied. It shows a 170% performance improvement over optimized hash tables in batch query scenarios.
- Cacheline Access Reduction: NeighborHash reduces the average number of cache lines accessed per query to approximately 1.12, compared to 1.47 for Linear Probing.
- NVMe Integration: The hybrid NVMe/memory storage significantly reduces resource consumption by utilizing NVMe for cold data.
- Bilibili Deployment: The architecture supported a 10x increase in model computation with minimal resource growth, improving outcomes while preserving real-time performance.
- Latency Improvement: Compared to a RocksDB-based key-value query service, the proposed system showed a 3 to 6 times increase in query latency.
- CTR Improvement: A/B tests showed relative CTR increases of up to 6.94% with shorter data updating intervals, attributed to improved data consistency.
Limitations and Future Work
- Dataset Size and Cache Misses: The paper notes that as dataset size increases beyond a certain point (e.g., 16MB), LLC miss rates rise, and MOPS becomes dominated by memory latency. While NVMe helps, further optimizations for extreme data sizes might be needed.
- Resource Sharing for Low-Traffic Tables: The authors suggest future work could focus on cluster scheduling to improve resource efficiency by sharing replicas among low-traffic tables, especially in systems with long-tail distributions.
- Integration of Designs: The paper hints that integrating their approach with other feature store architectures could yield even greater benefits.
- Generalizability: While tested in a video recommendation context, the broader applicability across different recommendation domains and data types could be further explored.
Summary updated