Skip to content

Commit 707f2f1

Browse files
authored
[Query-Frontend] Add dynamic query vertical sharding (#6678)
* refactor dynamic query splitting to reduce complexity Signed-off-by: Ahmed Hassan <[email protected]> * add query dynamic vertical sharding Signed-off-by: Ahmed Hassan <[email protected]> * fix unit tests for dynamic vertical sharding Signed-off-by: Ahmed Hassan <[email protected]> * store dynamic vertical shard size in context Signed-off-by: Ahmed Hassan <[email protected]> * refactoring dynamicIntervalFn Signed-off-by: Ahmed Hassan <[email protected]> * add separate vertical sharding tests Signed-off-by: Ahmed Hassan <[email protected]> * fix formatting Signed-off-by: Ahmed Hassan <[email protected]> * add feature flag for dynamic vertical sharding Signed-off-by: Ahmed Hassan <[email protected]> * update doc Signed-off-by: Ahmed Hassan <[email protected]> * rerun tests Signed-off-by: Ahmed Hassan <[email protected]> --------- Signed-off-by: Ahmed Hassan <[email protected]>
1 parent d681d56 commit 707f2f1

File tree

5 files changed

+329
-413
lines changed

5 files changed

+329
-413
lines changed

docs/configuration/config-file-reference.md

+5
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,11 @@ dynamic_query_splits:
43544354
# CLI flag: -querier.max-fetched-data-duration-per-query
43554355
[max_fetched_data_duration_per_query: <duration> | default = 0s]
43564356
4357+
# [EXPERIMENTAL] Dynamically adjust vertical shard size to maximize the total
4358+
# combined number of query shards and splits.
4359+
# CLI flag: -querier.enable-dynamic-vertical-sharding
4360+
[enable_dynamic_vertical_sharding: <boolean> | default = false]
4361+
43574362
# Mutate incoming queries to align their start and end with their step.
43584363
# CLI flag: -querier.align-querier-with-step
43594364
[align_queries_with_step: <boolean> | default = false]

pkg/querier/tripperware/queryrange/query_range_middlewares.go

+2
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ func (cfg *Config) Validate(qCfg querier.Config) error {
8181
type DynamicQuerySplitsConfig struct {
8282
MaxShardsPerQuery int `yaml:"max_shards_per_query"`
8383
MaxFetchedDataDurationPerQuery time.Duration `yaml:"max_fetched_data_duration_per_query"`
84+
EnableDynamicVerticalSharding bool `yaml:"enable_dynamic_vertical_sharding"`
8485
}
8586

8687
// RegisterFlags registers flags foy dynamic query splits
8788
func (cfg *DynamicQuerySplitsConfig) RegisterFlags(f *flag.FlagSet) {
8889
f.IntVar(&cfg.MaxShardsPerQuery, "querier.max-shards-per-query", 0, "[EXPERIMENTAL] Maximum number of shards for a query, 0 disables it. Dynamically uses a multiple of split interval to maintain a total number of shards below the set value. If vertical sharding is enabled for a query, the combined total number of interval splits and vertical shards is kept below this value.")
8990
f.DurationVar(&cfg.MaxFetchedDataDurationPerQuery, "querier.max-fetched-data-duration-per-query", 0, "[EXPERIMENTAL] Max total duration of data fetched from storage by all query shards, 0 disables it. Dynamically uses a multiple of split interval to maintain a total fetched duration of data lower than the value set. It takes into account additional duration fetched by matrix selectors and subqueries.")
91+
f.BoolVar(&cfg.EnableDynamicVerticalSharding, "querier.enable-dynamic-vertical-sharding", false, "[EXPERIMENTAL] Dynamically adjust vertical shard size to maximize the total combined number of query shards and splits.")
9092
}
9193

9294
// Middlewares returns list of middlewares that should be applied for range query.

0 commit comments

Comments
 (0)