Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

State group caches keep full state for too long, bloating the cache size. #13275

Closed
erikjohnston opened this issue Jul 14, 2022 · 1 comment · Fixed by #13292
Closed

State group caches keep full state for too long, bloating the cache size. #13275

erikjohnston opened this issue Jul 14, 2022 · 1 comment · Fixed by #13292
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@erikjohnston
Copy link
Member

We have a complicated set up for caching state look ups to handle both filtered and full state look ups. However, the eviction strategy is sub-optimal: we keep all cached values for a given state group until we stop querying for any keys in that state group.

This means that if we pull out and cache the full state for a state group, we will keep the full state in the cache even if we only query one type / state key pair periodically.

Ideally the cache would see that nothing has asked for the full state in a while and evict it.

@erikjohnston erikjohnston added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Jul 14, 2022
@erikjohnston erikjohnston added this to the Server Density milestone Jul 14, 2022
@erikjohnston
Copy link
Member Author

Perhaps the solution here is to have the dictionary cache backed by two separate LruCaches. One for specific keys, and one for the "full" dict. When we ask for specific keys we hit the first cache, if its not there we hit the second (without updating the access time!) and add any result back into the first cache.

This should allow the cached "full" dict to be expired if we don't need the full dict.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant