-
Notifications
You must be signed in to change notification settings - Fork 619
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
feat(storage): Trie cache limit on value cached #2770
Conversation
Don't cache large values and assume that accessing rocksdb is good enough for them. Also don't cache when a hash is missing from storage: retrieve_rc does not benefit from caching those cases, and retrieve_raw_bytes is never supposed to be called for missing values. Also add no_cache feature to near-store and make runtime-params-estimator enable it. Fixes #940 Test plan --------- Existing tests
core/store/src/trie/trie_storage.rs
Outdated
|
||
/// Values above this size are never cached. | ||
/// Note that Trie inner nodes are always smaller than this. | ||
const TRIE_MAX_VALUE_CACHED: usize = 4000; |
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.
It's better to annotate the unit as well (looks like it's byte here).
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.
In the comment?
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.
yeah
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 suggest we call it TRIE_LIMIT_CACHED_VALUE_SIZE
; I find the current name confusing as it sounds like there are values 1, 2, 3, .... 4000, 100500, and we only cache the values that are below 4000 (max value).
core/store/src/trie/trie_storage.rs
Outdated
|
||
/// Values above this size are never cached. | ||
/// Note that Trie inner nodes are always smaller than this. | ||
const TRIE_MAX_VALUE_CACHED: usize = 4000; |
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 suggest we call it TRIE_LIMIT_CACHED_VALUE_SIZE
; I find the current name confusing as it sounds like there are values 1, 2, 3, .... 4000, 100500, and we only cache the values that are below 4000 (max value).
Don't cache large values and assume that accessing rocksdb is good
enough for them.
Also don't cache when a hash is missing from storage: retrieve_rc does
not benefit from caching those cases, and retrieve_raw_bytes is never
supposed to be called for missing values.
Also add no_cache feature to near-store and make
runtime-params-estimator enable it.
Fixes #940
Test plan
Existing tests