-
Notifications
You must be signed in to change notification settings - Fork 674
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
Change merkledb caches to be size based #1947
Conversation
x/merkledb/db.go
Outdated
@@ -31,7 +31,7 @@ import ( | |||
) | |||
|
|||
const ( | |||
DefaultEvictionBatchSize = 100 | |||
DefaultEvictionBatchSize = 256 * units.KiB |
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.
Seems like we may want bigger than this?
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.
This is just the default used in getStandaloneTrieView
which is only used in proof verification
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.
That said we can make it bigger. 1 MiB?
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 was thinking 1MB is a good place to start.
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.
Why would we want larger than this? This isn't a cache - this size that is used to evict from the cache... As dan said - this is only used (internally) for writing during proof verification... which is writing into a memdb
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.
welp I already changed it to 1 MiB. In any case I don't think it matters much. I also unexported it since this is only used in this package.
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.
More I think about this - I think the value should be 0.
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 changed the verification cache sizes and eviction batch size.
} | ||
|
||
errs.Add(c.onEviction(key, value)) | ||
errs.Add(c.onEviction(k, v)) |
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.
Do we want to exit on the first error?
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 was just keeping with the prior semantics here
Why this should be merged
Allows slightly more fine-grained cache size tuning. Specifically useful for the value caches whose entry size can very significantly.
How this works
LRU -> SizedLRU
How this was tested
updated the tests