-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
cmd, core, eth, light, trie: dump clean cache periodically #20391
Conversation
292bbd9
to
cf62192
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, needs some testing I guess. IIUC, even if we merge this, it will by default do nothing, right?
@holiman nope, the cache dump and reload is enabled by default. And also users can specify the flags to change the behaviors. |
trie/database.go
Outdated
log.Info("Failed to save clean cache into file", "error", err) | ||
} | ||
}(time.Now()) | ||
err = db.cleans.SaveToFileConcurrent(dir, threads) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we'd not want to use max concurrency here? I'd just set this to 0
and let fastcache
max out the performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much time does it take to persist a 1GB cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember the concrete number, but a few seconds.
5d9b421
to
4ad8852
Compare
4ad8852
to
04f6056
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…20391) * cmd, core, eth, light, trie: dump clean cache periodically * eth: update config * trie: minor fix * core, trie: address comments * eth: remove useless * trie: print clean cache dump start too Co-authored-by: Péter Szilágyi <[email protected]>
This PR enables the cache dump and reload from a disk journal.
Accumulate more entries in memory will help us to speed up. However
warm-up the cache can take a few minutes. So disk based journal can help
a lot.
Besides all entries we maintain in the cache is contract code and trie nodes.
The key of entries is essentially the hash of value. So we can blindly reload the
entries from journal and don't need to take care of the validity of data.