Non-blocking Cache Slots via Atomic Versioning
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing caching techniques face challenges in ensuring data consistency and efficiency, often relying on heavyweight locking mechanisms or resulting in redundant data caching, which can lead to performance issues and increased latency.
Innovation Solution
A cache structure with a plurality of slots, where each slot is managed using an IN_USE column for access control, allowing for atomic operations like compare-and-swap to determine slot availability, enabling non-blocking access and reducing contention by protecting slots individually, thus allowing threads to continue processing even if a slot is not available.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If heavyweight locking mechanisms are used to ensure cache consistency, then data consistency is improved, but access latency and contention increase
Solution Approach 1:
The cache is divided into multiple independent slots, each with its own lock-free access control. Instead of using a single global lock or heavyweight locking mechanism for the entire cache, the system segments the cache into individual slots that can be accessed independently. This segmentation allows multiple threads to access different slots simultaneously without contention, while still ensuring data consistency within each slot through version numbers and conditional operations.
2Reliability
If cache slots are dedicated to particular threads over extended execution timeframes, then cache consistency is improved, but cache efficiency decreases due to redundant caching
Solution Approach 1:
The cache slot automatically manages its own state through version numbers and conditional operations. Each slot maintains its own version counter that increments with each access, allowing threads to perform optimistic reads and writes without requiring dedicated thread ownership. The slot itself services the consistency requirements through its internal version tracking, eliminating the need for thread-specific cache dedications and their associated redundancy.
3Speed
If non-blocking access is implemented, then access speed and throughput are improved, but ensuring data consistency becomes more difficult
Solution Approach 1:
The cache slot provides feedback to accessing threads through version numbers that indicate the current state of the slot. Threads perform optimistic reads and can detect conflicts by comparing version numbers before and after their operations. This feedback mechanism allows threads to proceed without blocking while still ensuring consistency, as conflicting operations can be detected and handled through retry logic or conditional updates based on version comparison.
Data Source
AI summary
The described implementations relate to processing of electronic data. One implementation is manifested as a system that can include a cache module and at least one processing device configured to execute the cache module. The cache module can be configured to store data items in slots of a cache structure, receive a request for an individual data item that maps to an individual slot of the cache structure, and, when the individual slot of the cache structure is not available, return without further processing the request. For example, the request can be received from a calling application or thread that can proceed without blocking irrespective of whether the request is fulfilled by the cache module.


