区块链 使用xbench测试xuperchain 教程
Posted 软件工程小施同学
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了区块链 使用xbench测试xuperchain 教程相关的知识,希望对你有一定的参考价值。
一、安装xuperchain
下面2选1,本文选择多机多节点
1.单机单节点
https://xuper.baidu.com/n/xuperdoc/quickstart.html
2.多机多节点部署
https://shijianfeng.blog.csdn.net/article/details/117305713
二、xbench
1. 下载
# mkdir -p ~/xuper
cd ~/xuper
git clone https://github.com/xuperchain/xbench.git
cd ./xbench
make
2. 测试类型
Xbench 现在提供 10 种测试用例
- deal: Test postTx performance in transfer. Default prepare enough TXs and sign them.
- generate: Test account transfer performance.Default create enough accounts, transfer 1 from these accounts to one test account.
- relay: Test account transfer performance. Default create enough accounts, transfer 1 to themselves using the last txid, which do not need to selectUTXO.
- query: Test contract query performance. Default deploy
counter
and invokeincrease
method to increase key, query this key to test. - invoke: Test contract invoke performance. Default deploy
counter
,invokeincrease
method to test - querytx: Test tx query performace. Query the previous reftxid, query the first one if reach the end.
- queryblock: Test block query performance. Query the previous pre block, query the first one if reach the end.
- queryacct: Test account balance query performance. Default transfer n to an account,
- lcvtrans: Test transfer performnce using sdk. Should deploy endorser.
- lcvinvoke: Test contract invoke perfromace using sdk. Also should deploy endorser.
三、测试非contract invoke 或者 contract query
以local模式,deal测试用例为例
1. 修改配置文件
cd ~/xuper/xbench/output/conf
config meanings:
- gen.conf : profiling normal transfer process
- deal.conf : prepare transaction data before, profiling postTx process
- invoke.conf : profiling contract invoke process
下面以修改deal.json为例
vim deal.json
{
//tested block chain type(xchain/fabric)
"type": "xchain",
//concurrent num of transaction
"workNum": 10,
//working mode (local/remote)
"mode": "local",
//chain code name
"chain": "xuper",
//Encryption plugins(default/schnorr)
"crypto": "default",
//tested block chain ip:port
"host": "192.168.92.129:37101",
//test behaviors (deal/generate/invoke/query/...)
"rounds": [
{
//test cases
"label": "deal",
//requests of every worker
"number": [ 20 ]
}
]
}
2. 运行测试
cd ~/xuper/xbench/output
./bin/xbench -c ./conf/deal.conf
四、测试contract invoke 或者 contract query
https://github.com/xuperchain/xbench
参考文档
https://github.com/xuperchain/xbench
以上是关于区块链 使用xbench测试xuperchain 教程的主要内容,如果未能解决你的问题,请参考以下文章
区块链 xuperchain io.grpc.StatusRuntimeException: UNKNOWN: error execution reverted: execution reverted