Graph Database Row Lock Segmentation for Write Concurrency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In graph databases, hot data writes lead to significant reductions in overall write TPS due to lock contention, causing most write threads to be blocked and resulting in failed or timed-out requests, as existing methods rely on coarse-grained locks that prevent concurrent execution.

Innovation Solution

Implementing a finer-grained row lock structure for each vertex or edge, allowing dynamic management of row locks, which reduces lock contention and improves write throughput by enabling concurrent writes through a locking sequence and asynchronous retry mechanisms.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If coarse-grained locks are used to ensure data accuracy during graph data writes, then data consistency is maintained, but write throughput is greatly reduced due to lock contention blocking most write threads

Engineering Contradiction:
Improvedata consistencyVSAvoidwrite throughput
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent segments the coarse-grained lock into multiple fine-grained row locks, where each row lock corresponds to a specific vertex or edge in the graph data. This segmentation allows different write threads to acquire locks on different rows simultaneously, enabling concurrent writes while maintaining data consistency within each row. The lock granularity is divided from the entire graph data scope down to individual row-level units.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements local quality by making lock protection scope localized to specific rows rather than the entire graph data. Each row lock only protects its corresponding vertex or edge, allowing other unrelated data to be accessed and modified by other threads without contention. This localized protection maintains consistency where needed while permitting parallel operations elsewhere in the system.

Inventive Principle:
Principle #3Local quality

2Reliability

If row locks are held until all graph data writes are completed to ensure accuracy, then data integrity is maintained, but the locking duration increases causing more write threads to be blocked

Engineering Contradiction:
Improvedata integrityVSAvoidlocking duration
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent extracts the locking requirement from the entire graph data write operation and applies it only to the specific row being modified. Instead of holding a lock on the whole graph data structure during the write operation, the system acquires and releases locks only on the individual vertex or edge being written. This extraction minimizes the time locks are held while ensuring integrity of the specific data being modified.

Inventive Principle:
Principle #2Taking out (Extraction)

3Reliability

If a large number of row locks are created to cover ultra-large-scale graph data, then all data can be protected, but memory consumption increases significantly

Engineering Contradiction:
Improvedata protection coverageVSAvoidmemory usage
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent implements dynamic row lock management where locks are created and destroyed based on actual write operations. Instead of pre-creating and maintaining a static set of row locks for all possible vertices and edges in the ultra-large-scale graph data, the system dynamically allocates locks only when a write operation targets a specific row. This dynamic approach ensures comprehensive data protection coverage while minimizing memory usage by only holding locks when necessary.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS12189598B2Writing graph data
Publication Date: 2025.01.07 ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
  • US12189598B2 patent drawing
  • US12189598B2 patent drawing
  • US12189598B2 patent drawing

AI summary

Methods, computer-readable media and apparatuses are disclosed for graph data write. In an example, in response to receiving a first graph data write request, row lock indexes of corresponding row locks of target write objects are determined based on object identification information of the target write objects in the first graph data write request, where each target write object corresponds to a row lock. The target write objects are locked based on the row lock indexes of the target write objects; graph data write is performed for the first graph data write request after the target write objects are locked; the row locks held by the first graph data write request are unlocked after graph data of the target write objects is written; and a graph data write result is provided to a user after all the row locks held by the first graph data write request are unlocked.