0324Caliper测试fabric1.4的TPS与Delay

1. 基本信息

虚拟机名称:Pure-Ununtu18.04
Blockchain位置:/root/wecross-demo/fabric
证书文件位置:/root/wecross-demo/fabric/fabric-samples-1.4.4/first-network/crypto-config/*
Explorer位置:/root/wecross-demo/fabric/explorer
Caliper位置:/root/caliper-workspace

1.5 VScode 远程连接

  1. 虚拟机桌面右键 Open Terminal
  2. ifconfig,根据网卡ens33的地址,修改vscode的远程congfig文件, 账号/密码:toor / root
  3. 打开远程文件目录 vscode-file-open folder-/root
  4. 打开远程终端 VScode-Terminal

2. 启动区块链

切换超级用户 su root 密码:root
cd /root/wecross-demo/fabric
bash start.sh up (此操作会导致秘钥名称发生变化,应注意!!!)

3. 部署链码(若已部署则不需要)

cd /root/wecross-demo/fabric
bash deploy_sacc.sh

4. 启动区块链浏览器

  1. cd /root/wecross-demo/fabric/explorer
  2. 删除pgdata , crypto和 walletstore文件夹 rm -r pgdata, rm -r walletstore, rm -r crypto
  3. 创建空crypto文件夹 mkdir crypto
  4. cp -r /root/wecross-demo/fabric/fabric-samples-1.4.4/first-network/crypto-config/* crypto
  5. cd /root/wecross-demo/fabric/explorer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore
  6. 复制此目录下的文件名称xxx_sk,替换/root/wecross-demo/fabric/explorer/connection-profile/test-network.json的32行中的xxx_sk
  7. cd /root/wecross-demo/fabric/explorer
  8. 启动区块链浏览器 bash start.sh
  9. 虚拟机内访问http://localhost:8082/#/login 账号/密码:用户名:exploreradmin 密码:exploreradminpw

5. Caliper性能测试

  1. cd /root/caliper-workspace
  2. cd /root/wecross-demo/fabric/explorer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore
  3. 复制此目录下的文件名称xxx_sk,替换/root/caliper-workspace/networks/networkConfig.json的18行中的xxx_sk
  4. 在benchmarks目录下的benchmark.yaml,用于定义测试的发送交易总量、以及发送tps, 根据自己服务器配置进行调整。
    txNumber :发送交易总量,一般为20
    tps:交易发送速率,一般为10
  5. 根据实验需求,修改CT_load.js中的18行和20行,set方法为写入数据(修改20行中的key, value),get方法为读取数据(20行中只需要key)
  6. 运行caliper
    npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig networks/networkConfig.json --caliper-benchconfig benchmarks/benchmark.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled

若报错,则

  1. 清除npm缓存 npm cache clean --force

  2. 取消ssl验证: npm config set strict-ssl false

  3. 更换npm下载源
    npm config set registry https://registry.npm.taobao.org
    npm install -g cnpm --registry=https://registry.npm.taobao.org

  4. 在caliper-workspace路径下,执行以下命令下载依赖包
    npm install --only=prod @hyperledger/caliper-cli@0.4.0 --unsafe-perm=true --allow-root
    npx caliper bind --caliper-bind-sut fabric:2.1 --unsafe-perm=true --allow-root

6. 实验结束,关机走人。

poweroff

  • 8
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值