Reader bias based locking technique enabling high read concurrency for read-mostly workloads
AssigneeOracle International Corporation
InventorsDavid Dice, Alex Kogan
Life of this patent
Estimating the term…
Abstract
A data object has a lock and a condition indicator associated with it. Based at least partly on detecting a first setting of the condition indicator, a reader stores an indication that the reader has obtained read access to the data object in an element of a readers structure and reads the data object without acquiring the lock. A writer detects the first setting and replaces it with a second setting, indicating that the lock is to be acquired by readers before reading the data object. Prior to performing a write on the data object, the writer verifies that one or more elements of the readers structure have been cleared.
Claims20
A computer-implemented method, comprising:
- determining, by a first writer of a plurality of data accessors which includes at least the first writer and at least one reader, that a flag associated with a data object on which a write operation is to be performed by the first writer is set to a first value, wherein the first value indicates that a read operation on the data object can be performed without acquiring a lock associated with the data object;
- computing, by the first writer based on one or more metrics associated with the write operation, a duration during which readers are to be prevented from performing read operations on the data object without acquiring the lock;
- and
- causing, by the first writer, the flag to be set to a second value for at least the duration, wherein the second value indicates that the lock has to be acquired to perform a read operation on the data object.
A system, comprising:
- one or more computing devices;
- wherein the one or more computing devices include instructions that upon execution on or across the one or more computing devices:
- determine, by a first writer of a plurality of data accessors which includes at least the first writer and at least one reader, that a flag associated with a data object on which a write operation is to be performed by the first writer is set to a first value, wherein the first value indicates that a read operation on the data object can be performed without acquiring a lock associated with the data object;
- compute, by the first writer based on one or more metrics associated with the write operation, a duration during which readers are to be prevented from performing read operations on the data object without acquiring the lock;
- and
- cause, by the first writer, the flag to be set to a second value for at least the duration, wherein the second value indicates that the lock has to be acquired to perform a read operation on the data object.
A computer-implemented method, comprising:
- obtaining, by one or more readers of a plurality of data accessors, read access to a first data object without acquiring a first lock on the first data object;
- determining, by a writer of the plurality of data accessors, whose write is directed to the first data object, that the write is to be deferred until the one or more readers have completed respective read operations on the first data object;
- and
- causing, by the writer, based at least in part on said determining, another reader of the plurality of data accessors to acquire the first lock to obtain read access to the first data object.
Dependencies are inferred from the claim text.