-
Notifications
You must be signed in to change notification settings - Fork 695
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
Transaction weight bloated by 2.5x in the latest release #6403
Comments
https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/system/src/extensions/weights.rs the extensions have now a weight. Just alone the ones listed there are around ~325μsec. The base transaction weight should now be almost useless, because the extensions report their own weight. |
This could be due to #3685 With this PR transaction extension declare their own weight. But base extrinsic calculation hasn't changed and still includes the transaction extensions. So some weight could be counted 2 times. How do you obtain this result? By calculating the pre disparch information or by measuring with bench extrinsic? |
It was measured, but on an empty snapshot.
👍 |
We still need to re-bench the substrate weights, the ones merged are kind of old. Let's try that and see if/how much it improves. |
Hmmm, but that doesn't add up either. So the old one is 107+38+100+25=270, and the new one is 107+61+100+25+325=618, where 107 is added redundantly. Still interested where the difference between 732 and 618 goes, but otherwise it explains a lot, thank you!
Please don't do that until we have some mitigation for #5533 (comment) We've just dropped our TPS by 2.5x with the extension weights, give us some time to recover 😅 |
I started the effort here but it won't be merged soon, there's still some fixes to be made to the bench bot. |
Just submitting transactions and watching their weights in PJS 🫠 |
Tbh, I don't get why you are not just reducing the read/write db operations constants in your runtime. For benchmarking polkadot, you need to stay inside the 2s limit. How you stay in this limit, what kind of machine you use to build these block, polkadot doesn't care. You just need to stay inside these limits. From the chain perspective these numbers are also not that important, they are only important to ensure that blocks can be imported in a limited amount time. Tldr, change the weights as you need. You just need to ensure that the block stays in the limits on the relay chain. |
From substrate weight this is what I read on master: pub type TxExtension = (
frame_system::CheckNonZeroSender<Runtime>, //527_000
frame_system::CheckSpecVersion<Runtime>, // 4_160_000
frame_system::CheckTxVersion<Runtime>, // 439_000
frame_system::CheckGenesis<Runtime>, // 4_160_000, 1r // BlockHash block 0 should be white-listed probably
frame_system::CheckEra<Runtime>, // 6_523_000, 1r // BlockHash current block should also be white-liststed probably
frame_system::CheckNonce<Runtime>, // 6_000_000, 1r, 1w // Account
frame_system::CheckWeight<Runtime>, // 4_700_000, 1r, 1w // AllExtrinsicsLen should be whitelisted
pallet_skip_feeless_payment::SkipCheckIfFeeless<
Runtime,
// Native: 35_263_000, 3r
// `Author` should be whitelisted
// `Digest` should be whitelisted
// `NextFeeMultiplier` should be whitelisted
// (if using asset payment: 113_992_000, 7r, 4w)
pallet_asset_conversion_tx_payment::ChargeAssetTxPayment<Runtime>, >,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>, // 0
);
// Transfer keep alive: 61_290_000, 1r, 1w
// + base_extrinsic So there 6 read and 1 write are overestimated (should be in cache). So it seems we have |
For For For For the transaction payment extensions, I think it's ok to whitelist those |
Okay, for now I just zeroed the extension weights: polkadot-sdk/cumulus/parachains/runtimes/testing/yet-another-parachain/src/lib.rs Lines 164 to 174 in 179fb0c
But I still get 116647000 of extension weight (plus 1733 bytes proof) with every transfer_keep_alive transaction. Is it some inherent extension weight I cannot get rid of? (NB: Numbers provided are measured with ParityDB DbWeights in place)
|
That should be the weight of the other extensions in the pipeline, most of which should come from the transaction payment extension you're using, either
You can do the same zero weight setup for that extension as well in its pallet config. |
I see that |
…UncheckedExtrinsic` (#6418) Follow up to #3685 Partially fixes #6403 The main PR introduced bare support for the new extension version byte as well as extension weights and benchmarking. This PR: - Removes the redundant extension version byte from the signed v4 extrinsic, previously unused and defaulted to 0. - Adds the extension version byte to the inherited implication passed to `General` transactions. - Whitelists the `pallet_authorship::Author`, `frame_system::Digest` and `pallet_transaction_payment::NextFeeMultiplier` storage items as they are read multiple times by extensions for each transaction, but are hot in memory and currently overestimate the weight. - Whitelists the benchmark caller for `CheckEra` and `CheckGenesis` as the reads are performed for every transaction and overestimate the weight. - Updates the umbrella frame weight template to work with the system extension changes. - Plans on re-running the benchmarks at least for the `frame_system` extensions. --------- Signed-off-by: georgepisaltu <[email protected]> Co-authored-by: command-bot <> Co-authored-by: gui <[email protected]>
…UncheckedExtrinsic` (#6418) Follow up to #3685 Partially fixes #6403 The main PR introduced bare support for the new extension version byte as well as extension weights and benchmarking. This PR: - Removes the redundant extension version byte from the signed v4 extrinsic, previously unused and defaulted to 0. - Adds the extension version byte to the inherited implication passed to `General` transactions. - Whitelists the `pallet_authorship::Author`, `frame_system::Digest` and `pallet_transaction_payment::NextFeeMultiplier` storage items as they are read multiple times by extensions for each transaction, but are hot in memory and currently overestimate the weight. - Whitelists the benchmark caller for `CheckEra` and `CheckGenesis` as the reads are performed for every transaction and overestimate the weight. - Updates the umbrella frame weight template to work with the system extension changes. - Plans on re-running the benchmarks at least for the `frame_system` extensions. --------- Signed-off-by: georgepisaltu <[email protected]> Co-authored-by: command-bot <> Co-authored-by: gui <[email protected]>
The full
TransferKeepAlive
actual transaction weight, when included in a block, used to be ≈293μsec in parachains using Substrate weights. That included (roughly) base extrinsic weight (107μsec), transaction's benchmarked weight (38μsec), one storage write (100μsec), and one storage read (25μsec), which sums up to 270μsec. I'm not sure where other 23μsec were going but that was close enough.After merging the latest master, in the very same setup I'm getting 732μsec per transaction 😬 Okay, the benchmarked weight went up from 38 to 61μsec due to #5533 (comment), but all the other weights have remained the same.
In practice, that means the parachain sTPS degradation from (roughly) 925 TPS to 370 TPS.
What has happened to transaction weights recently, and how can it be fixed?
CC @eskimor @sandreim @skunert
The text was updated successfully, but these errors were encountered: