`fatxpool`: rotator cache size now depends on pool's limits (#7102)
# Description This PR modifies the hard-coded size of extrinsics cache within [`PoolRotator`](https://github.com/paritytech/polkadot-sdk/blob/cdf107de/substrate/client/transaction-pool/src/graph/rotator.rs#L36-L45) to be inline with pool limits. The problem was, that due to small size (comparing to number of txs in single block) of hard coded size: https://github.com/paritytech/polkadot-sdk/blob/cdf107de/substrate/client/transaction-pool/src/graph/rotator.rs#L34 excessive number of unnecessary verification were performed in `prune_tags`: https://github.com/paritytech/polkadot-sdk/blob/cdf107de /substrate/client/transaction-pool/src/graph/pool.rs#L369-L370 This was resulting in quite long durations of `prune_tags` execution time (which was ok for 6s, but becomes noticable for 2s blocks): ``` Pruning at HashAndNumber { number: 83, ... }. Resubmitting transactions: 6142, reverification took: 237.818955ms Pruning at HashAndNumber { number: 84, ... }. Resubmitting transactions: 5985, reverification took: 222.118218ms Pruning at HashAndNumber { number: 85, ... }. Resubmitting transactions: 5981, reverification took: 215.546847ms ``` The fix reduces the overhead: ``` Pruning at HashAndNumber { number: 92, ... }. Resubmitting transactions: 6325, reverification took: 14.728354ms Pruning at HashAndNumber { number: 93, ... }. Resubmitting transactions: 7030, reverification took: 23.973607ms Pruning at HashAndNumber { number: 94, ... }. Resubmitting transactions: 4465, reverification took: 9.532472ms ``` ## Review Notes I decided to leave the hardocded `EXPECTED_SIZE` for the legacy transaction pool. Removing verification of transactions during re-submission may negatively impact the behavior of the legacy (single-state) pool. As in long-term we probably want to deprecate old pool, I did not invest time to assess the impact of rotator change in behavior of the legacy pool. --------- Co-authored-by: command-bot <> Co-authored-by:Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
parent
f0eec07f
Showing
- prdoc/pr_7102.prdoc 8 additions, 0 deletionsprdoc/pr_7102.prdoc
- substrate/client/transaction-pool/benches/basics.rs 10 additions, 2 deletionssubstrate/client/transaction-pool/benches/basics.rs
- substrate/client/transaction-pool/src/common/tests.rs 1 addition, 1 deletionsubstrate/client/transaction-pool/src/common/tests.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/dropped_watcher.rs 2 additions, 2 deletions...transaction-pool/src/fork_aware_txpool/dropped_watcher.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs 1 addition, 1 deletion...ansaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs
- substrate/client/transaction-pool/src/graph/pool.rs 38 additions, 11 deletionssubstrate/client/transaction-pool/src/graph/pool.rs
- substrate/client/transaction-pool/src/graph/rotator.rs 33 additions, 9 deletionssubstrate/client/transaction-pool/src/graph/rotator.rs
- substrate/client/transaction-pool/src/graph/validated_pool.rs 28 additions, 3 deletions...trate/client/transaction-pool/src/graph/validated_pool.rs
- substrate/client/transaction-pool/src/single_state_txpool/revalidation.rs 10 additions, 2 deletions.../transaction-pool/src/single_state_txpool/revalidation.rs
- substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs 10 additions, 2 deletions...ction-pool/src/single_state_txpool/single_state_txpool.rs
- substrate/client/transaction-pool/tests/fatp.rs 1 addition, 3 deletionssubstrate/client/transaction-pool/tests/fatp.rs
- substrate/client/transaction-pool/tests/pool.rs 2 additions, 2 deletionssubstrate/client/transaction-pool/tests/pool.rs
Please register or sign in to comment