Blurring the Lines between Blockchains and Database Systems: the Case of Hyperledger Fabric

background

The biggest difference between a distributed database and a blockchain:
traditional databases require trusted nodes, and blockchain technology supports Byzantine nodes.

Two models

order-execute

Sort by consensus algorithm first, and then execute locally at each node. Representatives include Bitcoin, Ethereum, etc.

The model has two shortcomings:

  1. Cannot execute in parallel

  2. Every node must be executed

As a result, it cannot expand and has low performance.

Distributed databases solved these problems many years ago.

simulate-order-validata-commit

Parallel simulation, post-verification. Representatives are Hyperledger Fabric.

Support for concurrent execution, but Hyperledger Fabric's implementation is not good enough: a large number of transactions are aborted, resulting in low tps.

optimization

The author uses two optimization methods for concurrency control to optimize Hyperledger Fabric:

  • transaction recordering
  • early transaction abort (requires fine-grained concurrent support)

Why are these two concurrency control optimization measures adopted?

  1. Commit transactions in the form of blocks, some optimizations are for individual transactions
  2. The blockchain is distributed and replicated, the traditional database may be stand-alone, partition,
  3. Blockchain transactions are simulated at multiple nodes, the node state may be inconsistent, and the database state must be consistent
  4. The performance bottlenecks of blockchain are encrypted signatures, network communication, and trust verification. The bottleneck of traditional databases is the use of low-level components, such as locking mechanisms. Some optimizations are aimed at lower levels

Concurrency control technology is divided into two categories: one is to improve throughput, and the other is to transform aborted transactions into successful transactions

The author can only use the second one after analysis.

achieve

transaction recordering

#1 强连通分量
#2 simple 环
#3 统计各点的环数
#4 去点,同时更新环数
#5 拓扑排序,逆序

early transaction abort

Terminate early in the simulation phase or sequencing phase.

Simulation phase :

Simulate and verify in parallel. Check the version when reading data during the simulation. If the version is greater than last-version, it means that the data has been modified during the verification phase, terminate the simulation, and end the transaction early.

Sorting stage :

If different transactions in the same block read different versions of the same data, it means that other transactions between the two simulations have modified the data, and the latter transaction becomes invalid, no longer sorts it, and ends the transaction early.

Published 74 original articles · Like 11 · Visits 30,000+

Guess you like

Origin blog.csdn.net/yijiull/article/details/96980714