Hyperledger Caliper-Benchmark
Hyperledger Caliper is a blockchain benchmark tool, it allows users to measure the performance of a blockchain implementation with a set of predefined use cases. Hyperledger Caliper will produce reports containing a number of performance indicators to serve as a reference when using the following blockchain solutions: Hyperledger Besu, Hyperledger Burrow, Ethereum, Hyperledger Fabric, FISCO BCOS, Hyperledger Iroha and Hyperledger Sawtooth.
Caliper is published as the @hyperledger/caliper-cli NPM package and the hyperledger/caliper Docker image, both containing the CLI binary.
Setting up Caliper-benchmark has three steps:
- Clone the repository
- Install Caliper Cli
- Bind the Cli to SDK
- Invoke the local Cli
- Run Report.html
Pre-Requisites:
- Clone the caliper benchmark source code from Benchmark repository:
Now go to the folder
cd caliper-benchmark
Unless you are embedding the Caliper packages in your own application, you will probably use Caliper through its command line interface (CLI).
user@ubuntu:~/caliper-benchmarks$ npm i @hyperledger/caliper-cli
The entry point of the CLI is the caliper
binary. You can confirm whether the CLI is installed correctly by checking its version:
user@ubuntu:~/caliper-benchmarks$ npx caliper --version
v0.2.0
Now check if you have package.json file. If not, run below command
user@ubuntu:~/caliper-benchmarks$ npm init -y
2. Install Caliper CLI:
user@ubuntu:~/caliper-benchmarks$ npm install --only=prod @hyperledger/caliper-cli
3. Bind the CLI to the SDK:
user@ubuntu:~/caliper-benchmarks$ npx caliper bind --caliper-bind-sut fabric --caliper-bind-sdk 1.4.0
4. Invoke the local CLI:
user@ubuntu:~/caliper-benchmarks$ npx caliper benchmark run --caliper-workspace . --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig networks/fabric/fabric-v1.4.1/2org1peergoleveldb/fabric-go.yaml
Once you run the above command, Invoking starts:
Here chaincodes are installed on the channel and instantiated. After successful instantiation, The test results are visible as
At the end you will see that the Benchmark run successful.
Once the benchmark runs successfully, You can find a file report.html
5. Open the file(report.html) in browser to see the report
Hope the post is helpful . In case if you are facing any difficulty, let me know in the comment section, I will try my best to solve it.
Happy learning :)