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

Fix series cache growth #1705

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Fix series cache growth #1705

merged 1 commit into from
Oct 24, 2022

Conversation

niksajakovljevic
Copy link
Contributor

Approach is using timestamps to have better understanding on what elements are getting evicted.
If we see an eviction of recently used/inserted element (defined with evictionMaxAge) we will attempt to grow the cache.
evictionMaxAge defines max age where we are doing evictions and not growing the cache.
We don't use additional memory to track timestamps but re-use existing field by bit packing data into uint32.

Closes #1389

@niksajakovljevic niksajakovljevic added the Performance Improvements that are specifically related to performance label Oct 19, 2022
@niksajakovljevic niksajakovljevic self-assigned this Oct 19, 2022
@niksajakovljevic niksajakovljevic force-pushed the niksa/fix-cache-growth branch 3 times, most recently from c880466 to c69de1a Compare October 20, 2022 08:33
@niksajakovljevic niksajakovljevic marked this pull request as ready for review October 20, 2022 08:53
@niksajakovljevic niksajakovljevic requested a review from a team as a code owner October 20, 2022 08:53
pkg/pgmodel/cache/series_cache_test.go Outdated Show resolved Hide resolved
pkg/pgmodel/cache/series_cache_test.go Show resolved Hide resolved
pkg/pgmodel/cache/series_cache_test.go Outdated Show resolved Hide resolved
pkg/pgmodel/cache/series_cache_test.go Outdated Show resolved Hide resolved
Approach is using timestamps to have better understanding on what elements
are getting evicted. If we see an eviction of recently used/inserted
element (defined with evictionMaxAge) we will attempt to grow the cache.
`evictionMaxAge` defines max age where we allow evictions and don't grow the cache.
This fixes the problem with series cache growth.
Main idea here is not to allow evictions of recently used elements but to try to
grow cache instead.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Performance Improvements that are specifically related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SeriesCache does not grow when cache is large
3 participants