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

perf: introduce moka cached state provider #12214

Merged
merged 3 commits into from
Jan 8, 2025
Merged

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Oct 30, 2024

Introduces a currently unused cached state provider, which uses moka caches, so the caches can be shared among multiple CachedStateProviders

ref #12052, #13713

@Rjected Rjected added C-enhancement New feature or request C-perf A change motivated by improving speed, memory usage or disk footprint A-db Related to the database labels Oct 30, 2024
@Rjected Rjected force-pushed the dan/add-cached-state-provider branch from d66da1a to 29b53b1 Compare October 30, 2024 21:20
Copy link
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

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

nice. follow up for trie?

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

@Rjected sorry I overlooked this one

is this still relevant?

@Rjected Rjected force-pushed the dan/add-cached-state-provider branch from 29b53b1 to e4d6be1 Compare January 7, 2025 23:34
crates/engine/tree/src/tree/cached_state.rs Show resolved Hide resolved
crates/engine/tree/src/tree/cached_state.rs Outdated Show resolved Hide resolved
@Rjected Rjected force-pushed the dan/add-cached-state-provider branch from 8da1c4f to 3f81fd1 Compare January 8, 2025 00:35
self.state_provider.proof(input, address, slots)
}

fn multiproof(
Copy link
Member

Choose a reason for hiding this comment

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

What's the plan for this? Also these caches should probably work across blocks too?

Copy link
Member Author

Choose a reason for hiding this comment

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

rather than caching proofs right now, we'll send messages to the state root task, which will use a different provider to fetch + cache proofs itself for each block

We should start with intra-block caching, but for cross-block caching, we would need to apply state updates to the cache, instead of invalidating each block. Maybe we could also incorporate trie updates as well

Copy link
Member

Choose a reason for hiding this comment

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

Yes exactly

Cargo.lock Outdated
dependencies = [
"base64 0.22.1",
"indexmap 2.7.0",
"metrics",
"metrics-util",
"metrics-util 0.19.0",
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a problem because it duplicates metrics, please revert or bump metrics-util locally

Copy link
Member Author

@Rjected Rjected Jan 8, 2025

Choose a reason for hiding this comment

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

missed this, bumping

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool

@Rjected Rjected added this pull request to the merge queue Jan 8, 2025
Merged via the queue into main with commit d336ceb Jan 8, 2025
43 checks passed
@Rjected Rjected deleted the dan/add-cached-state-provider branch January 8, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database C-enhancement New feature or request C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants