-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add benchmark overhead
to frame-omni-bencher
#5303
Comments
Oh... adding it to the omni-bencher would be good long term, yes. We can probably re-use some mechanisms from the try-runtime-cli since that is also building blocks. |
For a start, the omni-bencher could support what the omni-node will support. That should be fine for most use cases. |
WDYM? IIUC the omni-node would just call into the shared omni-bencher code. This de-duplicates all of this logic and puts it into one place. |
My impression was that we will have no benchmarking related code in the omni node and people will use the omni bencher for benchmarking exclusively. This is also what is outlined here: #4966 |
Yes even better. I thought you meant the opposite with this:
But nevermind, seems like we think the same thing. |
On the benchmark side, everything should be possible to do in As noted, As noted here, we could embed |
I investigated the steps needed for an omni-node friendly ContextThe benchmark overhead command has the job of providing us with two things:
To calculate these, it executes a block and monitors its time and the proof recorded during this time. In addition, it will execute a Moving PartsThere are multiple moving parts that make this work for arbitrary runtimes. InherentsSince we want to support multiple runtimes, we need to supply all the inherents the runtime expects. Most parachain runtimes will have similar inherent requirements. The runtime already provides the inherents to the block-builder. All we need to do is populate the Building the ExtrinsicTo support multiple runtimes, we must build the extrinsic dynamically based on the runtime's metadata. My first intuition is to employ Block Building & ClientThe actual block building and client acquisition should be easy. We can use the same Initial StateIdeally, the runtime should provide the initial state. As previously discussed, we could rely on some Question: How many accounts do we want to inject? User FacingThe user interface can extend the One question that remains open for now is how to handle chains that have custom inherents or more exotic setups. We can likely ignore this in the initial version. Still, we could allow parachain teams extension of inherents and transaction building by having a minimal API, similar to what For an initial iteration, there is also the idea of providing something like a |
Either that, or they fork the omni-bencher, or there is a
Yea good idea.
Probably should be a CLI command with a default. Currently the PoV benchmarking assumes a million entries per map - but it does not actually populate the maps, just extrapolates the proof size. |
With Maybe the easiest will be to just substract the post-dispatch weight of |
# Benchmark Overhead Command for Parachains This implements the `benchmark overhead` command for parachains. Full context is available at: #5303. Previous attempt was this #5283, but here we have integration into frame-omni-bencher and improved tooling. ## Changes Overview Users are now able to use `frame-omni-bencher` to generate `extrinsic_weight.rs` and `block_weight.rs` files for their runtime. The core logic for generating these remains untouched; this PR provides mostly machinery to make it work for parachains at all. Similar to the pallet benchmarks, we gain the option to benchmark based on just a runtime: ``` frame-omni-bencher v1 benchmark overhead --runtime {{runtime}} ``` or with a spec: ``` frame-omni-bencher v1 benchmark overhead --chain {{spec}} --genesis-builder spec ``` In this case, the genesis state is generated from the runtime presets. However, it is also possible to use `--chain` and genesis builder `spec` to generate the genesis state from the chain spec. Additionally, we use metadata to perform some checks based on the pallets the runtime exposes: - If we see the `ParaInherent` pallet, we assume that we are dealing with a relay chain. This means that we don't need proof recording during import (since there is no storage weight). - If we detect the `ParachainSystem` pallet, we assume that we are dealing with a parachain and take corresponding actions like patching a para id into the genesis state. On the inherent side, I am currently supplying the standard inherents every parachain needs. In the current state, `frame-omni-bencher` supports all system chains. In follow-up PRs, we could add additional inherents to increase compatibility. Since we are building a block during the benchmark, we also need to build an extrinsic. By default, I am leveraging subxt to build the xt dynamically. If a chain is not compatible with the `SubstrateConfig` that comes with `subxt`, it can provide a custom extrinsic builder to benchmarking-cli. This requires either a custom bencher implementation or an integration into the parachains node. Also cumulus-test-runtime has been migrated to provide genesis configs. ## Chain Compatibility The current version here is compatible with the system chains and common substrate chains. The way to go for others would be to customize the frame-omni-bencher by providing a custom extrinsicbuilder. I did an example implementation that works for mythical: https://github.com/skunert/mythical-bencher ## Follow-Ups - After #6040 is finished, we should integrate this here to make the tooling truly useful. In the current form, the state is fairly small and not representative. ## How to Review I recommend starting from [here](https://github.com/paritytech/polkadot-sdk/pull/5891/files#diff-50830ff756b3ac3403b7739d66c9e3a5185dbea550669ca71b28d19c7a2a54ecR264), this method is the main entry point for omni-bencher and `polkadot` binary. TBD: - [x] PRDoc --------- Co-authored-by: Michal Kucharczyk <[email protected]>
closed now. |
The
benchmark overhead
command should be implemented forframe-omni-bencher
.Currently its not clear how to run
benchmark overhead
for a parachain.Omni bencher currently does not support the command.
polkadot-sdk/substrate/utils/frame/omni-bencher/src/command.rs
Line 134 in 6911f50
Polkadot-parachain does not support it either.
polkadot-sdk/cumulus/polkadot-parachain/src/command.rs
Lines 489 to 513 in 6911f50
And you can not use the
polkadot
binary because it is not having the same hostfunctions enabled (e.g.ext_storage_proof_size_storage_proof_size_version_1
).Noticed while playing with #5283
The text was updated successfully, but these errors were encountered: