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

Store Gateway: Lazy posting should mark posting group as lazy if adding too many keys #7956

Closed
yeya24 opened this issue Dec 3, 2024 · 0 comments · Fixed by #7961
Closed

Comments

@yeya24
Copy link
Contributor

yeya24 commented Dec 3, 2024

Is your proposal related to a problem?

Lazy posting is designed on optimizing data bytes fetched when processing a query in Store Gateway. However, certain expensive label matchers might not get optimized if the posting is not big enough, but can be very problematic if it matches a lot of postings.

For example, a query container_memory_working_set_bytes{namespace="ns", pod!="", env="prod"}.

Different matchers might have posting size like below:

- namespace=ns => 10000, 1 key
- name=container_memory_working_set_bytes => 50000, 1 key
- pod!="" => 2M, 1M keys
- env = prod => 20M, 1 key

pod!="" can be problematic because its total posting size is not big enough so it might not marked as lazy. If it is not lazy, it needs to fetch 1M postings from cache and if cache miss, set 1M postings back to cache. This can cause huge amount of load on external cache servers as well as store gateway itself.

Describe the solution you'd like

Improve lazy posting optimization to not only focus on data size but also number of keys each posting group has. If a posting group matches too many keys, mark the posting group as lazy so no need to fetch each posting individually.

The threshold of too many keys can be configurable but we can start with 100K keys or something like that.

Describe alternatives you've considered

Improve index cache key format for posting. For matchers like pod!="" where a lot of values are matched, it is very inefficient to use one cache item per posting. We can maybe try to cache pod!="" as a whole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant