Skip to content

Commit 0e6241d

Browse files
authored
chore: query-frontend: default to active series sharding (#15091)
Remove experimental settings for enabling/disabling active series sharding and use of a zero-allocation decoder. These have been enabled in Grafana Cloud for a over a year, they're not experimental anymore.
1 parent cf3e8f8 commit 0e6241d

10 files changed

Lines changed: 38 additions & 324 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* [CHANGE] Query-frontend: Removed support for calculating 'cache-adjusted samples processed' query statistic. The `-query-frontend.cache-samples-processed-stats` CLI flag has been deprecated and will be removed in a future release. Setting it has now no effect. #13582
2525
* [CHANGE] Querier: Renamed experimental flag `-querier.prefer-availability-zone` to `-querier.prefer-availability-zones` and changed it to accept a comma-separated list of availability zones. All zones in the list are given equal priority when querying ingesters and store-gateways. #13756 #13758
2626
* [CHANGE] Ingester: Stabilize experimental flag `-ingest-storage.write-logs-fsync-before-kafka-commit-concurrency` to fsync write logs before the offset is committed to Kafka. Remove `-ingest-storage.write-logs-fsync-before-kafka-commit-enabled` since this is always enabled now. #13591
27+
* [CHANGE] Query-frontend: Remove experimental flags `-query-frontend.shard-active-series-queries`, `-query-frontend.use-active-series-decoder`. These settings are always enabled now. #15091
2728
* [CHANGE] Ingester: Remove metric `cortex_ingester_owned_target_info_series`; if needed this is better done as a custom active series tracker. #13831
2829
* [CHANGE] Querier: Remove experimental flag `-querier.response-streaming-enabled`, active series responses are now always streamed to query-frontends. #14095 #14114
2930
* [CHANGE] Store-gateway: Warn when loading index headers based on TSDB blocks that use v1 of the index file format. #13834

cmd/mimir/config-descriptor.json

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8660,28 +8660,6 @@
86608660
"fieldType": "int",
86618661
"fieldCategory": "advanced"
86628662
},
8663-
{
8664-
"kind": "field",
8665-
"name": "shard_active_series_queries",
8666-
"required": false,
8667-
"desc": "True to enable sharding of active series queries.",
8668-
"fieldValue": null,
8669-
"fieldDefaultValue": false,
8670-
"fieldFlag": "query-frontend.shard-active-series-queries",
8671-
"fieldType": "boolean",
8672-
"fieldCategory": "experimental"
8673-
},
8674-
{
8675-
"kind": "field",
8676-
"name": "use_active_series_decoder",
8677-
"required": false,
8678-
"desc": "Set to true to use the zero-allocation response decoder for active series queries.",
8679-
"fieldValue": null,
8680-
"fieldDefaultValue": false,
8681-
"fieldFlag": "query-frontend.use-active-series-decoder",
8682-
"fieldType": "boolean",
8683-
"fieldCategory": "experimental"
8684-
},
86858663
{
86868664
"kind": "field",
86878665
"name": "extra_propagated_headers",

cmd/mimir/help-all.txt.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,14 +2655,10 @@ Usage of ./cmd/mimir/mimir:
26552655
How often to resolve the scheduler-address, in order to look for new query-scheduler instances. (default 10s)
26562656
-query-frontend.scheduler-worker-concurrency int
26572657
Number of concurrent workers forwarding queries to single query-scheduler. (default 5)
2658-
-query-frontend.shard-active-series-queries
2659-
[experimental] True to enable sharding of active series queries.
26602658
-query-frontend.split-queries-by-interval duration
26612659
Split range queries by an interval and execute in parallel. You should use a multiple of 24 hours to optimize querying blocks. 0 to disable it. (default 24h0m0s)
26622660
-query-frontend.subquery-spin-off-enabled
26632661
[experimental] Enable spinning off subqueries from instant queries as range queries to optimize their performance.
2664-
-query-frontend.use-active-series-decoder
2665-
[experimental] Set to true to use the zero-allocation response decoder for active series queries.
26662662
-query-frontend.use-mimir-query-engine-for-sharding
26672663
[experimental] Set to true to enable performing query sharding inside the Mimir query engine (MQE). This setting has no effect if sharding is disabled. Requires remote execution and MQE to be enabled.
26682664
-query-scheduler.grpc-client-config.backoff-max-period duration

development/mimir-microservices-mode/config/mimir.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ frontend:
149149
parallelize_shardable_queries: true
150150
cache_results: true
151151
cache_errors: true
152-
shard_active_series_queries: true
153152

154153
# Uncomment when using "dns" service discovery mode for query-scheduler.
155154
# scheduler_address: "query-scheduler:9008"

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,15 +2258,6 @@ results_cache:
22582258
# CLI flag: -query-frontend.query-sharding-target-series-per-shard
22592259
[query_sharding_target_series_per_shard: <int> | default = 0]
22602260

2261-
# (experimental) True to enable sharding of active series queries.
2262-
# CLI flag: -query-frontend.shard-active-series-queries
2263-
[shard_active_series_queries: <boolean> | default = false]
2264-
2265-
# (experimental) Set to true to use the zero-allocation response decoder for
2266-
# active series queries.
2267-
# CLI flag: -query-frontend.use-active-series-decoder
2268-
[use_active_series_decoder: <boolean> | default = false]
2269-
22702261
# (advanced) Comma-separated list of request header names to allow to pass
22712262
# through to the rest of the query path. This is in addition to a list of
22722263
# required headers that the read path needs.

integration/query_frontend_active_series_test.go

Lines changed: 25 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package integration
44

55
import (
6-
"fmt"
76
"net/http"
87
"strconv"
98
"testing"
@@ -21,43 +20,32 @@ import (
2120
)
2221

2322
func TestActiveSeriesWithQuerySharding(t *testing.T) {
24-
for _, tc := range []struct {
25-
shardingEnabled bool
26-
}{
27-
{false},
28-
{true},
29-
} {
30-
config := queryFrontendTestConfig{
31-
queryStatsEnabled: true,
32-
shardActiveSeriesQueries: tc.shardingEnabled,
33-
querySchedulerDiscoveryMode: "ring",
34-
setup: func(t *testing.T, s *e2e.Scenario) (string, map[string]string) {
35-
flags := mergeFlags(BlocksStorageFlags(), BlocksStorageS3Flags())
36-
minio := e2edb.NewMinio(9000, flags["-blocks-storage.s3.bucket-name"])
37-
require.NoError(t, s.StartAndWaitReady(minio))
38-
39-
return "", flags
40-
},
41-
}
23+
config := queryFrontendTestConfig{
24+
queryStatsEnabled: true,
25+
querySchedulerDiscoveryMode: "ring",
26+
setup: func(t *testing.T, s *e2e.Scenario) (string, map[string]string) {
27+
flags := mergeFlags(BlocksStorageFlags(), BlocksStorageS3Flags())
28+
minio := e2edb.NewMinio(9000, flags["-blocks-storage.s3.bucket-name"])
29+
require.NoError(t, s.StartAndWaitReady(minio))
30+
31+
return "", flags
32+
},
33+
}
4234

43-
testName := fmt.Sprintf("query query_sharding=%v",
44-
tc.shardingEnabled,
45-
)
46-
t.Run("active series/"+testName, func(t *testing.T) {
47-
runTestActiveSeriesWithQueryShardingHTTPTest(t, config)
48-
})
35+
t.Run("active series", func(t *testing.T) {
36+
runTestActiveSeriesHTTPTest(t, config)
37+
})
4938

50-
t.Run("active native histograms/"+testName, func(t *testing.T) {
51-
runTestActiveNativeHistogramMetricsWithQueryShardingHTTPTest(t, config)
52-
})
53-
}
39+
t.Run("active native histograms", func(t *testing.T) {
40+
runTestActiveNativeHistogramMetricsHTTPTest(t, config)
41+
})
5442
}
5543

5644
const (
5745
metricName = "test_metric"
5846
)
5947

60-
func runTestActiveSeriesWithQueryShardingHTTPTest(t *testing.T, cfg queryFrontendTestConfig) {
48+
func runTestActiveSeriesHTTPTest(t *testing.T, cfg queryFrontendTestConfig) {
6149
numSeries := 100
6250
s, c := setupComponentsForActiveSeriesTest(t, cfg, numSeries)
6351
defer s.Close()
@@ -76,17 +64,12 @@ func runTestActiveSeriesWithQueryShardingHTTPTest(t *testing.T, cfg queryFronten
7664
require.Len(t, response.Data, numSeries)
7765
}
7866

79-
var err error
80-
_, err = c.ActiveSeries(metricName, e2emimir.WithQueryShards(512))
81-
if cfg.shardActiveSeriesQueries {
82-
require.Error(t, err)
83-
require.Contains(t, err.Error(), "shard count 512 exceeds allowed maximum (128)")
84-
} else {
85-
require.NoError(t, err)
86-
}
67+
_, err := c.ActiveSeries(metricName, e2emimir.WithQueryShards(512))
68+
require.Error(t, err)
69+
require.Contains(t, err.Error(), "shard count 512 exceeds allowed maximum (128)")
8770
}
8871

89-
func runTestActiveNativeHistogramMetricsWithQueryShardingHTTPTest(t *testing.T, cfg queryFrontendTestConfig) {
72+
func runTestActiveNativeHistogramMetricsHTTPTest(t *testing.T, cfg queryFrontendTestConfig) {
9073
numSeries := 100
9174
s, c := setupComponentsForActiveSeriesTest(t, cfg, numSeries)
9275
defer s.Close()
@@ -113,14 +96,9 @@ func runTestActiveNativeHistogramMetricsWithQueryShardingHTTPTest(t *testing.T,
11396
})
11497
}
11598

116-
var err error
117-
_, err = c.ActiveNativeHistogramMetrics(metricName, e2emimir.WithQueryShards(512))
118-
if cfg.shardActiveSeriesQueries {
119-
require.Error(t, err)
120-
require.Contains(t, err.Error(), "shard count 512 exceeds allowed maximum (128)")
121-
} else {
122-
require.NoError(t, err)
123-
}
99+
_, err := c.ActiveNativeHistogramMetrics(metricName, e2emimir.WithQueryShards(512))
100+
require.Error(t, err)
101+
require.Contains(t, err.Error(), "shard count 512 exceeds allowed maximum (128)")
124102
}
125103

126104
func setupComponentsForActiveSeriesTest(t *testing.T, cfg queryFrontendTestConfig, numSeries int) (*e2e.Scenario, *e2emimir.Client) {
@@ -160,10 +138,6 @@ func setupComponentsForActiveSeriesTest(t *testing.T, cfg queryFrontendTestConfi
160138
flags["-querier.scheduler-address"] = queryScheduler.NetworkGRPCEndpoint()
161139
}
162140

163-
if cfg.shardActiveSeriesQueries {
164-
flags["-query-frontend.shard-active-series-queries"] = "true"
165-
}
166-
167141
// Start the query-frontend.
168142
queryFrontend := e2emimir.NewQueryFrontend("query-frontend", consul.NetworkHTTPEndpoint(), flags, e2emimir.WithConfigFile(configFile))
169143
require.NoError(t, s.Start(queryFrontend))

integration/query_frontend_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ type queryFrontendTestConfig struct {
4141
queryStatsEnabled bool
4242
setup func(t *testing.T, s *e2e.Scenario) (configFile string, flags map[string]string)
4343
withHistograms bool
44-
shardActiveSeriesQueries bool
4544
remoteExecutionEnabled bool
4645
}
4746

pkg/frontend/querymiddleware/roundtrip.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ type Config struct {
7373
RewriteQueriesHistogram bool `yaml:"rewrite_histogram_queries" category:"experimental"`
7474
RewriteQueriesPropagateMatchers bool `yaml:"rewrite_propagate_matchers" category:"experimental"`
7575
TargetSeriesPerShard uint64 `yaml:"query_sharding_target_series_per_shard" category:"advanced"`
76-
ShardActiveSeriesQueries bool `yaml:"shard_active_series_queries" category:"experimental"`
77-
UseActiveSeriesDecoder bool `yaml:"use_active_series_decoder" category:"experimental"`
7876

7977
// CacheKeyGenerator allows to inject a CacheKeyGenerator to use for generating cache keys.
8078
// If nil, the querymiddleware package uses a DefaultCacheKeyGenerator with SplitQueriesByInterval.
@@ -114,8 +112,6 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
114112
f.Uint64Var(&cfg.TargetSeriesPerShard, "query-frontend.query-sharding-target-series-per-shard", 0, "How many series a single sharded partial query should load at most. This is not a strict requirement guaranteed to be honoured by query sharding, but a hint given to the query sharding when the query execution is initially planned. 0 to disable cardinality-based hints.")
115113
f.Var(&cfg.ExtraPropagateHeaders, "query-frontend.extra-propagated-headers", "Comma-separated list of request header names to allow to pass through to the rest of the query path. This is in addition to a list of required headers that the read path needs.")
116114
f.StringVar(&cfg.QueryResultResponseFormat, "query-frontend.query-result-response-format", formatProtobuf, fmt.Sprintf("Format to use when retrieving query results from queriers. Supported values: %s", strings.Join(allFormats, ", ")))
117-
f.BoolVar(&cfg.ShardActiveSeriesQueries, "query-frontend.shard-active-series-queries", false, "True to enable sharding of active series queries.")
118-
f.BoolVar(&cfg.UseActiveSeriesDecoder, "query-frontend.use-active-series-decoder", false, "Set to true to use the zero-allocation response decoder for active series queries.")
119115
f.BoolVar(&cfg.CacheSamplesProcessedStats, "query-frontend.cache-samples-processed-stats", false, "Cache statistics of processed samples on results cache. Deprecated: has no effect.")
120116
cfg.ResultsCache.RegisterFlags(f)
121117

@@ -332,10 +328,9 @@ func newQueryTripperware(
332328
activeSeries = newRetryRoundTripper(series, log, cfg.MaxRetries, retryMetrics)
333329
}
334330

335-
if cfg.ShardActiveSeriesQueries {
336-
activeSeries = newShardActiveSeriesMiddleware(activeSeries, cfg.UseActiveSeriesDecoder, limits, log)
337-
activeNativeHistogramMetrics = newShardActiveNativeHistogramMetricsMiddleware(activeNativeHistogramMetrics, limits, log)
338-
}
331+
// Shard active series requests using special middleware.
332+
activeSeries = newShardActiveSeriesMiddleware(activeSeries, limits, log)
333+
activeNativeHistogramMetrics = newShardActiveNativeHistogramMetricsMiddleware(activeNativeHistogramMetrics, limits, log)
339334

340335
// Enforce read consistency after caching.
341336
if len(ingestStorageTopicOffsetsReaders) > 0 {

0 commit comments

Comments
 (0)