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

Support filtered index cache #6765

Merged
merged 12 commits into from Oct 6, 2023
Merged

Support filtered index cache #6765

merged 12 commits into from Oct 6, 2023

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Oct 2, 2023

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

This pr adds a new config enabled_items, which is a list of strings, to enable filtered index cache.

Filtered index cache allows users to selectively cache items based on configuration.

Several use cases of it:

  1. Inmemory is usually quite small like 1 GB. With limited space, it is usually more efficient to cache expanded postings rather than normal postings as expanded postings is usually much smaller than normal postings. In our production data, we are able to see P99 postings size up to 100MB while expanded postings size is usually < 500 KB. By caching expanded postings only, we can achieve a higher cache hit ratio while lowering unnecessary evictions.

  2. Separate cache backends. To achieve higher cache hit ratio and lower evictions, we want to have separate memcached clusters for different type of caches, like expanded postings only or postings only.

Changes

Added a new index cache FilteredIndexCache.
Added enabled_items to index cache config.

Verification

@@ -17,7 +17,8 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6605](https://github.com/thanos-io/thanos/pull/6605) Query Frontend: Support vertical sharding binary expression with metric name when no matching labels specified.
- [#6308](https://github.com/thanos-io/thanos/pull/6308) Ruler: Support configuration flag that allows customizing template for alert message.
- [#6760](https://github.com/thanos-io/thanos/pull/6760) Query Frontend: Added TLS support in `--query-frontend.downstream-tripper-config` and `--query-frontend.downstream-tripper-config-file`
- [#6749](https://github.com/thanos-io/thanos/pull/6308) Store Gateway: Added `thanos_store_index_cache_fetch_duration_seconds` histogram for tracking latency of fetching data from index cache.
- [#6749](https://github.com/thanos-io/thanos/pull/6749) Store Gateway: Added `thanos_store_index_cache_fetch_duration_seconds` histogram for tracking latency of fetching data from index cache.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to include this entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to fix the wrong url

pkg/store/cache/factory.go Outdated Show resolved Hide resolved
saswatamcode
saswatamcode previously approved these changes Oct 5, 2023
Copy link
Member

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just minor nits!

docs/components/store.md Show resolved Hide resolved
pkg/store/cache/factory.go Show resolved Hide resolved
pkg/store/cache/filter_cache.go Show resolved Hide resolved
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Copy link
Member

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yeya24 yeya24 merged commit 79bbf34 into thanos-io:main Oct 6, 2023
16 checks passed
@yeya24 yeya24 deleted the filtered-cache branch October 6, 2023 04:37
coleenquadros pushed a commit to coleenquadros/thanos that referenced this pull request Oct 6, 2023
* support filtered index cache

Signed-off-by: Ben Ye <benye@amazon.com>

* changelog

Signed-off-by: Ben Ye <benye@amazon.com>

* fix doc

Signed-off-by: Ben Ye <benye@amazon.com>

* fix unit test failure

Signed-off-by: Ben Ye <benye@amazon.com>

* add item type validation

Signed-off-by: Ben Ye <benye@amazon.com>

* lint

Signed-off-by: Ben Ye <benye@amazon.com>

* change enabled_items to []string type

Signed-off-by: Ben Ye <benye@amazon.com>

* generate docs

Signed-off-by: Ben Ye <benye@amazon.com>

* separate validation code

Signed-off-by: Ben Ye <benye@amazon.com>

* fix lint

Signed-off-by: Ben Ye <benye@amazon.com>

* update doc

Signed-off-by: Ben Ye <benye@amazon.com>

* fix interface

Signed-off-by: Ben Ye <benye@amazon.com>

---------

Signed-off-by: Ben Ye <benye@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants