Hyperledger caliperの使用

4452 ワード

Caliperは、使用者が事前定義された使用例によって異なるブロックチェーンソリューションをテストし、パフォーマンステスト結果のセットを得ることができるブロックチェーン性能評価フレームワークです.
現在サポートされているブロックチェーンソリューションは次のとおりです.
  • Hyperledger Burrow
  • Hyperledger Composer
  • Hyperledger Fabric
  • Hyperledger Iroha
  • Hyperledger Sawtooth

  • 現在サポートされているパフォーマンス指標は次のとおりです.
  • Success rate(成功率)
  • Transaction/Read throughput(トランザクションスループット)
  • Transaction/Read latency(minimum,maximum,average,percentile)(最大値、最小値、平均値、パーセントを含む取引遅延)
  • Resource consumption(CPU,Memory,Network IO,...)(CPU,メモリ,ネットワークIOなどを含むリソース消費)
  • 準備:
    次のツールが正しくインストールされていることを確認します.
  • NodeJS 8(LTS)、9,or 10(LTS)より高いバージョンはサポートされていません.依存チェーンは
  • をサポートしていないためです.
  • node-gyp
  • Docker
  • Docker-compose

  • コンパイルCaliper
    Caliperはpackagesに分割され、Lerna管理を使用し、LernaはJavaScriptの複数のpackagesエンジニアリングを管理するツールであり、Caliperをコンパイルするために、
    必要な依存ライブラリを先に引き出し、Caliperプロジェクトを起動します.基本コード(base code)を変更した場合は、プロジェクトを再コンパイルする必要があります.
  • Caliperルートディレクトリの下でnpm install,
  • を実行する.
  • Caliperルートディレクトリの下でnpm run repocleanを実行し、すべてのパッケージがきれいな
  • であることを確認します.
  • 実行npm run bootstrap Caliperウェアハウスにパッケージを案内します(Run npm run bootstrap to bootstrap the packages in the Caliper repository).これにより、すべてのパッケージ依存とリンクの交差依存がインストールされます.インストールが完了するには時間がかかります.ctrl+cキーを押して中断した場合は、package.jsonファイルを復元してからnpm run bootstrapを実行します.
  • bootstrapプロシージャが失敗する可能性があるため、sudoを連れて上記の3つのコマンドを実行しないでください.
    Benchmarkを実行
    BenchmarkはCaliper CLIを使用して実行できます.Caliperパッケージをnpmに公開するつもりです.
    Caliper CLIのインストール:
    まだnpmにCaliperを公開していませんが、Caliper CLI、スクリプト位置/packages/caliper-tests-integration/scripts/run-integration-tests.sh.このテストスクリプトでは、指定したアダプタを選択するために環境変数を設定する必要があります.これはout CIシステムの要件にすぎません.
    手順:
  • Caliperプロジェクトをコンパイルしていない場合は、上記の手順に従ってコンパイルしてください.
  • Caliper CLIを取得するには、Caliperルートディレクトリの下で次のコマンド
  • を実行します.
    export BENCHMARK=fabric-ccp
    ./packages/caliper-tests-integration/scripts/run-integration-tests.sh

    The above will start an npm proxy server (Verdaccio), publish the Caliper modules to the server, globally install the packages, and finally run a traget benchmark. The result of the benchmark is not important at this time; if the benchmark commences, then you have the Caliper packages installed globally on the machine that issued the command. 
    現在、Caliperでは次のアダプタがサポートされています.
  • Burrow: @monax/[email protected]
  • Composer: [email protected]
  • Fabric: [email protected]
  • Iroha: [email protected]
  • Sawtooth: [email protected]

  • Compatibility List:
    DLT
    Client Compatibilty
    Fabric v1.0
    [email protected] [email protected] [email protected]
    Fabric v1.1
    [email protected] [email protected] [email protected]
    Fabric v1.2
    [email protected] [email protected] [email protected]
    Fabric v1.3
    [email protected] [email protected] [email protected]
    Fabric v1.4
    [email protected] [email protected] [email protected]
    Hyperledger Fabric v 1をテストしたいなら1,caliper-fabric-ccpアダプターを修正する、[email protected], [email protected], [email protected]を使用する必要がある.
    Note: When the Caliper packages are published to npm, we will be publishing versions for the above compatibility requirements and will update the compatibility table with published Caliper versions that you will be able to obtain using  npm install -g caliper-@ Benchmark :
    事前定義されたbenchmarksはすべてbenchmarkフォルダで見つけることができます.The Caliper CLI has the notion of a workspace, which contains your benchmark configuration and test files.
    Caliper CLIコマンドラインを使用してBenchmarkを実行
    caliper benchmark run -w  -c  -n 
  • -w : path to a workspace directory (required)
  • -c : relative path from the workspace to the benchmark configuration file (required).
  • -n : relative path from the workspace to the config file of the blockchain network under test (required).

  • 次のコマンドは、caliperルートディレクトリの下でテストケースを実行するとします.
    caliper benchmark run -w ./packages/caliper-samples -c benchmark/simple/config.yaml -n network/fabric-v1.4/2org1peercouchdb/fabric-ccp-node.yaml