I am interested in measuring/estimating the transaction throughput of my chain. How should I start?
-
Depends on how the topology of your chain looks like. Does it have parachains? Multiple nodes? We are working on a general way to benchmark various chain setups, but that could take another month or two.– Oliver Tale-YazdiMay 19, 2022 at 10:57
-
@OliverTale-Yazdi for now I am running 2 nodes and it's a solo chain so no parachains.– Purple_TurtleMay 19, 2022 at 13:12
1 Answer
You should start by benchmarking the extrinsics defined in your runtime. See here to learn how to do this.
The benchmarks will give you an execution weight in units of picoseconds, ie. 1_000_000_000_000
weight units ~ 1 second of execution time. Note the result of this depends on the hardware you run the benchmarks on - you should benchmark on a machine that matches your recommended validator hardware specs.
A typical extrinsic executed on typical hardware might weigh 200_000_000
units, equivalent to 200 microseconds. So in this case you could estimate a transaction throughput of 1_000_000 ms / 200 ms per tx ~ 5000 tx
.
There are other considerations, for example this rough estimation doesn't take into account the pallet hooks and other work that needs to be performed to process a block (see here). So the value calculated above should be considered an upper bound.
Also your runtime likely defines more than a single extrinsic, so you would also need to estimate the relative frequency of each extrinsic to get a more accurate picture.