Home

Awesome

substrate-graph-benchmarks

Graph the benchmark output of Substrate Pallets.

How To

Manual

To access the benchmark feature of Substrate, you need to compile your node using the runtime-benchmarks feature flag.

  1. Clone Substrate: https://github.com/paritytech/substrate/
  2. Navigate to the cli folder (cd ./bin/node/cli/)
  3. Compile your node in release mode with the correct feature flag.
cargo build --release --features=runtime-benchmarks
  1. When this is done, navigate back to the substrate root folder (cd ../../..)
  2. Run your benchmark.

Make sure to run your benchmark with the following flags:

--chain dev --execution=wasm --wasm-execution=compiled

Here is an example of a full benchmark:

./target/release/substrate benchmark \
    --chain dev \
    --execution=wasm \
    --wasm-execution=compiled \
    --pallet balances \
    --extrinsic transfer \
    --steps 100 \
    --repeat 10 \
    > transfer_worst_case.txt

Ansible

The Ansible Playbook can connect to multiple machines, execute the benchmarks and collect the results locally by issuing one command. The only required configuration file is ansible/inventory.sample, where the machines are listed and the SSH user is specified.

[servers]
<ip-address>
<ip-address>

[all:vars]
ansible_user=<ssh-user>

The Playbook assumes all machines share the same SSH user. Alternatively, add ansible_user for each host:

[servers]
<ip-address> ansible_user=<ssh-user>
<ip-address> ansible_user=<ssh-user>

For straightforward usage, pubkey authentication is recommended, including adding the identities to the authentication agent with ssh-add -i ~/.ssh/<id_key>.

Execute the Playbook by specifying the inventory file:

ansible-playbook -i ansible/inventory.sample ansible/run-benchmarks.yml

The execution takes quite some while. The benchmark results will be saved separately by their corresponding host in ansible/results/ (directory will be created once the benchmarking finishes). Additionally, the results contain a DEVICE_INFO.md file for each host consisting of information about the device.

The Ansible Playbook can be executed multiple times on the same hosts without issues.

Troubleshooting

CLI Flags

Output will mostly be in CSV format (with two lines of metadata at the top). You can output this to a txt file for ingestion.