Skip to content
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

gnovm store: SetCachePackage stores packages on memory. Possible OOM errors. #812

Open
ajnavarro opened this issue May 9, 2023 · 2 comments
Assignees
Labels
📦 🤖 gnovm Issues or PRs gnovm related 🌟 improvement performance improvements, refactors ...

Comments

@ajnavarro
Copy link
Contributor

ajnavarro commented May 9, 2023

Description

After trying to reduce the memory usage moving from maps to an LRU cache here (#780), I realized that packages set on cacheObjects are not expected to be evicted, causing problems if we use an LRU cache.

Possible Solution

We can store these packages on persistent storage using a special key like /tmp/[UUID]/oid:[OID] where [UUID] is a unique ID created per storage session (every time you initialise a store or purge it)

When purging cache calling ClearObjectCache we generate a new UUID and we remove all keys under the previous UUID /tmp/[UUID]

On every server restart, we remove all keys under /tmp

WDYT?

@thehowl
Copy link
Member

thehowl commented May 12, 2023

So your proposal is to have a LRU cache which additionally has some disk-backed data for cache misses?

Could another solution not be of requiring "temporary" / "throwaway" packages added with SetCachePackage to be finalised?

@ajnavarro
Copy link
Contributor Author

@thehowl Yes, that might be another solution. However, we will need more research about the actual codebase to check where this method is used to ensure we can modify the behavior.

@ajnavarro ajnavarro self-assigned this May 15, 2023
@ajnavarro ajnavarro added 🌱 feature New update to Gno 📦 🤖 gnovm Issues or PRs gnovm related 🌟 improvement performance improvements, refactors ... and removed 🌱 feature New update to Gno labels May 15, 2023
@moul moul added this to the 🚀 main.gno.land milestone Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related 🌟 improvement performance improvements, refactors ...
Projects
Status: 🚀 Needed for Launch
Development

No branches or pull requests

3 participants