Skip to content

Commit

Permalink
Add distributor.shard-by-all-labels to Deprecated flag
Browse files Browse the repository at this point in the history
Signed-off-by: tesla59 <[email protected]>
  • Loading branch information
tesla59 committed Jun 17, 2024
1 parent e75d171 commit f4693b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
10 changes: 0 additions & 10 deletions docs/configuration/arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ The next three options only apply when the querier is used together with the Que

## Distributor

- `-distributor.shard-by-all-labels` (Deprecated and removed)

In the original Cortex design, samples were sharded amongst distributors by the combination of (userid, metric name). Sharding by metric name was designed to reduce the number of ingesters you need to hit on the read path; the downside was that you could hotspot the write path.

Sharding by all labels is now the default behavior to improve load balancing and support for very high cardinality metrics. This ensures that writes are distributed more evenly across ingesters, which is more important than optimizing for reads, as ingester reads are in-memory and cheap.

Upgrade notes: Cortex now always shards by all labels, ensuring better load balancing among ingesters. There is no need for any specific upgrade steps, as this is the default behavior.

Warning: The -distributor.shard-by-all-labels flag has been removed, as disabling sharding by all labels can lead to an imbalanced distribution of load among the ingesters, which is undesirable.

- `-distributor.extra-query-delay`
This is used by a component with an embedded distributor (Querier and Ruler) to control how long to wait until sending more than the minimum amount of queries needed for a successful response.

Expand Down
3 changes: 3 additions & 0 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/cortexproject/cortex/pkg/tenant"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/extract"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/limiter"
util_log "github.com/cortexproject/cortex/pkg/util/log"
util_math "github.com/cortexproject/cortex/pkg/util/math"
Expand Down Expand Up @@ -186,6 +187,8 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {

f.Float64Var(&cfg.InstanceLimits.MaxIngestionRate, "distributor.instance-limits.max-ingestion-rate", 0, "Max ingestion rate (samples/sec) that this distributor will accept. This limit is per-distributor, not per-tenant. Additional push requests will be rejected. Current ingestion rate is computed as exponentially weighted moving average, updated every second. 0 = unlimited.")
f.IntVar(&cfg.InstanceLimits.MaxInflightPushRequests, "distributor.instance-limits.max-inflight-push-requests", 0, "Max inflight push requests that this distributor can handle. This limit is per-distributor, not per-tenant. Additional requests will be rejected. 0 = unlimited.")

flagext.DeprecatedFlag(f, "distributor.shard-by-all-labels", "Deprecated: This should be enabled because disabling it can produces imbalanced ingesters, which is never desirable", util_log.Logger)
}

// Validate config and returns error on failure
Expand Down

0 comments on commit f4693b7

Please sign in to comment.