https://github.com/onflow/flow-go/issues/5277 adds the option to cache register lookups for local script execution on Access nodes. While it has configuration to specify a max cache size, the size is measured in number of entries which doesn't allow the operator to accurately tune it for resources.
For example, most register values are fairly small in terms of bytes. If we specify a limit based on the assumption of small values, a script requesting a series of large register values could easily overwhelm a host's memory. However, if we assume that register values are large, then we will not be able to make good use of the cache.
Proposed Solution
Add support for specifying a max cache data size. This would check the size of the new data as it's added to the cache, and evict entries until sufficient space is available to add the new entry. When all small entries are queried, it can hold a much larger number. When large value are added, it will remain within the max size.
Definition of Done
Operators have an option to specify a max register cache size measured in bytes (or MB).
The cache implementation tracks the size of data held, and evicts items from the cache as needed to stay under the limit.
Tests are added verifying the behavior.
Metrics and logging are added for observability.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Problem Definition
https://github.com/onflow/flow-go/issues/5277 adds the option to cache register lookups for local script execution on Access nodes. While it has configuration to specify a max cache size, the size is measured in number of entries which doesn't allow the operator to accurately tune it for resources.
For example, most register values are fairly small in terms of bytes. If we specify a limit based on the assumption of small values, a script requesting a series of large register values could easily overwhelm a host's memory. However, if we assume that register values are large, then we will not be able to make good use of the cache.
Proposed Solution
Add support for specifying a max cache data size. This would check the size of the new data as it's added to the cache, and evict entries until sufficient space is available to add the new entry. When all small entries are queried, it can hold a much larger number. When large value are added, it will remain within the max size.
Definition of Done
Operators have an option to specify a max register cache size measured in bytes (or MB). The cache implementation tracks the size of data held, and evicts items from the cache as needed to stay under the limit. Tests are added verifying the behavior. Metrics and logging are added for observability.