Hyperledger Caliper手册

caliper launch - 启动主进程/工作进程

Caliper运行基准测试时,使用工作进程来生成工作负载,使用主进程 协调工作进程间的不同的基准测试轮次。相应的,caliper命令行工具 提供了启动主进程和工作进程的命令。

使用如下命令查看caliper launch的帮助信息:

user@hubwiz:~/caliper-benchmarks$ npx caliper launch --help
caliper launch <subcommand>

Launch a Caliper process either in a master or worker role.

Commands:
  caliper launch master [options]  Launch a Caliper master process to coordinate the benchmark run
  caliper launch worker [options]  Launch a Caliper worker process to generate the benchmark workload

Options:
  --help, -h  Show usage information  [boolean]
  --version   Show version information  [boolean]

caliper launch master - 启动主进程

Caliper主进程时分布式基准测试运行的入口点。它负责协调整个运行期间的工作进程。

使用如下命令查看caliper launch master命令的帮助信息:

user@hubwiz:~/caliper-benchmarks$ npx caliper launch master --help
Usage:
 caliper launch master --caliper-bind-sut fabric:1.4.1 [other options]

Options:
  --help, -h           Show usage information  [boolean]
  --version            Show version information  [boolean]
  --caliper-bind-sut   The name and version of the platform to bind to  [string]
  --caliper-bind-cwd   The working directory for performing the SDK install  [string]
  --caliper-bind-args  Additional arguments to pass to "npm install". Use the "=" notation when setting this parameter  [string]
  --caliper-bind-file  Yaml file to override default (supported) package versions when binding an SDK  [string]

就像你看到的,caliper launch master命令也可以处理caliper bind命令的参数,因此 如果你希望在一个步骤就完成目标平台绑定和基准测试运行,可以直接使用caliper launch master命令。

不过,该命令需要设置一些额外的参数:

  • caliper-workspace:caliper项目根目录。其他配置文件中的相对路径都基于该设置进行解析。 引入工作区这一概念的目的是让caliper项目可以在不同机器上自由迁移。
  • caliper-benchmarkconfig:测试轮次配置文件路径,应当是一个以工作区为基准的相对路径
  • caliper-networkconfig:所选待测试系统的网络配置与描述文件路i纪念馆,应当是以工作区为基准的相对路径

caliper launch worker - 启动工作进程

Caliper工作进程负责在基准测试运行期间生成工作负载。通常会有不止一个工作进程运行,由单一 主进程负责协调。

使用如下命令查看caliper launch worker命令的帮助信息:

user@hubwiz:~/caliper-benchmarks$ npx caliper launch worker --help
Usage:
 caliper launch master --caliper-bind-sut fabric:1.4.1 [other options]

Options:
  --help, -h           Show usage information  [boolean]
  --version            Show version information  [boolean]
  --caliper-bind-sut   The name and version of the platform to bind to  [string]
  --caliper-bind-cwd   The working directory for performing the SDK install  [string]
  --caliper-bind-args  Additional arguments to pass to "npm install". Use the "=" notation when setting this parameter  [string]
  --caliper-bind-file  Yaml file to override default (supported) package versions when binding an SDK  [string]

如上所示,可以用配置主进程相同的方式配置工作进程,其中包含可选的绑定步骤,也包含三个在前一部分 介绍的必须的参数。