Name: caliper
Owner: Hyperledger
Description: A blockchain benchmark framework to measure performance of multiple blockchain solutions
Created: 2018-03-20 01:46:34.0
Updated: 2018-05-24 02:08:25.0
Pushed: 2018-05-24 02:08:22.0
Size: 9616
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Caliper is a blockchain performance benchmark framework, which allows users to test different blockchain solutions with predefined use cases, and get a set of performance test results.
Currently supported blockchain solutions:
Hyperledger Composer is also supported, please see Composer Performance Test.
Currently supported performance indicators:
See [to add the link to PSWG] to find out the definitions and corresponding measurement methods.
See Architecture introduction.
Make sure following tools are installed
Run npm install
in caliper folder to install dependencies locally
Fabric
Install using the repository
npm install fabric-ca-client fabric-client
in the root foldernpm install fabric-ca-client@1.1.0 fabric-client@1.1.0
Sawtooth
Install dependencies
install protocol-buffers
Install sawtooth javascript sdk using repository
npm install sawtooth-sdk
in the root folderIroha
Install dependencies
o apt-get install libv8-dev
tall google-protobuf grpc
A precompiled Iroha library is provided in src/iroha/external
, which is compiled with Ubuntu 14 x86_64. The library should be replaced if it is incompatible with the under platform.
Composer
Install dependencies
The easiest way to get started using a target version of Composer is to update the main package.json file to include the required Composer and Fabric modules, and subsequently run an npm install
command. It is important that the Composer and Fabric versions are compatible.
poser-admin": "0.19.0",
poser-client": "0.19.0",
poser-common": "0.19.0",
ric-ca-client": "1.1.0",
ric-client": "1.1.0",
Please see the plugin documentation for more details on using the Composer performance plugin, and developing your own tests.
All predefined benchmarks can be found in benchmark folder. To start your first benchmark, just run this in root folder
benchmark/simple/main.js -c yourconfig.json -n yournetwork.json
Some example SUTs are provided in network folder, they can be launched automatically before the test by setting the bootstrap commands in the configuration file, e.g
ommand" : {
"start": "docker-compose -f network/fabric/simplenetwork/docker-compose.yaml up -d",
"end" : "docker-compose -f network/fabric/simplenetwork/docker-compose.yaml down;docker rm $(docker ps -aq)"
The scripts defined in command.start will be called before the test, and the scripts defined in command.end will be called after the finish of all tests. You can use them to define any preparation or clean-up works.
You can also run the test with your own blockchain network, a network configuration should be provided and corresponding file path should be specified in configuration file's blockchain.config.
Note:
Alternative
You can also use npm scripts to run a benchmark.
m run list
caliper@0.1.0 list /home/hurf/caliper node ./scripts/list.js
Available benchmarks: drm simple
m test: run a benchmark with specific config files
$ npm test – simple -c ./benchmark/simple/config.json -n ./benchmark/simple/fabric.json
caliper@0.1.0 test /home/hurf/caliper node ./scripts/test.js “simple” “-c” “./benchmark/simple/config.json” “-n” “./benchmark/simple/fabric.json” ……
un benchmark with distributed clients (experimental)
In this way, multiple clients can be launched on distributed hosts to run the same benchmark.
Start the ZooKeeper service
Launch clients on target machines separately by running node ./src/comm/client/zoo-client.js zookeeper-server
or npm run startclient -- zookeeper-server
. Time synchronization between target machines should be executed before launching the clients.
Example:
m run startclient -- 10.229.42.159:2181
liper@0.1.0 startclient /home/hurf/caliper
de ./src/comm/client/zoo-client.js "10.229.42.159:2181"
ected to ZooKeeper
ted client node:/caliper/clients/client_1514532063571_0000000006
ted receiving queue at:/caliper/client_1514532063571_0000000006_in
ted sending queue at:/caliper/client_1514532063571_0000000006_out
ing for messages at:/caliper/client_1514532063571_0000000006_in......
Modify the client type setting in configuration file to 'zookeeper'.
Example:
ents": {
ype": "zookeeper",
oo" : {
"server": "10.229.42.159:2181",
"clientsPerHost": 5
Launch the benchmark on any machine as usual.
Note:
Caliper provides a set of nodejs NBIs (North Bound Interfaces) for applications to interact with backend blockchain system. Check the src/comm/blockchain.js to learn about the NBIs. Multiple Adaptors are implemented to translate the NBIs to different blockchain protocols. So developers can write a benchmark once, and run it with different blockchain systems.
Generally speaking, to write a new caliper benchmark, you need to:
Directory | Description —————— | ————– /benchmark | Samples of the blockchain benchmarks /docs | Documents /network | Boot configuration files used to deploy some predefined blockchain network under test. /src | Souce code of the framework /src/contract | Smart contracts for different blockchain systems
See Contributing
The Caliper codebase is release under the Apache 2.0 license. Any documentation developed by the Caliper Project is licensed under the Creative Commons Attribution 4.0 International License. You may obtain a copy of the license, titled CC-BY-4.0, at http://creativecommons.org/licenses/by/4.0/.