-
Notifications
You must be signed in to change notification settings - Fork 148
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
pruntime: Optional use RocksDB/redb as trie state backend #1265
Open
kvinwang
wants to merge
28
commits into
master
Choose a base branch
from
kvdb2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
kvinwang
force-pushed
the
kvdb2
branch
2 times, most recently
from
May 16, 2023 06:28
a9261b2
to
936ed73
Compare
kvinwang
changed the title
RocksDB as trie state backend
pruntime: RocksDB as trie state backend
May 16, 2023
Sorry. Didn't get time to review it. Will do this week. |
kvinwang
changed the title
pruntime: RocksDB as trie state backend
pruntime: Optional use RocksDB/redb as trie state backend
Jul 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR moves the chain storage and phat contract storage onto Gramine's encrypted file system.
Prior to this, we used an in-memory
im::OrdMap
as the storage backend. However, with the growing amount of on-chain data and the number of phat contracts, memory storage would quickly become unsustainable. Therefore, we considered moving the data into the file system to solve the problem of memory explosion. In this PR, we use Gramine's encrypted file system to store RocksDB as the storage backend. The modification is based on the existing software architecture and is implemented by changing the internal implementation ofphala_trie_storage::TrieStorage
.In order to be compatible with the previous pruntime checkpoint, RocksDB is used only as a cache. That is to say, when pruntime takes snapshots, it will dump all the contents of RocksDB into the snapshot, and when pruntime starts, it will delete the RocksDB used last time and rebuild a new RocksDB instance from the snapshot.
To enable RocksDB, run pruntime with
--db=rocksdb
:What have been tested
After the modification, the following compatibility tests were made:
Overhead
I attempted to synchronize Khala blocks. It took twice as long compared to using a memory database
Merging
Because this PR may affect the stability of pRuntime, let's not merge it for the time being, we need a lot of testing on some test networks to ensure its stability.