-
Notifications
You must be signed in to change notification settings - Fork 815
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
Implement Size() measuring size estimation for execution cache #6681
base: master
Are you sure you want to change the base?
Conversation
…mpty size estimation function for mutableState and shardContext
79e5291
to
b7ca226
Compare
@@ -236,5 +236,7 @@ type ( | |||
|
|||
GetHistorySize() int64 | |||
SetHistorySize(size int64) | |||
|
|||
GetEstimatedMutableStateSize() int |
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'm not sure if you have a Size
interface somewhere, but would it make more sense for using that?
The thing about creating an interface for Size() int
is that it'll allow whatever caches that need to take inputs can just require the interface, rather than any specific concrete types?
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 makes sense, I will change the naming to Size(). Thanks.
What changed?
Implement Size() measuring size estimation for execution cache, add empty size estimation function for mutableState and shardContext
Why?
We want to modernize existing cadence common cache implement to a bytes-based system. That means we need to have a method to measure each entry (which is currently accepting any generic interface). We found the "Reflect" package provides a measuring function but runtime is too slow to be used in cache operations. Therefore, we will require all usages to implement the Size() function in their cache logic if they want to migrate to the new bytes-based system.
In order to seamless transition from the current cache system with an entry-based model, the implementation and rollout will be done in following phases:
a. Implement Size() for ExecutionCache <-- This PR
b. Implement Size() for EventCache
How did you test it?
Unit tests
Potential risks
No risk since this PR only adds read-only function that is not used.
Release notes
Documentation Changes