1703.04057v1
1703.04057v1
Blockchains
Tien Tuan Anh Dinh‡ Ji Wang‡ Gang Chen§ Rui Liu‡ Beng Chin Ooi‡ Kian-Lee Tan‡
‡ §
National University of Singapore Zhejiang University
‡
{dinhtta, wangji, liur, ooibc, tankl}@comp.nus.edu.sg §
[email protected]
arXiv:1703.04057v1 [cs.DB] 12 Mar 2017
Figure 1: Blockchain software stack on a fully validating Figure 2: An example of smart contract, written in Solidity
node. A non-validating node stores only the block head- language, for a pyramid scheme on Ethereum.
ers. Different blockchain platforms offer different interface
between the blockchain and application layer. YCSB,
Blockchain Contracts Application Smallbank, BLOCKBENCH
layers etc. workloads
transaction throughput remains very low (7 transactions per Compilers, VM, CPU-Heavy
Dockers, etc. Execution Engine
second [15]).
Ethereum. Due to simple transaction semantics, Bitcoin Blocks Analytics,
nodes execute a very simple state machine pre-built into the Transactions, Data Model IO-Heavy
Indexing, etc.
protocol. Ethereum [2] extends Bitcoin to support user-
defined and Turing complete state machines. In particular,
PoW, PoS,
Ethereum blockchain lets the user define any complex com- PBFT, etc.
Consensus Commits
second
38
#tx/s
3
second
10
#tx/s
second
#tx/s
40000 Parity
600 Hyperledger 80
600
#requests
#requests
60
30000 400
40
400
20000 200 20
08 12 16 20 24 28 32 0 8 12 16 20 24 28 32
200 10000 #nodes #nodes
00 50 100 150 200 250 300 00 50 100 150 200 250 300 Figure 8: Performance scalability (with 8 clients).
time (second) time (second)
Figure 6: Client’s request queue, for request rates of 8 tx/s scale beyond 16 servers is due to the implementation of the
and 512 tx/s. protocol. In fact, in the latest codebase (which was updated
after we have finished our benchmark), the PBFT compo-
nent was replaced by another implementation. We plan to
evaluate this new version in the future work.
The results so far indicate that scaling both the number of
104 Throughput Latency clients and number of servers degrades the performance and
Ethereum Ethereum even causes Hyperledger to fail. We next examined the costs
Parity 103 Parity of increasing the number of servers alone while fixing the
Hyperledger Hyperledger number of clients. Figure 8 shows that the performance be-
103 102
comes worse as there are more servers, meaning that the sys-
tems incur some network overheads. Because Hyperledger
second
#tx/s
24.04 13,090
second
800 101 10.52 107
MB
600 3.01 1.94 4,150
400 2,078
100 1,353
0.33 106
200 0.19 718
473
-1
00 10 376
50 100 150 200 250 300 350 400
time (second) x x
10-2 1M 10M 100M 105 1M 10M 100M
input size input size
Figure 9: Failing 4 nodes at 250th second (fixed 8 clients)
for 12 and 16 servers. X-12 and X-16 mean running 12 and
Figure 11: CPUHeavy workload, ‘X’ indicates Out-of-
16 servers using blockchain X respectively.
Memory error.
second
103 5,459 5,045 4,865
MB
377 359 337 2019 2,337 2,086 2,477
1631
1282 1,283
103 103 675
102 69 360
512
0.8M 1.6M 3.2M
x
6.4M
x
12.8M 0.8M 1.6M 3.2M
x
6.4M 12.8M
x 0.8M 1.6M 3.2M 6.4M
x x
12.8M
# tuples # tuples # tuples
second
#tx/s
0.168
0.1290.135 -1 0.107 0.091
10 -1 10 0.076 102
0.0320.034
0.038 0.033 0.031 45 45 46
0.025 0.024 0.023
0.0200.0200.019 0.019 0.020
-2 -2
10 1 10 100 1,000 10,000 10 1 10 100 1,000 10,000
# blocks scanned # blocks scanned 101 Ethereum Parity Hyperledger
(a) Analytics workload (Q1) (b) Analytics workload (Q2) (c) DoNothing workload
putation cost and can make transaction processing faster. There are many standard frameworks for benchmarking
The main challenge with sharding is to ensure consistency database systems. OLTP-Bench [18] contains standard work-
among multiple shards. However, existing consistency pro- loads such as TPC-C for transactional systems. YCSB [13]
tocols used in database systems do not work under Byzan- contains key-value workloads. HiBench [32] and BigBench [28]
tine failure. Nevertheless, their designs can offer insights feature big-data analytics workloads for MapReduce-like sys-
into realizing a more scalable sharding protocol for block- tems. Blockbench shares the same high-level design as
chain. Recent work [37] has demonstrated the feasibility these frameworks, but its workloads and main driver are
of sharding the consensus protocol, making important steps designed specifically for blockchain systems.
towards partitioning the entire blockchain.
Support declarative language. Having a set of high-level 7. CONCLUSION
operations that can be composed in a declarative manner
In this paper we proposed the first benchmarking frame-
makes it easy to define complex smart contracts. It also
work, called Blockbench, for evaluating private blockchain
opens up opportunities for low-level optimizations that speed
systems. Blockbench contains workloads for measuring
up contract execution.
the data processing performance, and workloads for under-
standing the performance at different layers of the block-
6. RELATED WORK chain. Using Blockbench, we conducted comprehensive
Performance studies of blockchain systems have so far analysis of three major blockchain systems, namely Eth-
been restricted to public blockchains. For example, [17, 15] ereum, Parity and Hyperledger with two macro benchmarks
analyze the effect of block sizes and network propagation and four micro benchmarks. The results showed that current
time on the overall throughputs. Recent proposals for im- blockchains are not well suited for large scale data process-
proving Bitcoin performance [27, 34, 37, 25, 43] have mainly ing workloads. We demonstrated several bottlenecks and
focused on the consensus layer, in which analytical models design trade-offs at different layers of the software stack.
or network simulations are used to validate the new designs.
Various aspects of Ethereum, such as their block process-
ing time (for syncing with other nodes) and transactions
processing time, have also been benchmarked [24, 23]. Our
analysis using Blockbench differs from these works in that
it is the first to evaluate private blockchains systems at scale
against database workloads. Furthermore, it compares two
different systems and analyzes how their designs affect the
overall performances. Future extensions of Blockbench
would enable more comparative evaluations of the key com-
ponents in blockchain.
Acknowledgment M. Zhang. UStore: a distributed storage with rich
We would like to thank the anonymous reviewers for their semantics. https://arxiv.org/pdf/1702.02799.pdf.
comments and suggestions that help us improve the paper. [20] J. Douceur. The sybil attack. In IPTPS, 2002.
Special thanks to Hao Zhang, Loi Luu, the developers from [21] A. Dragojevic, D. Narayanan, E. B. Nightingale,
Ethereum, Parity and Hyperledger projects for helping us M. Renzelmann, A. Shamis, A. Badam, and
with the experiment setup. This work is funded by the Na- M. Castro. No compromises: distributed transactions
tional Research Foundation, Prime Minister’s Office, Sin- with consistency, availability and performance. In
gapore, under its Competitive Research Programme (CRP SOSP, 2015.
Award No. NRF-CRP8-2011-08). [22] Ethcore. Parity: next generation ethereum browser.
https://ethcore.io/parity.html.
8. REFERENCES [23] Ethcore. Performance analysis.
[1] BlockBench: private blockchains benchmarking. https://blog.ethcore.io/performance-analysis/.
https://github.com/ooibc88/blockbench. [24] Ethereum. Ethereum benchmarks.
[2] Ethereum blockchain app platform. https://github.com/ethereum/wiki/wiki/Benchmarks.
https://www.ethereum.org/. [25] I. Eyal, A. E. Gencer, E. G. Sirer, and R. van Renesse.
[3] Ibm watson iot. Bitcoin-ng: A scalable blockchain protocol. In NSDI,
http://www.ibm.com/internet-of-things. 2016.
[4] Leveldb. https://leveldb.org. [26] I. Eyal and E. G. Sirer. Majority is not enough:
[5] Monax: The ecosystem application platform. Bitcoin mining is vulnerable. In Fiancial
https://monax.io. Cryptography, 2014.
[6] Rocksdb. https://rocksdb.org. [27] A. Gervais, G. O. Karame, K. Wust, V. Glykantizis,
[7] M. Apostolaki, A. Zohar, and L. Vanbever. Hijacking H. Ritzdorf, and S. Capkun. On the security and
bitcoin: Large-scale network attacks on performance of proof of work blockchains.
crypto-currencies. https://arxiv.org/abs/1605.07524, https://eprint.iacr.org/2016/555.pdf.
2016. [28] A. Ghazal, T. Rabl, M. Hu, F. Raab, M. Poess,
[8] P. Bailis, A. Fekete, M. J. Franklin, A. Ghodsi, J. M. A. Crolotte, and H.-A. Jacobsen. Bigbench: towards
Hellerstein, and I. Stoica. Coordination avoidance in an industry standard benchmark for big data
database systems. In VLDB. analytics. In SIGMOD, 2013.
[9] J. Bonneau, A. Miller, J. Clark, A. Narayanan, J. A. [29] G. S. Group. Blockchain: putting theory into practice,
Kroll, and E. W. Felten. Sok: Research perspectives 2016.
and challenges for bitcoin and crypto-currencies. In [30] E. Heilman, A. Kendler, A. Zohar, and S. Goldberg.
2015 IEEE Symposium on Security and Privacy, pages Eclipse attacks on Bitcoin’s peer-to-peer network. In
104–121. IEEE, 2015. USENIX Security, 2015.
[10] M. Cahill, U. Rohm, and A. D. Fekete. Serializable [31] Hyperledger. Blockchain technologies for business.
isolation for snapshot databases. In SIGMOD, 2008. https://www.hyperledger.org.
[11] M. Castro and B. Liskov. Practical byzantine fault [32] Intel. Hibench suite.
tolerance. In Proceedings of the third symposium on https://github.com/intel-hadoop/HiBench.
Operating systems design and implementation, pages [33] F. P. Junqueira, B. C. Reed, and M. Serafini. Zab:
173–186. USENIX Association, 1999. high-performance broadcast for primary-backup
[12] B.-G. Chun, P. Maniatis, S. Shenker, and systems. In Dependable Systems and Networks, 2011.
J. Kubiatowicz. Attested append-only memory: [34] E. Kokoris-Kogias, P. Jovanovic, N. Gailly, I. Khoffi,
Making adversaries stick to their word. In SOSP, 2007. L. Gasser, and B. Ford. Enhancing bitcoin security
[13] B. F. Cooper, A. Silberstein, E. Tam, and performance with strong consistency via collective
R. Ramakrishnan, and R. Sears. Benchmarking cloud signing. In USENIX Security, 2016.
serving systems with ycsb. In SoCC, 2010. [35] L. Lamport. Paxos made simple. SIGACT News, 2001.
[14] J. C. Corbett and J. D. et al. Spanner: Google’s [36] Q. Lin, P. Chang, G. Chen, B. C. Ooi, K.-L. Tan, and
globally-distributed database. In OSDI, 2012. Z. Wang. Towards a non-2pc transaction management
[15] K. Croman, C. Decker, I. Eyal, A. E. Gencer, A. Juels, in distrubted database systems. In SIGMOD, 2016.
A. Kosba, A. Miller, P. Saxena, E. Shi, and E. Gün. [37] L. Luu, V. Narayanan, C. Zhang, K. Baweija,
On scaling decentralized blockchains. In Proc. 3rd S. Gilbert, and P. Saxena. A secure sharding protocol
Workshop on Bitcoin and Blockchain Research, 2016. for open blockchains. In CCS, 2016.
[16] Crypti. A decentralized application platform. [38] L. Luu, J. Teutsch, R. Kulkarni, and P. Saxena.
https://crypti.me. Demystifying Incentives in the Consensus Computer.
[17] C. Decker and R. Wattenhofer. Information CCS ’15, pages 706–719, 2015.
propagation in bitcoin network. In P2P, 2013. [39] Melonport. Blockchain software for asset management.
[18] D. E. Difallah, A. Pavlo, C. Curino, and http://melonport.com.
P. Cudre-Mauroux. Oltp-bench: An extensible testbed [40] J. Morgan and O. Wyman. Unlocking economic
for benchmarking relational databases. In VLDB, advantage with blockchain. a guide for asset
2013. managers., 2016.
[19] A. Dinh, J. Wang, S. Wang, W.-N. Chin, Q. Lin, [41] S. Nakamoto. Bitcoin: A peer-to-peer electronic cash
B. C. Ooi, P. Ruan, K.-L. Tan, Z. Xie, H. Zhang, and system, 2008.
Throughput vs. HStore used in Ethereum, Dfinity and Parity, while Eris-DB only
Ethereum 142702 supports Solidity. Hyperledger, Stellar, Corda and Sawtooth
105 Parity Lake exploit various mature programming languages, such
Hyperledger 21596 as Python, Java, Golang, etc. ScalableBFT and Tezos even
104 H-Store develop their own smart contract languages. Most block-
chain platforms’ data models are account-based. Two ex-
#tx/s
1273 1122
103 ceptions in the table are Ripple and Corda. Their data
284 255 models are similar to Bitcoin’s unspent transaction outputs
102 45 46
(UTXO) which represents the coins in the network.
Each platform offers different consensus protocols. Hy-
perledger implements PBFT in the version we evaluated,
101 YCSB Smallbank while Ethereum implements a variation of PoW (Proof-of-
Work). Eris-DB builds on top of Tendermint protocol but
Figure 14: Performance of the three blockchain systems ver- only works in the latest version (v 0.12). Ripple and Tezos
sus H-Store. deploy Proof-of-Stake (PoS) schemes (the one in Ripple is
referred to Ripple Consensus Ledger) where the next block
is created based on accounts’ wealth, i.e., the stake. Parity
[42] D. Ongaro and J. Ousterhout. In search of an takes another consensus protocol, Proof-of-Authority (PoA),
understandable consensus algorithm. In USENIX which holds a predefined set of ”authorities” to create new
ATC, 2014. blocks in a fixed time slot and secure the blockchain network.
[43] R. Pass and E. Shi. Hybrid consensus: efficient Sawtooth Lake uses Proof-of-Elapsed-Time (PoET) as its
consensus in the permissionless model. consensus protocol, which in nature is a lottery algorithm
https://eprint.iacr.org/2016/917.pdf. and decides the creator of block arbitrarily. Stellar develops
[44] Ripple. Ripple. https://ripple.com. its own mechanism, Stellar Consensus Protocol, which is a
[45] Y. Sompolinsky and A. Zohar. Accelerating bitcoin’s construction for decentralized Byzantine agreement. There
transaction processing: fast money grows on trees, not is no source code that helps determine which consensus pro-
chains. Cryptology ePrint Archive, Report 2013/881, tocol Dfinity uses, but its documents suggest that a Block-
2013. https://eprint.iacr.org/2013/881.pdf. chain Nervous System will govern the whole platform via a
voting mechanism based on neurons that interact with each
[46] M. Stonebraker, S. Madden, D. J. Abadi,
other and are controlled by users.
S. Harizopoulos, N. Hachem, and P. Helland. The end
of and architectural era (it’s time for a complete
rewrite). In VLDB, 2007.
[47] K.-L. Tan, Q. Cai, B. C. Ooi, W.-F. Wong, C. Yao, B. MACRO BENCHMARKS
and H. Zhang. In-memory databases: Challenges and We compared the performance of the three blockchain sys-
opportunities from software and hardware tems against a popular in-memory database system, namely
perspectives. SIGMOD Records, 44(2), 2015. H-Store, using the YCSB and Smallbank workload. We ran
[48] A. Thomson, T. Diamond, S. chun Weng, K. Ren, H-Store’s own benchmark driver and set the transaction rate
P. Shao, and D. J. Abadi. Calvin: fast distributed at 100,000 tx/s. Figure 14 shows at least an order of mag-
transaction for partitioned database systems. In nitude gap in throughput and two order of magnitude in la-
SIGMOD, 2012. tency. Specifically, H-Store achieves over 140K tx/s through-
[49] M. Vukolic. The quest for scalable blockchain fabric: put while maintaining sub-millisecond latency. The gap in
proof-of-work vs. bft replication. In Open Problems in performance is due to the cost of consensus protocols. For
Network Security - iNetSec, 2015. YCSB, for example, H-Store requires almost no coordination
[50] H. Zhang, G. Chen, B. C. Ooi, K.-L. Tan, and among peers, whereas Ethereum and Hyperledger suffer the
M. Zhang. In-memory big data management and overhead of PoW and PBFT.
processing: a survey. TKDE, 2015. An interesting observation is the overhead of Smallbank.
Recall that Smallbank is a more complex transactional work-
APPENDIX load than YCSB, in which multiple keys are updated in a
single transaction. Smallbank is simple but is representative
of the large class of transactional workloads such as TPC-C.
A. SURVEY OF BLOCKCHAIN PLATFORMS We observe that in H-Store, Smallbank achieves 6.6x lower
We compare eleven promising blockchain platforms in Ta- throughput and 4x higher latency than YCSB, which indi-
ble 2. We can see that all but Ripple support smart con- cates the cost of distributed transaction management proto-
tracts. Ethereum, Eris-DB, Dfinity and Parity execute the col, because H-Store is a sharded database. In contrast, the
contracts using Ehtereum Virtual Machine (EVM), whereas blockchain suffers modest degradation in performance: 10%
Corda runs them in Java Virtual Machine (JVM). Hyper- in throughput and 20% in latency. This is because each node
ledger, Stellar and Tezos employ Docker images, ScalableBFT in blockchain maintains the entire state (replicated state ma-
takes Haskell execution environment, and Sawtooth Lake chine), thus there is no overhead in coordinating distributed
launches contracts on top of Trusted Execution Environment transactions as the data is not partitioned.
(TEE) such as Intel Software Guard Extensions (SGX). These The results demonstrate that blockchain performs poorly
platforms also support different languages to develop smart at data processing tasks currently handled by database sys-
contracts. For example, Solidity, Serpent and LLL are mainly tems. However, we stress that blockchains and databases
Table 2: Comparison of blockchain platforms
Smart
Smart contract
Application contract Data model Consensus
language
execution
Hyperledger Smart contract Dockers Golang, Java Account-based PBFT
Smart contract,
Ethereum Crypto- EVM Solidity, Serpent, LLL Account-based Ethash (PoW)
currency
Eris-DB Smart contract EVM Solidity Account-based Tendermint (BFT)
Crypto- Ripple Consensus
Ripple - - UTXO-based
currency Ledger (PoS)
Haskell
ScalableBFT Smart contract Pact Account-based ScalableBFT
Execution
JavaScript, Golang, Stellar Consensus
Stellar Smart contract Dockers Account-based
Java, Ruby, Python, C# Protocol
Blockchain
Dfinity Smart contract EVM Solidity, Serpent, LLL Account-based
Nervous System
Parity Smart contract EVM Solidity, Serpent, LLL Account-based Proof of Authority
Smart contract,
Tezos Contract Script
Tezos Crypto- Dockers Account-based Proof of Stake
Language
currency
Corda Smart contract JVM Kotlin, Java UTXO-based Raft
Sawtooth Proof of Elapsed
Smart contract TEE Python Account-based
Lake Time
90 CPU utilization only crash failures. Other features which are optional in
80
70 most database systems are cryptographic signatures on ev-
60 Ethereum
50 Parity ery single transaction, and wide-area fully replicated state
40
%
Hyperledger
40 accommodate a large number of users.
20
00 Figure 15 shows the effect of varying block sizes in the
20 40 60 80 100
time (second) overall throughput. While it is straightforward to set the
block size in Hyperledger by configuring the batchSize vari-
Figure 16: Resource utilization. able, there is no direct way to specify the same in Ethereum.
An Ethereum miner uses gasLimit value to restrict the over-
all cost in constructing a block, thus we tuned this value to
Block generation rate simulate different sizes. In Parity, gasLimit is not applica-
101 ble to local transaction and it has no effect on the block size.
Small 5.20 Instead, we observe that the block size can be controlled by
Medium 3.10 tuning stepDuration value, which essentially decides how
Large 1.75 much time a validator can use to build a block. In the exper-
#block/s
100 1.00 iments, medium size refers to the default settings, whereas
large and small refer to 2x and 0.5x of the default size. The
0.56
results show that increases in block sizes lead to proportional
0.34 0.28 decreases in block generation rate, meaning that the overall
0.22 throughput does not improve.
0.12 Figure 16 compares CPU and network utilization of the
10-1 Ethereum Parity Hyperledger three systems over the period of 100 seconds. It is easy to
see that Ethereum is CPU bound, as it fully utilizes 8 CPU
cores. Hyperledger, on the other hand, uses CPU sparingly
Figure 15: Block generation rate.
and spends the rest of the time on network communication.
Parity, in contrast, has lower resource footprints than other
are designed with different goals and assumptions. Specif- two systems. For Ethereum and Hyperledger, the pattern
ically, the protocols for Byzantine failure tolerance are an is the direct consequence of the consensus protocol: PoW is
overkill for traditional database settings where there are CPU bound whereas PBFT is communication bound.
104 Throughput Latency 80000 Queue length
Ethereum
Parity 103
Ethereum
Parity 70000 Ethereum
Hyperledger Hyperledger 60000 Parity
103 50000 Hyperledger
#requests
102
40000
second
#tx/s
101 30000
102 20000
100 10000
00 50 100 150 200 250 300 350
101 12 4 8 12 16 20 24 28 32 10-1 12 4 8 12 16 20 24 28 32 time (second)
#nodes #nodes
Figure 19: Scalability with Smallbank benchmark. Figure 18: Queue length at the client.
0.8
0.6
cdf
0.4 Ethereum-YCSB
Ethereum-SB
Parity-YCSB
0.2 Parity-SB
Hyperledger-YCSB
Hyperledger-SB
0.0
100 101 102 103
time (second)