Skip to content
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

Txpool state cache #7046

Merged
merged 15 commits into from
May 20, 2024
Merged

Txpool state cache #7046

merged 15 commits into from
May 20, 2024

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented May 18, 2024

Changes

  • Adding a state cache to txPool and building on Intra-block cache #7039 to push the changed accounts to the pool with the block so those accounts can be invalidated from the cache. (As TxPool was causing a signifcant dominance in the remaining state access)
    • When I updated the accounts rather than just invalidating them in cache that had a higher read rate; perhaps due to bringing them to the top of LRU; when they wouldn't be used in a following block, and pushing out older accounts that would. (e.g. if not included in block, are more likely to be still in tx pool in next block vs an account that was just included in a block vacating the tx pool)

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • Yes

If yes, did you write tests?

  • Yes (ish) adjusted existing test to be cache aware and tested results against mainnet

Remarks

StateDb Reads

Before ave 51.7k ops/m, max 140k ops/m

image

After ave 13.5k ops/m, max 35.5k ops/m

image

State Tree

Before (validation) reads 4.82k op/m; (txpool) reader reads 10.9k/s

image

After (validation) reads 2.2k op/m; (txpool) reader reads 1.1k/s; cache hits 11.9k op/m

image

Trie Operations

Before RLP.Encode 103k ops/m

image

After RLP.Encode 20.5k ops/m

image

DarkPool uneffected (i.e. not over dropping txs)

Before ave 18%

image

After ave 16%

image

@benaadams benaadams marked this pull request as ready for review May 18, 2024 14:10
@LukaszRozmej LukaszRozmej changed the base branch from master to intrablock-cache May 19, 2024 00:53
src/Nethermind/Nethermind.State/StateProvider.cs Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.TxPool/TxPool.cs Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.TxPool/TxPool.cs Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.TxPool/TxPool.cs Show resolved Hide resolved
Base automatically changed from intrablock-cache to master May 20, 2024 10:05
@benaadams benaadams merged commit a36909b into master May 20, 2024
67 checks passed
@benaadams benaadams deleted the txpool-cache branch May 20, 2024 21:36
@kamilchodola kamilchodola restored the txpool-cache branch May 27, 2024 13:49
@benaadams benaadams deleted the txpool-cache branch May 27, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants