Overview
Avail provides comprehensive benchmarking capabilities for measuring pallet performance and Kate RPC operations. Benchmarks help determine runtime weights and identify performance bottlenecks.Pallet Benchmarking
Prerequisites
Build the node with runtime benchmarking features enabled:Running Pallet Benchmarks
Benchmark Script Configuration
Therun_benchmarks.sh script supports environment variables for customization:
| Variable | Default | Description |
|---|---|---|
STEPS | 50 | Number of steps for weight calculation |
REPEAT | 20 | Number of times to repeat each benchmark |
TEMPLATE_PATH | ./.maintain/frame-weight-template.hbs | Weight template file |
OUTPUT_PATH | ./output | Output directory for benchmark results |
PALLETS | * | Specific pallets to benchmark (or * for all) |
OUR_PALLETS | - | Set to benchmark only custom Avail pallets |
Excluded Pallets
The following pallets are excluded from automatic benchmarking:pallet_election_provider_support_benchmarking(helper pallet)pallet_babe(no automatic benchmarking)pallet_grandpa(no automatic benchmarking)pallet_mmr(no automatic benchmarking)pallet_offences(no automatic benchmarking)
Header Kate Commitment Benchmarks
Avail includes specialized benchmarks for the Kate commitment header builder:Time Measurement Benchmarks
Criterion benchmarks
Criterion benchmarks
Divan benchmarks
Divan benchmarks
Low-Level Performance Benchmarks
IAI Callgrind benchmarks
IAI Callgrind benchmarks
IAI benchmarks
IAI benchmarks
Kate RPC Benchmarks
Running Kate RPC Benchmarks
These benchmarks require a running development node and Deno runtime.
Available Kate RPC Metrics
When Kate RPC metrics are enabled (--enable-kate-rpc-metrics), the following metrics are exposed:
avail_kate_rpc_query_rows_execution_time- Query rows execution time (μs)avail_kate_rpc_query_proof_execution_time- Query proof execution time (μs)avail_kate_rpc_query_block_length_execution_time- Query block length execution time (μs)avail_kate_rpc_query_data_proof_execution_time- Query data proof execution time (μs)
Benchmark Subcommands
Theavail-node benchmark command supports multiple subcommands:
Common Options
| Option | Description |
|---|---|
--chain=<CHAIN> | Chain specification (dev, turing, mainnet) |
--steps=<N> | Number of benchmark steps |
--repeat=<N> | Number of repetitions |
--pallet=<NAME> | Pallet to benchmark |
--extrinsic=<NAME> | Specific extrinsic or * for all |
--heap-pages=<N> | Heap pages for runtime execution |
--output=<PATH> | Output file path |
--template=<PATH> | Weight template file |
--header=<PATH> | License header file |
Troubleshooting
Common Issues
Build failures:Best Practices
- Consistent environment - Run benchmarks on the same hardware for comparable results
- Minimal load - Close other applications to avoid interference
- Multiple runs - Use
--repeat=20or higher for statistical significance - Sufficient steps - Use
--steps=50minimum for accurate weight curves - Documentation - Record hardware specs and benchmark parameters for reproducibility