diff --git a/CHANGELOG.md b/CHANGELOG.md index 664aaace31..d57aa80b70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * [FEATURE] Ingester: Add per-tenant new metric `cortex_ingester_tsdb_data_replay_duration_seconds`. #5477 * [ENHANCEMENT] Store Gateway: Added `-store-gateway.enabled-tenants` and `-store-gateway.disabled-tenants` to explicitly enable or disable store-gateway for specific tenants. #5638 * [ENHANCEMENT] Upgraded Docker base images to `alpine:3.18`. #5684 +* [ENHANCEMENT] Index Cache: Multi level cache adds config `max_backfill_items` to cap max items to backfill per async operation. #5686 ## 1.16.0 2023-11-20 diff --git a/docs/blocks-storage/querier.md b/docs/blocks-storage/querier.md index 524a2699fa..4c303613ca 100644 --- a/docs/blocks-storage/querier.md +++ b/docs/blocks-storage/querier.md @@ -719,6 +719,10 @@ blocks_storage: # CLI flag: -blocks-storage.bucket-store.index-cache.multilevel.max-async-buffer-size [max_async_buffer_size: | default = 10000] + # The maximum number of items to backfill per asynchronous operation. + # CLI flag: -blocks-storage.bucket-store.index-cache.multilevel.max-backfill-items + [max_backfill_items: | default = 10000] + chunks_cache: # Backend for chunks cache, if not empty. Supported values: memcached. # CLI flag: -blocks-storage.bucket-store.chunks-cache.backend diff --git a/docs/blocks-storage/store-gateway.md b/docs/blocks-storage/store-gateway.md index 5a83eecbb3..2d1d89bf3e 100644 --- a/docs/blocks-storage/store-gateway.md +++ b/docs/blocks-storage/store-gateway.md @@ -834,6 +834,10 @@ blocks_storage: # CLI flag: -blocks-storage.bucket-store.index-cache.multilevel.max-async-buffer-size [max_async_buffer_size: | default = 10000] + # The maximum number of items to backfill per asynchronous operation. + # CLI flag: -blocks-storage.bucket-store.index-cache.multilevel.max-backfill-items + [max_backfill_items: | default = 10000] + chunks_cache: # Backend for chunks cache, if not empty. Supported values: memcached. # CLI flag: -blocks-storage.bucket-store.chunks-cache.backend diff --git a/docs/configuration/config-file-reference.md b/docs/configuration/config-file-reference.md index c2c07da5e4..c11b3bbdee 100644 --- a/docs/configuration/config-file-reference.md +++ b/docs/configuration/config-file-reference.md @@ -1268,6 +1268,10 @@ bucket_store: # CLI flag: -blocks-storage.bucket-store.index-cache.multilevel.max-async-buffer-size [max_async_buffer_size: | default = 10000] + # The maximum number of items to backfill per asynchronous operation. + # CLI flag: -blocks-storage.bucket-store.index-cache.multilevel.max-backfill-items + [max_backfill_items: | default = 10000] + chunks_cache: # Backend for chunks cache, if not empty. Supported values: memcached. # CLI flag: -blocks-storage.bucket-store.chunks-cache.backend diff --git a/pkg/storage/tsdb/multilevel_cache.go b/pkg/storage/tsdb/multilevel_cache.go index 1ee9a23a3e..a523a92e92 100644 --- a/pkg/storage/tsdb/multilevel_cache.go +++ b/pkg/storage/tsdb/multilevel_cache.go @@ -3,7 +3,6 @@ package tsdb import ( "context" "errors" - "slices" "sync" "github.com/oklog/ulid" @@ -13,6 +12,7 @@ import ( "github.com/prometheus/prometheus/storage" "github.com/thanos-io/thanos/pkg/cacheutil" storecache "github.com/thanos-io/thanos/pkg/store/cache" + "golang.org/x/exp/slices" ) const (