Blockchain Transaction Grouping via Atomic Arrays
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing blockchain technologies face inefficiencies in grouping transactions with read-write conflicts, which necessitate serial execution, leading to reduced throughput due to the time-consuming nature of traditional grouping algorithms.
Innovation Solution
A method and apparatus that utilize a shared memory to concurrently manage a belonging array and an associative array through atomic comparative change operations, allowing multiple threads to group transactions based on association relationships without complex data structure searches, thereby optimizing multi-CPU performance.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a single thread groups transactions based on overlapping read-write sets, then the grouping can be performed sequentially, but the throughput rate is greatly restricted when there are tens of thousands of transactions
Solution Approach 1:
The patent divides the transaction grouping task into multiple independent segments that can be processed by different threads simultaneously. Each thread handles a subset of transactions and uses atomic operations to update shared data structures (belonging array and associative array), enabling parallel processing that significantly improves throughput rate
Solution Approach 2:
The patent introduces atomic operations as intermediaries to coordinate access between multiple threads to shared memory structures. The atomic comparative change operation serves as a mediator that allows threads to safely update the belonging array and associative array without conflicts, enabling efficient parallel grouping
2Loss of time
If traditional grouping algorithms are used, then the read-write conflicts can be detected, but hundreds of milliseconds are needed for the grouping algorithm
Solution Approach 1:
The patent performs preliminary actions by pre-establishing the belonging array and associative array data structures before transaction grouping begins. Transactions are processed in batches, and the atomic operations prepare the grouping results in advance, reducing the overall grouping time from hundreds of milliseconds to a much shorter duration
Solution Approach 2:
The patent makes the grouping process dynamic by using atomic comparative change operations that can adaptively update the belonging array and associative array based on real-time transaction characteristics. This dynamic approach allows the system to efficiently handle varying transaction volumes and conflict patterns
Data Source
Figure 1
Figure 2
Figure 3~5
AI summary
Implementations of the present specification provide a method and an apparatus for grouping transactions in a blockchain. The method includes: obtaining a first transaction in multiple transactions; obtaining a first variable accessed in the first transaction; reading a first value of a first belonging variable corresponding to the first variable; reading a first value of a first associated variable corresponding to the first transaction; if the first value of the first belonging variable is a numbering value of a second transaction in the multiple transactions, recording an association relationship between the first transaction and the second transaction in the associative array by performing an atomic comparative change operation on an atomic variable in an associative array; and grouping the multiple transactions based on the associative array.