Evict resolved database entries
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
The [gapis database](https://github.com/google/gapid/blob/master/gapis/database/memory.go) currently just grows and grows. In order to reduce the memory usage, we should look to evict old / expensive entries.
The database holds two types of entry value - [`Resolveables`](https://github.com/google/gapid/blob/master/gapis/database/resolvable.go) and non-resolvables.
Non-resolvables are arbitrary, static key-value data.
`Resolvables` typically consist of a small proto message that describes all the information required to perform an expensive computation. When resolved, this computation is performed, and the result is placed into the database under the same key. Subsequent database resolves simply use the pre-computed data.
I propose that we attempt to evict the resolved data of `Resolvables`, using the following simple heuristic: `cache_priority = resolved_memory_size * time_to_compute`.
Once the database has reached an upper bound on memory usage, resolved data can be evicted based starting with the entries with the lowest `cache_priority` - freeing the cheapest to compute and/or those that are most memory hungry to store.
Evicting non-resolvables is a far more complicated problem, and is not proposed here.
Contributor guide
Assessment
This issue has not been assessed yet.