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

Cache empty slots #4874

Merged
merged 7 commits into from Jan 11, 2023
Merged

Conversation

ahamlat
Copy link
Contributor

@ahamlat ahamlat commented Jan 3, 2023

Signed-off-by: Ameziane H ameziane.hamlat@consensys.net
Co-authored-by: Karim TAAM karim.t2am@gmail.com

PR description

This will add a cache for empty slots. This would help to improve SLOAD and SSTORE performance. It would improve especially SSTORE during cost gas and refund amount calculation because some original and current values used during this calculation are empty.

CPU Profiling before and after this PR

Before this PR
Block Processing CPU profiling
image

SSTORE CPU Profiling
image

After this PR
Block Processing CPU profiling
Screenshot 2023-01-06 at 10 20 15

SSTORE CPU Profiling
image

The results

As we can see in the screenshot below, there is an improvement on block processing time on 50th percentile (mean) and 95th percentile.

image

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

ahamlat and others added 2 commits January 3, 2023 09:28
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
@ahamlat ahamlat changed the title [Work In Progress] Cache empty slots Cache empty slots Jan 5, 2023
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
@ahamlat ahamlat marked this pull request as ready for review January 6, 2023 09:53
Copy link
Contributor

@garyschulte garyschulte 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, minor feedback about isDirty()

…mpty.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Copy link
Contributor

@matkt matkt left a comment

Choose a reason for hiding this comment

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

LGTM

@matkt matkt force-pushed the avoid-fallback-on-empty-slots branch from 49e1a18 to 494e274 Compare January 11, 2023 11:13
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

🚢

@ahamlat ahamlat enabled auto-merge (squash) January 11, 2023 21:27
@ahamlat ahamlat merged commit d23a187 into hyperledger:main Jan 11, 2023
siladu pushed a commit to jflo/besu that referenced this pull request Feb 7, 2023
* Cache empty slots.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* clear after each block and copy during clone

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* add changelog

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* Avoid triggering a calculate root hash when empty slot cache is not empty.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
Co-authored-by: Karim TAAM <karim.t2am@gmail.com>
siladu pushed a commit to jflo/besu that referenced this pull request Feb 7, 2023
* Cache empty slots.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* clear after each block and copy during clone

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* add changelog

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* Avoid triggering a calculate root hash when empty slot cache is not empty.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Karim TAAM <karim.t2am@gmail.com>
@siladu siladu mentioned this pull request Feb 7, 2023
jflo added a commit that referenced this pull request Feb 8, 2023
* Fix transaction pool issue (#4964)
* Cache empty slots (#4874)
* clear after each block and copy during clone
* fix transaction pool issue
* add block replay
* support in-memory snapshots
* Keep Worldstate Storage open for Bonsai archive latest layer (#5039)
* bonsai layered worldstate subscription
* unsubscribe from worldstatestorage on close of BonsaiLayeredWorldState
* minor txpool logging improvements
* Avoid triggering a calculate root hash when empty slot cache is not empty.
* use the updater cache to get an account during block processing (#4897)
* Worldstate-only resync behavior (#4875)
* use debug rpc endpoint to resync worldstate
* Reset transaction pool state every time the initial sync is done
* init heal code



---------

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: matkt <karim.t2am@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: ahamlat <ameziane.hamlat@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Fabio Di Fabio <fabio.difabio@consensys.net>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* Cache empty slots.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* clear after each block and copy during clone

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>

* add changelog

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

* Avoid triggering a calculate root hash when empty slot cache is not empty.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: ahamlat <ameziane.hamlat@consensys.net>
Co-authored-by: Karim TAAM <karim.t2am@gmail.com>
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.

None yet

3 participants