Global Secondary Path Locking for High Read Concurrency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing reader-writer locks face challenges in high read concurrency scenarios, with long lock acquisition times for writers leading to excessive wait times for readers, and existing techniques suffer from issues like larger lock sizes and scalability problems.
Innovation Solution
A global secondary path (GSP) technique using a collection of non-global locks and a global lock allows readers to obtain read access through a decentralized primary pathway and a centralized secondary pathway, enabling efficient read operations without acquiring the primary lock.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a global lock is used for read access, then read concurrency is improved, but writer wait time increases excessively
Solution Approach 1:
The lock system is segmented into multiple non-global locks (one per CPU) and a global lock. Readers attempt to acquire non-global locks first for decentralized access, and only fall back to the global lock if non-global locks are unavailable. This segmentation allows multiple readers to access data concurrently without contending for a single global lock, improving read concurrency while limiting writer wait time to only when all non-global locks are held.
2Productivity
If purely distributed reader indicators are used, then read scalability is improved, but lock size and system complexity increase
Solution Approach 1:
The reader indicator mechanism is segmented into per-CPU non-global locks rather than a single distributed structure. Each non-global lock is a simple counter stored in per-CPU memory, avoiding the need for large distributed data structures. This segmentation achieves read scalability through decentralized access while keeping individual lock sizes small and memory footprint minimal.
3Productivity
If non-global locks are used for decentralized access, then read concurrency is improved, but writer lock acquisition time increases
Solution Approach 1:
Writers perform preliminary actions by acquiring all non-global locks before attempting to acquire the global lock. This preliminary acquisition of non-global locks prevents readers from using the fast path through non-global locks, ensuring that writers will eventually be able to acquire the global lock without excessive contention. The preliminary action of taking non-global locks first reduces the time writers spend waiting for the global lock.
Data Source
AI summary
A reader of a set of data accessors that includes readers and writer detects that a particular lock of a first collection of non-global locks associated with a data object of a computing environment is held by another accessor. After checking a blocking indicator, the reader uses a second lock (which is not part of the first collection) to obtain read access to the data object and implements its reads without acquiring the particular lock. Prior to implementing a write on the data object, a writer acquires at least some locks of the first collection, and sets the blocking indicator to prevent readers from using the second lock to obtain read access to the data object.


