Skip to content

Commit 7812330

Browse files
authored
Expose series batch size flag (#5582)
* expose series batch size flag Signed-off-by: Ben Ye <[email protected]> update docs Signed-off-by: Ben Ye <[email protected]> * changelog Signed-off-by: Ben Ye <[email protected]> --------- Signed-off-by: Ben Ye <[email protected]>
1 parent dc3807c commit 7812330

File tree

11 files changed

+29
-9
lines changed

11 files changed

+29
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
* [FEATURE] AlertManager: Add support for Webex, Discord and Telegram Receiver. #5493
88
* [FEATURE] Ingester: added `-admin-limit-message` to customize the message contained in limit errors.#5460
99
* [FEATURE] AlertManager: Update version to v0.26.0 and bring in Microsoft Teams receiver. #5543
10-
* [FEATURE] Store Gateway: Support lazy expanded posting optimization. Added new flag `"blocks-storage.bucket-store.lazy-expanded-postings-enabled` and new metrics `cortex_bucket_store_lazy_expanded_postings_total`, `cortex_bucket_store_lazy_expanded_posting_size_bytes_total` and `cortex_bucket_store_lazy_expanded_posting_series_overfetched_size_bytes_total`. #5556.
10+
* [FEATURE] Store Gateway: Support lazy expanded posting optimization. Added new flag `blocks-storage.bucket-store.lazy-expanded-postings-enabled` and new metrics `cortex_bucket_store_lazy_expanded_postings_total`, `cortex_bucket_store_lazy_expanded_posting_size_bytes_total` and `cortex_bucket_store_lazy_expanded_posting_series_overfetched_size_bytes_total`. #5556.
11+
* [FEATURE] Store Gateway: Added new flag `blocks-storage.bucket-store.series-batch-size` to control how many series to fetch per batch in Store Gateway. #5582.
1112
* [CHANGE] AlertManager: include reason label in cortex_alertmanager_notifications_failed_total.#5409
1213
* [CHANGE] Query: Set CORS Origin headers for Query API #5388
1314
* [CHANGE] Updating prometheus/alertmanager from v0.25.0 to v0.25.1-0.20230505130626-263ca5c9438e. This includes the below changes. #5276

docs/blocks-storage/querier.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,11 @@ blocks_storage:
11111111
# CLI flag: -blocks-storage.bucket-store.lazy-expanded-postings-enabled
11121112
[lazy_expanded_postings_enabled: <boolean> | default = false]
11131113

1114+
# Controls how many series to fetch per batch in Store Gateway. Default
1115+
# value is 10000.
1116+
# CLI flag: -blocks-storage.bucket-store.series-batch-size
1117+
[series_batch_size: <int> | default = 10000]
1118+
11141119
tsdb:
11151120
# Local directory to store TSDBs in the ingesters.
11161121
# CLI flag: -blocks-storage.tsdb.dir

docs/blocks-storage/store-gateway.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,11 @@ blocks_storage:
12181218
# CLI flag: -blocks-storage.bucket-store.lazy-expanded-postings-enabled
12191219
[lazy_expanded_postings_enabled: <boolean> | default = false]
12201220

1221+
# Controls how many series to fetch per batch in Store Gateway. Default
1222+
# value is 10000.
1223+
# CLI flag: -blocks-storage.bucket-store.series-batch-size
1224+
[series_batch_size: <int> | default = 10000]
1225+
12211226
tsdb:
12221227
# Local directory to store TSDBs in the ingesters.
12231228
# CLI flag: -blocks-storage.tsdb.dir

docs/configuration/config-file-reference.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,11 @@ bucket_store:
16571657
# CLI flag: -blocks-storage.bucket-store.lazy-expanded-postings-enabled
16581658
[lazy_expanded_postings_enabled: <boolean> | default = false]
16591659

1660+
# Controls how many series to fetch per batch in Store Gateway. Default value
1661+
# is 10000.
1662+
# CLI flag: -blocks-storage.bucket-store.series-batch-size
1663+
[series_batch_size: <int> | default = 10000]
1664+
16601665
tsdb:
16611666
# Local directory to store TSDBs in the ingesters.
16621667
# CLI flag: -blocks-storage.tsdb.dir

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ require (
5353
github.com/stretchr/testify v1.8.4
5454
github.com/thanos-io/objstore v0.0.0-20230921130928-63a603e651ed
5555
github.com/thanos-io/promql-engine v0.0.0-20230821193351-e1ae4275b96e
56-
github.com/thanos-io/thanos v0.32.4-0.20230926060504-20d29008068f
56+
github.com/thanos-io/thanos v0.32.4-0.20231001083734-531cdb1e8ec3
5757
github.com/uber/jaeger-client-go v2.30.0+incompatible
5858
github.com/weaveworks/common v0.0.0-20221201103051-7c2720a9024d
5959
go.etcd.io/etcd/api/v3 v3.5.9

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,8 @@ github.com/thanos-io/objstore v0.0.0-20230921130928-63a603e651ed h1:iWQdY3S6DpWj
12121212
github.com/thanos-io/objstore v0.0.0-20230921130928-63a603e651ed/go.mod h1:oJ82xgcBDzGJrEgUsjlTj6n01+ZWUMMUR8BlZzX5xDE=
12131213
github.com/thanos-io/promql-engine v0.0.0-20230821193351-e1ae4275b96e h1:kwsFCU8eSkZehbrAN3nXPw5RdMHi/Bok/y8l2C4M+gk=
12141214
github.com/thanos-io/promql-engine v0.0.0-20230821193351-e1ae4275b96e/go.mod h1:+T/ZYNCGybT6eTsGGvVtGb63nT1cvUmH6MjqRrcQoKw=
1215-
github.com/thanos-io/thanos v0.32.4-0.20230926060504-20d29008068f h1:OdZZLgF2eYIiad7h4WeUPkew7Uq6F9vFPg3aDZfMQLY=
1216-
github.com/thanos-io/thanos v0.32.4-0.20230926060504-20d29008068f/go.mod h1:Px5Boq60s+2WwR+V4v4oxgmxfw9WHrwMwjRou6pkUNw=
1215+
github.com/thanos-io/thanos v0.32.4-0.20231001083734-531cdb1e8ec3 h1:ekD3P1XF0Hlg/u7rSNqdyLhwYE4W4RGfkMDudtepRL8=
1216+
github.com/thanos-io/thanos v0.32.4-0.20231001083734-531cdb1e8ec3/go.mod h1:Px5Boq60s+2WwR+V4v4oxgmxfw9WHrwMwjRou6pkUNw=
12171217
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab h1:7ZR3hmisBWw77ZpO1/o86g+JV3VKlk3d48jopJxzTjU=
12181218
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab/go.mod h1:eheTFp954zcWZXCU8d0AT76ftsQOTo4DTqkN/h3k1MY=
12191219
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=

pkg/storage/tsdb/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ type BucketStoreConfig struct {
280280
// On the contrary, smaller value will increase baseline memory usage, but improve latency slightly.
281281
// 1 will keep all in memory. Default value is the same as in Prometheus which gives a good balance.
282282
PostingOffsetsInMemSampling int `yaml:"postings_offsets_in_mem_sampling" doc:"hidden"`
283+
284+
// Controls how many series to fetch per batch in Store Gateway. Default value is 10000.
285+
SeriesBatchSize int `yaml:"series_batch_size"`
283286
}
284287

285288
// RegisterFlags registers the BucketStore flags
@@ -311,6 +314,7 @@ func (cfg *BucketStoreConfig) RegisterFlags(f *flag.FlagSet) {
311314
f.Uint64Var(&cfg.EstimatedMaxSeriesSizeBytes, "blocks-storage.bucket-store.estimated-max-series-size-bytes", store.EstimatedMaxSeriesSize, "Estimated max series size in bytes. Setting a large value might result in over fetching data while a small value might result in data refetch. Default value is 64KB.")
312315
f.Uint64Var(&cfg.EstimatedMaxChunkSizeBytes, "blocks-storage.bucket-store.estimated-max-chunk-size-bytes", store.EstimatedMaxChunkSize, "Estimated max chunk size in bytes. Setting a large value might result in over fetching data while a small value might result in data refetch. Default value is 16KiB.")
313316
f.BoolVar(&cfg.LazyExpandedPostingsEnabled, "blocks-storage.bucket-store.lazy-expanded-postings-enabled", false, "If true, Store Gateway will estimate postings size and try to lazily expand postings if it downloads less data than expanding all postings.")
317+
f.IntVar(&cfg.SeriesBatchSize, "blocks-storage.bucket-store.series-batch-size", store.SeriesBatchSize, "Controls how many series to fetch per batch in Store Gateway. Default value is 10000.")
314318
}
315319

316320
// Validate the config.

pkg/storegateway/bucket_stores.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func (u *BucketStores) getOrCreateStore(userID string) (*store.BucketStore, erro
572572
store.WithIndexCache(u.indexCache),
573573
store.WithQueryGate(u.queryGate),
574574
store.WithChunkPool(u.chunksPool),
575-
store.WithSeriesBatchSize(store.SeriesBatchSize),
575+
store.WithSeriesBatchSize(u.cfg.BucketStore.SeriesBatchSize),
576576
store.WithBlockEstimatedMaxChunkFunc(func(m thanos_metadata.Meta) uint64 {
577577
if m.Thanos.IndexStats.ChunkMaxSize > 0 &&
578578
uint64(m.Thanos.IndexStats.ChunkMaxSize) < u.cfg.BucketStore.EstimatedMaxChunkSizeBytes {

vendor/github.com/thanos-io/thanos/pkg/store/bucket.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/thanos-io/thanos/pkg/store/cache/memcached.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)