<<

SChain: A Scalable Consortium Exploiting Intra- and Inter-Block Concurrency

Zhihao Chen1 Haizhen Zhuo2 Quanqing Xu2 Xiaodong Qi1 Chengyu Zhu1 Zhao Zhang1 Cheqing Jin1,∗ Aoying Zhou1 Ying Yan2 Hui Zhang2 1East China Normal University 2Ant Group {chenzh, xdqi, cyzhu}@stu.ecnu.edu.cn, {zhzhang, cqjin, ayzhou}@dase.ecnu.edu.cn {haizhen.zhz, xuquanqing.xqq, fuying.yy, shengchu.zh}@antgroup.com ABSTRACT We demonstrate SChain, a consortium blockchain that scales trans- action processing to support large-scale enterprise applications. The Insurance Trust peers unique advantage of SChain stems from the exploitation of both company company intra- and inter-block concurrency. The intra-block concurrency Consortium Blockchain not only takes advantage of the multi-core processor on a single Network peer but also leverages the capacity of multiple peers. The inter- block concurrency enables simultaneous processing across multiple Bank B ...... Bank A peers blocks to increase the utilization of various peers. In our demonstra- Within Single Part. tion, we use real-time dashboards containing visualization based on the output of SChain to give the attendees interactive explorations pack block Ordering Instance (BFT) of how SChain achieves intra- and inter-block concurrency. Executor Storer scale Bank A Order Execute Finalize PVLDB Reference Format: Figure 1: Example scenario of the consortium blockchain Zhihao Chen, Haizhen Zhuo, Quanqing Xu, Xiaodong Qi, Chengyu Zhu, Zhao Zhang, Cheqing Jin, Aoying Zhou, Ying Yan, Hui Zhang. SChain: A results are then validated sequentially after ordering to abort trans- Scalable Consortium Blockchain Exploiting Intra- and Inter-Block actions that cause violation of . Although FastFabric Concurrency. PVLDB, 14(12): 2799 - 2802, 2021. [5] parallelizes the validation for transactions across blocks, it still doi:10.14778/3476311.3476348 inherits the limitation that read/write sets are validated sequen- 1 INTRODUCTION tially. On the other hand, ParBlockchain [2] and BlockchainDB [8] first analyze the conflicts among transactions and then allow non- Consortium blockchain is being widely applied to support large- conflicting transactions to be executed in parallel. However, current scale businesses in enterprise collaboration, e.g., the AntChain [1] solutions have fundamental limitations from two aspects. (1) These has been conducted with more than 50 multilateral collaboration works only arrange a single peer to execute all transactions. When scenarios. We exemplify one typical scenario about supply chain a peer is dedicated fully, the performance cannot be further scaled. finance in the upper part of Figure 1. In such a scenario, multiple par- (2) The concurrent execution merely involves transactions within a ticipants such as banks, insurance & trust companies cooperate to block where transactions of later blocks cannot be executed before host the blockchain network, each of which commonly devotes mul- the execution of the current block terminates. This approach does tiple peers. Observe that peers belonging to different participants not consider the transaction parallelism across multiple blocks. are mutually distrusting due to the potentially hostile environment, To address these issues, we present a scalable blockchain sys- while ones within the same participant have a trust foundation. tem SChain, which leverages both intra-block and inter-block con- Motivated by this fact, we want to scale the system in terms of each currency to scale the . In general, SChain participant to support extensive applications. follows a novel scalable order-execute-finalize (SOEF) paradigm as To empower the individual participant, a general option is to illustrated from the of a single participant at the bottom of replace the sequential execution mechanism with a concurrent Figure 1. The transaction flow is divided into three phases: ordering, one [2, 7, 8] to leverage the modern multi-core processors. Fabric execution and finalization, which can run on different peers. For [3] introduces the concurrency to blockchain under an execute- intra-block concurrency, transactions within a block are distributed order-validate- paradigm, where transactions are executed over multiple executors for parallel execution to break through the in parallel before ordering. In this paradigm, however, the execution performance bottleneck of a single peer. Moreover, each executor ∗Corresponding author. employs deterministic concurrency control to enable concurrent This work is licensed under the Creative Commons BY-NC-ND 4.0 International transaction execution locally. For inter-block concurrency, SChain License. Visit https://creativecommons.org/licenses/by-nc-nd/4.0/ to view a copy of pipelines the processes of blocks and therefore allows transactions this license. For any use beyond those covered by this license, obtain permission by emailing [email protected]. Copyright is held by the owner/author(s). Publication rights across multiple blocks to execute concurrently. This approach over- licensed to the VLDB Endowment. comes the existing block-by-block execution drawbacks and enables Proceedings of the VLDB Endowment, Vol. 14, No. 12 ISSN 2150-8097. doi:10.14778/3476311.3476348 executors to execute transactions constantly, further improving the resource utilization of different peers.

2799 the execution result is equivalent to the serial order determined by Organization Executor E1 1 TXID: 1319 ordering. Additionally, the protocol requires the read/write keys R(T ) = {...... } Ta a ...... of transactions should be known in advance by some techniques. } W(T ) = {{KeyA, V }, Executor E A a A SChain holds this acquisition for Turing-complete smart contracts 3 { {KeyC, V }} {KeyA,V KeyC,V C TXID: 1332 by using static analysis and speculative execution which is also ...... R(Tb) = {KeyA, KeyB} Tb C adopted by ParBlockchain [2]. } Executor E2 W(Tb) = {{KeyA, VA'}} {KeyA,V Ideally, transactions share no conflicts among executors so that TXID: 1385 A '} executors can execute them locally and concurrently following the Tc R(Tc) = {KeyA, KeyC} ...... Intra-block concurrency W(Tc) = {{KeyC, VC'}} DCC protocol. However, such a division is hard to guarantee under within an organization high contention. Further considering workload balance, SChain al- lows conflicting transactions to be executed by different executors. While SChain still guarantees that the merge of the execution re- ...... T ... T ... T ...... a b c sults is equivalent to the predetermined serial order. This is achieved Block N Block N+1 by migrating the outputs of transactions among executors. In par- Figure 2: Exploiting intra-block concurrency through dis- ticular, an executor 퐸 will not execute a transaction that reads the tributed concurrent execution mechanism output of another transaction assigned to executor 퐸′ before 퐸′ The purpose of this demonstration is to show the attendees correctly forwards the output to 퐸. impressive improvement and common usability of SChain. More Since peers within the same participant trust each other, the specifically, we manage to provide an interactive front-end UI for execution among them assumes no Byzantine behavior. We have attendees to operate with SChain. The attendees will gain both omitted details relating to aborts and resilience to crash faults. a high-level overview and a deep insight into the unique tech- These details are discussed in the extended version. niques utilized by SChain. In our demonstration, Section 2 gives an Example 2.2.1. Figure 2 details how SChain applies the proposed overview of SChain, introducing its core techniques and architec- mechanism to realize high concurrency and workload balance in ture. In Section 3, the demonstration details are presented with an contention. Suppose there are three executors 퐸1, 퐸2 and 퐸3 be- interactive user experience of our system. longing to 푂푟푔푎푛푖푧푎푡푖표푛1. SChain is currently processing the block 푁 which has already been ordered. Then transactions of block 푁 2 SCHAIN OVERVIEW are partitioned and sent to executors. For instance, 푇푎 and 푇푏 are 2.1 Threat Model assigned to different executors while they share a write-read de- pendency on 퐾푒푦퐴. SChain guarantees that 퐸3 can only execute SChain operates under hybrid trust and fault assumptions. Peers are 푇푏 until 퐸1 forwards the output of 퐾푒푦퐴 to 퐸3. This is achieved by grouped into organizations. An organization here is regarded as an analyzing their predetermined 푇푋퐼퐷(푠) and the keys of read/write individual participant. Recall that peers within the same participant sets before division. On the other hand, 푇푐 should wait for both the trust each other while others share no trust. Since there is no trust output of 푇푎 and 푇푏 . The migration of data ensures the merged re- among participants, SChain employs the PBFT protocol to achieve sult of all executors is serializable and deterministic. We emphasize consensus, where at most 푓 participant(s) can be malicious out of that this behavior will not interfere with the concurrent execution 푛 participants such that 푛 ≥ 3푓 + 1. of other non-conflicting transactions. 2.2 Intra- and Inter-Block Concurrency 2.2.2 Inter-Block Concurrency. Different from existing works, the innovation of SChain is to explore the potential of inter-block Motivated by the assumptions above, SChain extends the concur- concurrency. By interleaving the workflows for different blocks, rency to improve transaction processing. We summarize the key SChain forms the pipelined workflow. Notably, SChain granularly features of SChain as the intra- and inter-block concurrency with divides its three phases into five stages as presented in Figure 3. further discussions about them. Then these stages can be conducted on different peers so that the 2.2.1 Intra-Block Concurrency. SChain proposes a distributed stages across blocks may overlap. Benefit from this design, SChain concurrent execution mechanism to enhance the capacity of a sin- can simultaneously multiple blocks. Thus, its workflow is no gle participant. That is, the intra-block transactions are distributed longer block-by-block quiescently and all types of peers can keep on to multiple executors for concurrent execution. In intuition, trans- working, fully utilizing the system resources. Furthermore, SChain actions are executed in parallel among executors. Moreover, this allows transactions in later blocks to be executed earlier if they mechanism ensures they are executed concurrently within a single do not conflict with executing transactions. This design ensures executor and the merge of their results is deterministic. Then we inter-block transactions execute concurrently among all executors, illustrate the design details. leading to the transaction streaming pipeline. It means transactions To maximize the parallelism among executors, SChain analyzes across multiple blocks are flowing among stages constantly to finish all potential conflicts among transactions and dispatches utmost their execution. It also promises the worker threads on executors conflicting transactions to the same executor. Then, each execu- always have enough transactions to execute, further improving the tor executes received transactions concurrently following the de- overall performance. terministic concurrency control (DCC) [4, 9]. The DCC protocol Example 2.2.2. Figure 3 depicts how the transaction streaming enables transactions to execute concurrently while still promising pipeline empowers SChain to achieve inter-block concurrency over

2800 Ordering Execution Finalization Ordering Execution Finalization Async Commit Update Records Organzation1 Dispatch Concurrent Update Commit Consensus ordering Block N-1 Txns Execution Records State send state tree transactions instance Txns

Text Async Commit executor Update Records ● records ● ● Dispatch Concurrent Update Commit Consensus orderer Block N Txns Execution Records State Client Txns KV Store executor storer Async Commit LEGEND

Update Records ● ● ● Txn ● ● ● ● ● ● peer Dispatch Concurrent Update Commit Consensus block Block N+1 Txns Execution Records State set of Txns ...... OrganzationN ...... t1 records Inter-block Transaction Streaming Figure 4: SChain Architecture

...... Ta Tb Tc Td Te Td Te ... Td Te Tf Tg Tf Tg ... transactions because each transaction is handled by a unique ex- Proceed to Block N Block N+1 next stage ecutor and all relevant data is migrated to this executor. Thus, each Tb Tc Te Tc Te Tg ...... organization can devote more executors on-demand to raise the Executor E1 Executor E1 ...... Td ...... Td Tf parallelism and processing of execution. Executor Ek Executor Ek Inter-block contention

t0 t1 t1 t2 Figure 3: Exploiting inter-block concurrency through trans- 3 DEMONSTRATION action streaming pipeline We deploy SChain in the back-end and demonstrate it in two sce- narios. An interactive front-end interface is provided to help the attendees step through the process of intra-block execution and three blocks. In the upper part of the figure, three pipes of 퐵푙표푐푘 − , 푁 1 inter-block workflow. Additionally, we showcase the of 퐵푙표푐푘 and 퐵푙표푐푘 + form the pipelined workflow. As can be seen, 푁 푁 1 execution through a graphical dashboard that displays the detailed the workflows for different blocks interleave. By obeying themen- system performance. tioned rules, a transaction in 퐵푙표푐푘푁 +1 can execute before some transactions in 퐵푙표푐푘 . To dive into this process, we pick up a 푁 3.1 Setup and Interface timepoint 푡1 and reveal corresponding details in the bottom part. In the left bottom, worker threads on executor 퐸1 are concurrently The demo SChain is initially deployed up to four organizations, executing 푇푏 of 퐵푙표푐푘푁 −1 and 푇푑 of 퐵푙표푐푘푁 at timepoint 푡1. Once each of which may jointly run many ordering instances and deploy the execution stage of 퐵푙표푐푘푁 +1 starts, belonging transactions will multiple executors. We monitor and interact with one target orga- enter the streaming processing. In the right bottom, 푇푔 of 퐵푙표푐푘푁 +1 nization and present its information in Figure 5, which are divided shares no conflicts so that it can be executed in parallel withoth- into five panels A∼E. Panel A and B present the latest information ∼ ers once 푇푒 finishes its execution to set an idle worker thread. On on blocks and transactions. Panel C E depict the runtime status of the other hand, 푇푑 will apply the output of records to activate the the orderers, executors and storer respectively. execution of 푇푓 since 푇푓 conflicts with it. Benefit from the trans- Batch Invoke Interface. At the beginning of the demonstra- action streaming pipeline, transactions across multiple blocks can tion, the attendees will send transactions to start the process. We simultaneously execute to exploit the inter-block concurrency. provide a user-friendly interface called batch invoke to eliminate the complexity of invoking smart contracts through pre-installing a CPU-heavy smart contract on SChain. By using this interface, the 2.3 Architecture front-end will automatically sign and send transactions referring to this smart contract. Note that the pre-acquisition keys needed We design the SChain’s architecture based on proposed techniques. by SChain are also included in the transaction. Optional inputs are As shown in Figure 4, SChain consists of multiple organizations that provided for attendees to determine the batch size and additional form the network. The transactions sent by clients will go through transaction payloads, as shown on Panel F of Figure 6. three phases of processing: ordering, execution and finalization. Then we illustrate how SChain operates in these three phases. First, the ordering phase establishes a global order on all transac- 3.2 Scenario 1: Gain Insight into Intra-Block tions provided by clients through consensus. After ordering, these Concurrency transactions are distributed over executors within each organi- In the first scenario, the attendees have a chance to dive intothe zation for execution. SChain applies the distributed concurrent distributed concurrent execution. They use the batch invoke inter- execution and transaction streaming pipeline during the execution face to send transactions by filling the batch size and optionally phase. Last, the finalization phase collects the updates of records extra data. Once transactions are ordered and distributed over ex- and commits them. ecutors, the system dashboard in Figure 5 will visualize the process. The decomposed phases of SChain provide great flexibility. For The attendees can click the “View all transactions” on panel B to instance, the ordering phase can scale easily by running concur- view the status of various concurrently executing transactions. The rent instances [6] to compromise the global order. Considering runtime results for transactions are shown on panel G of Figure 6. this demonstration does not focus on scaling the ordering, we thus Records are transferred among executors to guarantee the cor- omit the implementation details. Besides, SChain avoids distributed rectness of intra-block concurrency. To trace the entire flow, the

2801 F G A B

C D E H I

Figure 5: System dashboard Figure 6: Insight of intra-block concurrency

Figure 7: Showcase the performance of multiple executors Figure 8: Inter-block concurrency visualization attendees can further inspect interested transactions. Panel H and I workflow and their runtime status is illustrated at the bottomof reveal two transactions in detail. The "Records Collection" on each Figure 8. Given this investigation, the attendees will better under- panel shows the status of records. For instance, the transaction on stand how SChain achieves inter-block concurrency by pipelining panel H has collected all the records in its read-set: 퐾푒푦퐴 and 퐾푒푦퐵. the workflows across multiple successive blocks. After being executed by 퐸1 under the DCC protocol, the output of record 퐾푒푦퐴 will be transferred to executor 퐸2 since it is required ACKNOWLEDGMENTS by the transaction on panel I. This migration of data is recorded to This work is supported by National Science Foundation of China show the attendees how data is driven from the insight. (U1911203, U1811264 and 61972152). Furthermore, the attendees will appreciate the scalability of exe- cution. If the ordering performance fully covers the execution, we REFERENCES allow attendees to scale the execution on-demand. They can click [1] 2021. AntChain. https://antchain.antgroup.com/. the red button in the middle bottom of Figure 5 to add an executor. [2] M. J. Amiri, D. Agrawal, and A. E. Abbadi. 2019. ParBlockchain: Leveraging Transaction Parallelism in Permissioned Blockchain Systems. In ICDCS. IEEE, Note that the newly added executor takes effect in the next block 1337–1347. height. As a result, the attendees will wait a moment to see the [3] E. Androulaki, A. Barger, et al. 2018. Hyperledger fabric: a distributed operating improvement in Figure 7 after adding an executor. system for permissioned . In EuroSys. ACM, 30:1–30:15. [4] J. M. Faleiro, D. Abadi, and J. M. Hellerstein. 2017. High Performance Transactions via Early Write Visibility. Proc. VLDB Endow. 10, 5 (2017), 613–624. [5] C. Gorenflo, S. Lee, L. Golab, and S. Keshav. 2019. FastFabric: Scaling Hyperledger 3.3 Scenario 2: Investigate Inter-Block Fabric to 20, 000 . In IEEE ICBC. IEEE, 455–463. [6] S. Gupta, J. Hellings, and M. Sadoghi. 2021. RCC: Resilient Concurrent Consensus Concurrency for High-Throughput Secure Transaction Processing. In ICDE. IEEE, 1392–1403. This scenario gives the attendees explorations of inter-block concur- [7] C. Jin, S. Pang, X. Qi, Z. Zhang, and A. Zhou. 2021. A High Performance Concur- rency Protocol for Smart Contracts of Permissioned Blockchain. TKDE (2021), 1–1. rency in SChain and sheds light on its distinguished pipeline design. https://doi.org/10.1109/TKDE.2021.3059959 The graphical interface allows the attendees to select the number [8] S. Nathan, C. G., A. Saraf, M. Sethi, and P. Jayachandran. 2019. Blockchain Meets of pipes to display. They will view the simultaneous process across : Design and Implementation of a Blockchain . Proc. VLDB Endow. 12, 11 (2019), 1539–1552. multiple blocks after selection. For example, in Figure 8, the latest [9] A. Thomson, T. Diamond, S.-C. Weng, K. Ren, P. Shao, and D. J. Abadi. 2012. three pipes are selected to display, involving 푏푙표푐푘31, 푏푙표푐푘32 and Calvin: fast distributed transactions for partitioned database systems. In SIGMOD Conference. ACM, 1–12. 푏푙표푐푘33. Stages denoted by circles horizontally form each block’s

2802