Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prioritize-query-components flag #9703

Merged
merged 6 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
* `-memberlist.acquire-writer-timeout`
* [ENHANCEMENT] memberlist: Notifications can now be processed once per interval specified by `-memberlist.notify-interval` to reduce notify storm CPU activity in large clusters. #9594
* [ENHANCEMENT] Return server-side total bytes processed statistics as a header through query frontend. #9645
* [ENHANCEMENT] Query-scheduler: Remove the experimental `query-scheduler.prioritize-query-components` flag. Request queues always prioritize query component dequeuing above tenant fairness. #9703
* [BUGFIX] Fix issue where functions such as `rate()` over native histograms could return incorrect values if a float stale marker was present in the selected range. #9508
* [BUGFIX] Fix issue where negation of native histograms (eg. `-some_native_histogram_series`) did nothing. #9508
* [BUGFIX] Fix issue where `metric might not be a counter, name does not end in _total/_sum/_count/_bucket` annotation would be emitted even if `rate` or `increase` did not have enough samples to compute a result. #9508
Expand Down
11 changes: 0 additions & 11 deletions cmd/mimir/config-descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -16385,17 +16385,6 @@
"fieldFlag": "query-scheduler.max-outstanding-requests-per-tenant",
"fieldType": "int"
},
{
"kind": "field",
"name": "prioritize_query_components",
"required": false,
"desc": "When enabled, the query scheduler primarily prioritizes dequeuing fairly from queue components and secondarily prioritizes dequeuing fairly across tenants. When disabled, the query scheduler primarily prioritizes tenant fairness.",
"fieldValue": null,
"fieldDefaultValue": false,
"fieldFlag": "query-scheduler.prioritize-query-components",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "querier_forget_delay",
Expand Down
2 changes: 0 additions & 2 deletions cmd/mimir/help-all.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2315,8 +2315,6 @@ Usage of ./cmd/mimir/mimir:
Maximum number of outstanding requests per tenant per query-scheduler. In-flight requests above this limit will fail with HTTP response status code 429. (default 100)
-query-scheduler.max-used-instances int
The maximum number of query-scheduler instances to use, regardless how many replicas are running. This option can be set only when -query-scheduler.service-discovery-mode is set to 'ring'. 0 to use all available query-scheduler instances.
-query-scheduler.prioritize-query-components
[experimental] When enabled, the query scheduler primarily prioritizes dequeuing fairly from queue components and secondarily prioritizes dequeuing fairly across tenants. When disabled, the query scheduler primarily prioritizes tenant fairness.
-query-scheduler.querier-forget-delay duration
[experimental] If a querier disconnects without sending notification about graceful shutdown, the query-scheduler will keep the querier in the tenant's shard until the forget delay has passed. This feature is useful to reduce the blast radius when shuffle-sharding is enabled.
-query-scheduler.ring.consul.acl-token string
Expand Down
1 change: 0 additions & 1 deletion development/mimir-microservices-mode/config/mimir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ querier:
query_scheduler:
# Change to "dns" to switch to query-scheduler DNS-based service discovery.
service_discovery_mode: "ring"
prioritize_query_components: true

limits:
# Limit max query time range to 31d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1718,13 +1718,6 @@ The `query_scheduler` block configures the query-scheduler.
# CLI flag: -query-scheduler.max-outstanding-requests-per-tenant
[max_outstanding_requests_per_tenant: <int> | default = 100]

# (experimental) When enabled, the query scheduler primarily prioritizes
# dequeuing fairly from queue components and secondarily prioritizes dequeuing
# fairly across tenants. When disabled, the query scheduler primarily
# prioritizes tenant fairness.
# CLI flag: -query-scheduler.prioritize-query-components
[prioritize_query_components: <boolean> | default = false]

# (experimental) If a querier disconnects without sending notification about
# graceful shutdown, the query-scheduler will keep the querier in the tenant's
# shard until the forget delay has passed. This feature is useful to reduce the
Expand Down
1 change: 0 additions & 1 deletion pkg/frontend/v1/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func New(cfg Config, limits Limits, log log.Logger, registerer prometheus.Regist
f.requestQueue, err = queue.NewRequestQueue(
log,
cfg.MaxOutstandingPerTenant,
false, //prioritizeQueryComponents -- currently no-op
cfg.QuerierForgetDelay,
f.queueLength,
f.discardedRequests,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,9 @@ func TestMultiDimensionalQueueAlgorithmSlowConsumerEffects(t *testing.T) {
for _, weightedQueueDimensionTestCase := range weightedQueueDimensionTestCases {
numTenants := len(weightedQueueDimensionTestCase.tenantQueueDimensionsWeights)

tqaNonFlipped := tree.NewTenantQuerierQueuingAlgorithm()
tqaFlipped := tree.NewTenantQuerierQueuingAlgorithm()
tqaQuerierWorkerPrioritization := tree.NewTenantQuerierQueuingAlgorithm()

nonFlippedRoundRobinTree, err := tree.NewTree(tqaNonFlipped, tree.NewRoundRobinState())
require.NoError(t, err)

flippedRoundRobinTree, err := tree.NewTree(tree.NewRoundRobinState(), tqaFlipped)
require.NoError(t, err)

Expand All @@ -396,11 +392,6 @@ func TestMultiDimensionalQueueAlgorithmSlowConsumerEffects(t *testing.T) {
tqa *tree.TenantQuerierQueuingAlgorithm
}{
// keeping these names the same length keeps logged results aligned
{
"tenant-querier -> query component round-robin tree",
nonFlippedRoundRobinTree,
tqaNonFlipped,
},
{
"query component round-robin -> tenant-querier tree",
flippedRoundRobinTree,
Expand All @@ -424,14 +415,10 @@ func TestMultiDimensionalQueueAlgorithmSlowConsumerEffects(t *testing.T) {
queryComponentQueueDurationObservations: map[string][]float64{},
}

// only the non-flipped tree uses the old tenant -> query component hierarchy
prioritizeQueryComponents := scenario.tree != nonFlippedRoundRobinTree

t.Run(testCaseName, func(t *testing.T) {
queue, err := NewRequestQueue(
log.NewNopLogger(),
maxOutStandingPerTenant,
prioritizeQueryComponents,
querierForgetDelay,
promauto.With(nil).NewGaugeVec(prometheus.GaugeOpts{}, []string{"user"}),
promauto.With(nil).NewCounterVec(prometheus.CounterOpts{}, []string{"user"}),
Expand All @@ -447,7 +434,6 @@ func TestMultiDimensionalQueueAlgorithmSlowConsumerEffects(t *testing.T) {
tenantsByID: make(map[string]*queueTenant),
queuingAlgorithm: scenario.tqa,
}
queue.queueBroker.prioritizeQueryComponents = prioritizeQueryComponents
queue.queueBroker.tree = scenario.tree

ctx := context.Background()
Expand Down
3 changes: 1 addition & 2 deletions pkg/scheduler/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ type requestToEnqueue struct {
func NewRequestQueue(
log log.Logger,
maxOutstandingPerTenant int,
prioritizeQueryComponents bool,
forgetDelay time.Duration,
queueLength *prometheus.GaugeVec,
discardedRequests *prometheus.CounterVec,
Expand Down Expand Up @@ -246,7 +245,7 @@ func NewRequestQueue(
waitingDequeueRequestsToDispatch: list.New(),

QueryComponentUtilization: queryComponentCapacity,
queueBroker: newQueueBroker(maxOutstandingPerTenant, prioritizeQueryComponents, forgetDelay),
queueBroker: newQueueBroker(maxOutstandingPerTenant, forgetDelay),
}

q.Service = services.NewBasicService(q.starting, q.running, q.stop).WithName("request queue")
Expand Down
33 changes: 9 additions & 24 deletions pkg/scheduler/queue/queue_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,20 @@ type queueBroker struct {
tenantQuerierAssignments *tenantQuerierShards
querierConnections *querierConnections

maxTenantQueueSize int
prioritizeQueryComponents bool
maxTenantQueueSize int
}

func newQueueBroker(
maxTenantQueueSize int,
prioritizeQueryComponents bool,
forgetDelay time.Duration,
) *queueBroker {
qc := newQuerierConnections(forgetDelay)
tqas := newTenantQuerierAssignments()
var treeQueue tree.Tree
var err error
var algos []tree.QueuingAlgorithm
if prioritizeQueryComponents {
algos = []tree.QueuingAlgorithm{
tree.NewQuerierWorkerQueuePriorityAlgo(), // root; algorithm selects query component based on worker ID
tqas.queuingAlgorithm, // query components; algorithm selects tenants

}
} else {
algos = []tree.QueuingAlgorithm{
tqas.queuingAlgorithm, // root; algorithm selects tenants
tree.NewRoundRobinState(), // tenant queues; algorithm selects query component
}
algos := []tree.QueuingAlgorithm{
tree.NewQuerierWorkerQueuePriorityAlgo(), // root; algorithm selects query component based on worker ID
tqas.queuingAlgorithm, // query components; algorithm selects tenants
}
treeQueue, err = tree.NewTree(algos...)

Expand All @@ -66,11 +55,10 @@ func newQueueBroker(
panic(fmt.Sprintf("error creating the tree queue: %v", err))
}
qb := &queueBroker{
tree: treeQueue,
querierConnections: qc,
tenantQuerierAssignments: tqas,
maxTenantQueueSize: maxTenantQueueSize,
prioritizeQueryComponents: prioritizeQueryComponents,
tree: treeQueue,
querierConnections: qc,
tenantQuerierAssignments: tqas,
maxTenantQueueSize: maxTenantQueueSize,
}

return qb
Expand Down Expand Up @@ -128,10 +116,7 @@ func (qb *queueBroker) makeQueuePath(request *tenantRequest) (tree.QueuePath, er
if schedulerRequest, ok := request.req.(*SchedulerRequest); ok {
queryComponent = schedulerRequest.ExpectedQueryComponentName()
}
if qb.prioritizeQueryComponents {
return append([]string{queryComponent}, request.tenantID), nil
}
return append(tree.QueuePath{request.tenantID}, queryComponent), nil
return append([]string{queryComponent}, request.tenantID), nil
}

func (qb *queueBroker) dequeueRequestForQuerier(
Expand Down
Loading
Loading