fabric2.4.3环境搭建见:
超详细的Hyperledger Fabric2.4.3环境搭建
1. 安装nvm
sudo su
cd ~
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
gedit .bashrc
将如下内容添加到文件末尾
source ~/.nvm/nvm.sh
保存退出
执行命令:
source .bashrc
查看nvm版本:
nvm --version #我的版本是0.33.11
2.安装node
执行命令:
nvm install v14.15.0
打开.bashrc文件
gedit .bashrc
在末尾加入:
export NVM_DIR="/Users/YOURUSERNAME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
然后执行
source .bashrc
node -v #看看是不是v 14.15.0
npm -v #v6.14.8
3安装Hyperledger Caliper
- 这一步要让自己处于fabric-sample的上层目录中,一定要在这个地方进行操作,不然跑benchmark时会找不到文件
cd ~/fabric #根据自己的情况,让自己来到fabric-sample的上一级目录中
执行:下载caliperj文件
git clone https://github.com/hyperledger/caliper-benchmarks
然后打开caliper-benchmarks文件夹
cd caliper-benchmarks
执行命令,安装最新版的hyperledger caliper
npm install --only=prod @hyperledger/caliper-cli
绑定我们的hyperledger fabric2.4.3注意要对应自己的fabric版本
npx caliper bind --caliper-bind-sut fabric:2.4
查看版本:
npx caliper --version #目前最新版是0.5.0
对fabric2.4.3进行测试
cd ../fabric-samples/test-network
开启网络创建通道:
./network.sh up createChannel -s couchdb
执行结果:
- 对官方的fabcar案例进行压力测试确保我们现在位于fabric-sample/test-network文件夹中执行命令这条,将fabcar chainnode上链
./network.sh deployCC -ccn fabcar -ccp ../../caliper-benchmarks/src/fabric/samples/fabcar/go -ccl go
命令行截图:
然后就可以开启测试了:
先到caliper-benchmarks目录下
cd ../../caliper-benchmarks/
开始测试:
npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig networks/fabric/test-network.yaml --caliper-benchconfig benchmarks/samples/fabric/fabcar/config.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled
要跑好一会儿。。。完成后会在caliper-benchmarks文件夹中生成一个report.html文件:
report.html文件截图:
Caliper report
Summary of performance metrics
NameSuccFailSend Rate (TPS)Max Latency (s)Min Latency (s)Avg Latency (s)Throughput (TPS)Create a car.5000012.12.270.110.5112.0Change car owner.503017.22.200.130.4016.0Query all cars.48850168.20.140.010.04168.1Query a car.61000210.31.060.000.03210.2
Benchmark round: Create a car.
rateControl:
type: fixed-load
opts:
transactionLoad: 5
Performance metrics for Create a car.
NameSuccFailSend Rate (TPS)Max Latency (s)Min Latency (s)Avg Latency (s)Throughput (TPS)Create a car.5000012.12.270.110.5112.0
Resource utilization for Create a car.
Benchmark round: Change car owner.
txDuration: 30
rateControl:
type: fixed-load
opts:
transactionLoad: 5
Performance metrics for Change car owner.
NameSuccFailSend Rate (TPS)Max Latency (s)Min Latency (s)Avg Latency (s)Throughput (TPS)Change car owner.503017.22.200.130.4016.0
Resource utilization for Change car owner.
Benchmark round: Query all cars.
txDuration: 30
rateControl:
type: fixed-load
opts:
transactionLoad: 5
Performance metrics for Query all cars.
NameSuccFailSend Rate (TPS)Max Latency (s)Min Latency (s)Avg Latency (s)Throughput (TPS)Query all cars.48850168.20.140.010.04168.1
Resource utilization for Query all cars.
Benchmark round: Query a car.
txDuration: 30
rateControl:
type: fixed-load
opts:
transactionLoad: 5
Performance metrics for Query a car.
NameSuccFailSend Rate (TPS)Max Latency (s)Min Latency (s)Avg Latency (s)Throughput (TPS)Query a car.61000210.31.060.000.03210.2
Resource utilization for Query a car.
Test Environment
benchmark config
workers:
type: local
number: 5
rounds:
- label: Create a car.
txNumber: 5000
rateControl:
type: fixed-load
opts:
transactionLoad: 5
workload:
module: benchmarks/samples/fabric/fabcar/createCar.js
- label: Change car owner.
txDuration: 30
rateControl:
type: fixed-load
opts:
transactionLoad: 5
workload:
module: benchmarks/samples/fabric/fabcar/changeCarOwner.js
arguments:
assets: 500
- label: Query all cars.
txDuration: 30
rateControl:
type: fixed-load
opts:
transactionLoad: 5
workload:
module: benchmarks/samples/fabric/fabcar/queryAllCars.js
arguments:
assets: 500
startKey: '1'
endKey: '50'
- label: Query a car.
txDuration: 30
rateControl:
type: fixed-load
opts:
transactionLoad: 5
workload:
module: benchmarks/samples/fabric/fabcar/queryCar.js
arguments:
assets: 500
SUT
not provided
版权归原作者 weixin_43774986 所有, 如有侵权,请联系我们删除。