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

Take state writing off the critical path #11803

Closed
Ekleog-NEAR opened this issue Jul 17, 2024 · 2 comments
Closed

Take state writing off the critical path #11803

Ekleog-NEAR opened this issue Jul 17, 2024 · 2 comments
Assignees
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team

Comments

@Ekleog-NEAR
Copy link
Collaborator

Currently, we flush the state to disk as part of the critical path here:

self.validate_apply_state_update(

However, since in-memory trie, we should not need to write the state to disk before processing the next block. Instead, we could publish the block before writing to disk, and write to disk asynchronously. That should give us a likely 10-50% performance boost. If my recollection serves correctly, we sometimes spend 300ms writing state to disk in production, which would hopefully give us a roughly 30% single-shard performance boost, by moving these 300ms to a background thread.

This is a project we had considered a few times, without being able to act on it due to trie complexity. With in-memory trie, it should become easier to act on now — we already eliminated disk reads, and disk writes should be able to go soon off the critical path too.

@Ekleog-NEAR Ekleog-NEAR added A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team labels Jul 17, 2024
@Ekleog-NEAR Ekleog-NEAR self-assigned this Jul 17, 2024
@nagisa
Copy link
Collaborator

nagisa commented Jul 18, 2024

This reads a lot like a duplicate of #11118. Since you're working on it, I don't mind whichever issue you want to keep for tracking this work, but consider closing the other one.

@Ekleog-NEAR
Copy link
Collaborator Author

That's exactly the one, thank you! I was sure there was already an issue open for it but failed to find it in the issue list, will close this one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team
Projects
None yet
Development

No branches or pull requests

2 participants