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

Reduce state access for TxPool #5433

Merged
merged 4 commits into from
Mar 16, 2023
Merged

Reduce state access for TxPool #5433

merged 4 commits into from
Mar 16, 2023

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Mar 15, 2023

Removes 3 state lookups per txn add

Changes

  • Pass Account to AddCore to avoid 2 additional lookups of account
  • DeployedCodeFilter doesn't need to look up account removing an additional lookup of account
  • Capture closure in constructor to avoid Func allocation per call in UpdateBuckets()
  • Use concrete types to avoid enumerator allocations via interface
  • Use an intra-block Address -> Account cache
  • Reuse a ThreadStatic TxFilteringState rather than allocating each txn
  • Drop Linq use in TxPool
  • Return UInt256? GasBottleneck change rather than Action to change gas to avoid allocating an Action per gas change
  • Only resnapshot on change

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

@LukaszRozmej
Copy link
Member

Does it make a dent in grafana dashboards?

@benaadams
Copy link
Member Author

Removed the Address -> Account cache

@benaadams benaadams marked this pull request as ready for review March 15, 2023 16:05
@benaadams
Copy link
Member Author

@LukaszRozmej is a less exotic change now

Copy link
Contributor

@marcindsobczak marcindsobczak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Worth to run a node for some time to ensure stability before merging

@benaadams
Copy link
Member Author

Does it make a dent in grafana dashboards?

StateDB remains same (as expected as the trie's should be in cache) and State Tree reads drop by 1/4

image

@benaadams benaadams merged commit 3c8c453 into master Mar 16, 2023
@benaadams benaadams deleted the TxnPool-state branch March 16, 2023 14:18
@LukaszRozmej
Copy link
Member

Does it make a dent in grafana dashboards?

StateDB remains same (as expected as the trie's should be in cache) and State Tree reads drop by 1/4

image

Was Darkpool looking fine ~5%?

@benaadams
Copy link
Member Author

Was Darkpool looking fine ~5%?

Ave 5.7%

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants