Skip to content

Commit a766fb4

Browse files
store-gateway: enable lazy loading concurrency by default (grafana#6004)
* store-gateway: enable lazy loading concurrency by default Lazy loading concurrency has shows good results with slower disks internally at GL, so this PR is enabling it by default. Signed-off-by: Dimitar Dimitrov <[email protected]> * Add CHANGELOG.md entry Signed-off-by: Dimitar Dimitrov <[email protected]> * Update tests Signed-off-by: Dimitar Dimitrov <[email protected]> * Update tests Signed-off-by: Dimitar Dimitrov <[email protected]> --------- Signed-off-by: Dimitar Dimitrov <[email protected]>
1 parent e1d79ee commit a766fb4

File tree

6 files changed

+9
-4
lines changed

6 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Grafana Mimir
66

7+
* [CHANGE] Store-gateway: lazy-loading concurrency limit default value is now 4. #6004
78
* [ENHANCEMENT] Query-scheduler: add `cortex_query_scheduler_enqueue_duration_seconds` metric that records the time taken to enqueue or reject a query request. #5879
89
* [ENHANCEMENT] Query-frontend: add `cortex_query_frontend_enqueue_duration_seconds` metric that records the time taken to enqueue or reject a query request when not using the query-scheduler. #5879
910
* [ENHANCEMENT] Expose `/sync/mutex/wait/total:seconds` Go runtime metric as `go_sync_mutex_wait_total_seconds_total` from all components. #5879

cmd/mimir/config-descriptor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7721,7 +7721,7 @@
77217721
"required": false,
77227722
"desc": "Maximum number of concurrent index header loads across all tenants. If set to 0, concurrency is unlimited.",
77237723
"fieldValue": null,
7724-
"fieldDefaultValue": 0,
7724+
"fieldDefaultValue": 4,
77257725
"fieldFlag": "blocks-storage.bucket-store.index-header.lazy-loading-concurrency",
77267726
"fieldType": "int",
77277727
"fieldCategory": "experimental"

cmd/mimir/help-all.txt.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ Usage of ./cmd/mimir/mimir:
502502
-blocks-storage.bucket-store.index-header.eager-loading-startup-enabled
503503
[experimental] If enabled, store-gateway will periodically persist block IDs of lazy loaded index-headers and load them eagerly during startup. It is not valid to enable this if index-header lazy loading is disabled.
504504
-blocks-storage.bucket-store.index-header.lazy-loading-concurrency int
505-
[experimental] Maximum number of concurrent index header loads across all tenants. If set to 0, concurrency is unlimited.
505+
[experimental] Maximum number of concurrent index header loads across all tenants. If set to 0, concurrency is unlimited. (default 4)
506506
-blocks-storage.bucket-store.index-header.lazy-loading-enabled
507507
If enabled, store-gateway will lazy load an index-header only once required by a query. (default true)
508508
-blocks-storage.bucket-store.index-header.lazy-loading-idle-timeout duration

docs/sources/mimir/references/configuration-parameters/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3492,7 +3492,7 @@ bucket_store:
34923492
# (experimental) Maximum number of concurrent index header loads across all
34933493
# tenants. If set to 0, concurrency is unlimited.
34943494
# CLI flag: -blocks-storage.bucket-store.index-header.lazy-loading-concurrency
3495-
[lazy_loading_concurrency: <int> | default = 0]
3495+
[lazy_loading_concurrency: <int> | default = 4]
34963496
34973497
# (experimental) If enabled, store-gateway will persist a sparse version of
34983498
# the index-header to disk on construction and load sparse index-headers

pkg/storegateway/bucket_stores_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ func TestBucketStores_InitialSync(t *testing.T) {
116116
# HELP cortex_bucket_stores_gate_queries_concurrent_max Number of maximum concurrent queries allowed.
117117
# TYPE cortex_bucket_stores_gate_queries_concurrent_max gauge
118118
cortex_bucket_stores_gate_queries_concurrent_max{gate="query"} 100
119+
cortex_bucket_stores_gate_queries_concurrent_max{gate="index_header"} 4
119120
120121
# HELP cortex_bucket_stores_gate_queries_in_flight Number of queries that are currently in flight.
121122
# TYPE cortex_bucket_stores_gate_queries_in_flight gauge
122123
cortex_bucket_stores_gate_queries_in_flight{gate="query"} 0
124+
cortex_bucket_stores_gate_queries_in_flight{gate="index_header"} 0
123125
`),
124126
"cortex_bucket_store_blocks_loaded",
125127
"cortex_bucket_store_block_loads_total",
@@ -249,10 +251,12 @@ func TestBucketStores_SyncBlocks(t *testing.T) {
249251
# HELP cortex_bucket_stores_gate_queries_concurrent_max Number of maximum concurrent queries allowed.
250252
# TYPE cortex_bucket_stores_gate_queries_concurrent_max gauge
251253
cortex_bucket_stores_gate_queries_concurrent_max{gate="query"} 100
254+
cortex_bucket_stores_gate_queries_concurrent_max{gate="index_header"} 4
252255
253256
# HELP cortex_bucket_stores_gate_queries_in_flight Number of queries that are currently in flight.
254257
# TYPE cortex_bucket_stores_gate_queries_in_flight gauge
255258
cortex_bucket_stores_gate_queries_in_flight{gate="query"} 0
259+
cortex_bucket_stores_gate_queries_in_flight{gate="index_header"} 0
256260
`),
257261
"cortex_bucket_store_blocks_loaded",
258262
"cortex_bucket_store_block_loads_total",

pkg/storegateway/indexheader/header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (cfg *Config) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string) {
8181
f.UintVar(&cfg.MaxIdleFileHandles, prefix+"max-idle-file-handles", 1, "Maximum number of idle file handles the store-gateway keeps open for each index-header file.")
8282
f.BoolVar(&cfg.LazyLoadingEnabled, prefix+"lazy-loading-enabled", DefaultIndexHeaderLazyLoadingEnabled, "If enabled, store-gateway will lazy load an index-header only once required by a query.")
8383
f.DurationVar(&cfg.LazyLoadingIdleTimeout, prefix+"lazy-loading-idle-timeout", DefaultIndexHeaderLazyLoadingIdleTimeout, "If index-header lazy loading is enabled and this setting is > 0, the store-gateway will offload unused index-headers after 'idle timeout' inactivity.")
84-
f.IntVar(&cfg.LazyLoadingConcurrency, prefix+"lazy-loading-concurrency", 0, "Maximum number of concurrent index header loads across all tenants. If set to 0, concurrency is unlimited.")
84+
f.IntVar(&cfg.LazyLoadingConcurrency, prefix+"lazy-loading-concurrency", 4, "Maximum number of concurrent index header loads across all tenants. If set to 0, concurrency is unlimited.")
8585
f.BoolVar(&cfg.EagerLoadingStartupEnabled, prefix+"eager-loading-startup-enabled", false, "If enabled, store-gateway will periodically persist block IDs of lazy loaded index-headers and load them eagerly during startup. It is not valid to enable this if index-header lazy loading is disabled.")
8686
f.BoolVar(&cfg.SparsePersistenceEnabled, prefix+"sparse-persistence-enabled", false, "If enabled, store-gateway will persist a sparse version of the index-header to disk on construction and load sparse index-headers from disk instead of the whole index-header.")
8787
f.BoolVar(&cfg.VerifyOnLoad, prefix+"verify-on-load", false, "If true, verify the checksum of index headers upon loading them (either on startup or lazily when lazy loading is enabled). Setting to true helps detect disk corruption at the cost of slowing down index header loading.")

0 commit comments

Comments
 (0)