Skip to content

Commit ca2c4ce

Browse files
committed
Saner defaults for configs
Signed-off-by: Goutham Veeramachaneni <[email protected]>
1 parent 12b15b9 commit ca2c4ce

File tree

8 files changed

+22
-12
lines changed

8 files changed

+22
-12
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@
4242
* [CHANGE] Frontend worker in querier now starts after all Querier module dependencies are started. This fixes issue where frontend worker started to send queries to querier before it was ready to serve them (mostly visible when using experimental blocks storage). #2246
4343
* [CHANGE] Lifecycler component now enters Failed state on errors, and doesn't exit the process. (Important if you're vendoring Cortex and use Lifecycler) #2251
4444
* [CHANGE] `/ready` handler now returns 200 instead of 204. #2330
45+
* [CHANGE] Better defaults for the following options:
46+
- `-<prefix>.consul.consistent-reads`: Old default: `true`, new default: `false`. This reduces the load on Consul.
47+
- `-<prefix>.consul.watch-rate-limit`: Old default: 0, new default: 1. This rate limits the reads to 1 per second. Which is good enough for ring watches.
48+
- `-distributor.health-check-ingesters`: Old default: `false`, new default: `true`.
49+
- `-ingester.max-stale-chunk-idle`: Old default: 0, new default: 2m. This lets us expire series that we know are stale early.
50+
- `-ingester.num-tokens`: Old default: 128, new default: 128. This allows for better load distribution in large clusters.
51+
- `-ingester.spread-flushes`: Old default: false, new default: true. This allows to better de-duplicate data and use less space.
52+
- `-<prefix>.memcached.batchsize`: Old default: 0, new default: 1024. This allows batching of requests and keeps the concurrent requests low.
53+
- `-<prefix>.memcached.consistent-hash`: Old default: false, new default: true. This allows for better cache hits when the memcaches are scaled up and down.
54+
- `-querier.batch-iterators`: Old default: false, new default: true.
4555
* [FEATURE] Added experimental storage API to the ruler service that is enabled when the `-experimental.ruler.enable-api` is set to true #2269
4656
* `-ruler.storage.type` flag now allows `s3`,`gcs`, and `azure` values
4757
* `-ruler.storage.(s3|gcs|azure)` flags exist to allow the configuration of object clients set for rule storage

docs/configuration/config-file-reference.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pool:
312312
313313
# Run a health check on each ingester client during periodic cleanup.
314314
# CLI flag: -distributor.health-check-ingesters
315-
[health_check_ingesters: <boolean> | default = false]
315+
[health_check_ingesters: <boolean> | default = true]
316316
317317
ha_tracker:
318318
# Enable the distributors HA tracker so that it can accept samples from
@@ -505,7 +505,7 @@ lifecycler:
505505
506506
# Number of tokens for each ingester.
507507
# CLI flag: -ingester.num-tokens
508-
[num_tokens: <int> | default = 128]
508+
[num_tokens: <int> | default = 512]
509509
510510
# Period at which to heartbeat to consul.
511511
# CLI flag: -ingester.heartbeat-period
@@ -560,7 +560,7 @@ lifecycler:
560560
# flushing. 0 disables it and a stale series is not flushed until the
561561
# max-chunk-idle timeout is reached.
562562
# CLI flag: -ingester.max-stale-chunk-idle
563-
[max_stale_chunk_idle_time: <duration> | default = 0s]
563+
[max_stale_chunk_idle_time: <duration> | default = 2m0s]
564564
565565
# Timeout for individual flush operations.
566566
# CLI flag: -ingester.flush-op-timeout
@@ -609,7 +609,7 @@ The `querier_config` configures the Cortex querier.
609609
# Use batch iterators to execute query, as opposed to fully materialising the
610610
# series in memory. Takes precedent over the -querier.iterators flag.
611611
# CLI flag: -querier.batch-iterators
612-
[batch_iterators: <boolean> | default = false]
612+
[batch_iterators: <boolean> | default = true]
613613
614614
# Use streaming RPCs to query ingester.
615615
# CLI flag: -querier.ingester-streaming
@@ -1927,7 +1927,7 @@ The `consul_config` configures the consul client. The supported CLI flags `<pref
19271927
19281928
# Enable consistent reads to Consul.
19291929
# CLI flag: -<prefix>.consul.consistent-reads
1930-
[consistent_reads: <boolean> | default = true]
1930+
[consistent_reads: <boolean> | default = false]
19311931
19321932
# Rate limit when watching key or prefix in Consul, in requests per second. 0
19331933
# disables the rate limit.
@@ -2251,7 +2251,7 @@ The `memcached_client_config` configures the client used to connect to Memcached
22512251
22522252
# Use consistent hashing to distribute to memcache servers.
22532253
# CLI flag: -<prefix>.memcached.consistent-hash
2254-
[consistent_hash: <boolean> | default = false]
2254+
[consistent_hash: <boolean> | default = true]
22552255
```
22562256

22572257
### `fifo_cache_config`

pkg/chunk/cache/memcached_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (cfg *MemcachedClientConfig) RegisterFlagsWithPrefix(prefix, description st
7575
f.IntVar(&cfg.MaxIdleConns, prefix+"memcached.max-idle-conns", 16, description+"Maximum number of idle connections in pool.")
7676
f.DurationVar(&cfg.Timeout, prefix+"memcached.timeout", 100*time.Millisecond, description+"Maximum time to wait before giving up on memcached requests.")
7777
f.DurationVar(&cfg.UpdateInterval, prefix+"memcached.update-interval", 1*time.Minute, description+"Period with which to poll DNS for memcache servers.")
78-
f.BoolVar(&cfg.ConsistentHash, prefix+"memcached.consistent-hash", false, description+"Use consistent hashing to distribute to memcache servers.")
78+
f.BoolVar(&cfg.ConsistentHash, prefix+"memcached.consistent-hash", true, description+"Use consistent hashing to distribute to memcache servers.")
7979
}
8080

8181
// NewMemcachedClient creates a new MemcacheClient that gets its server list

pkg/ingester/client/pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type PoolConfig struct {
3939
// RegisterFlags adds the flags required to config this to the given FlagSet.
4040
func (cfg *PoolConfig) RegisterFlags(f *flag.FlagSet) {
4141
f.DurationVar(&cfg.ClientCleanupPeriod, "distributor.client-cleanup-period", 15*time.Second, "How frequently to clean up clients for ingesters that have gone away.")
42-
f.BoolVar(&cfg.HealthCheckIngesters, "distributor.health-check-ingesters", false, "Run a health check on each ingester client during periodic cleanup.")
42+
f.BoolVar(&cfg.HealthCheckIngesters, "distributor.health-check-ingesters", true, "Run a health check on each ingester client during periodic cleanup.")
4343
}
4444

4545
// Pool holds a cache of grpc_health_v1 clients.

pkg/ingester/ingester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
8282
f.DurationVar(&cfg.RetainPeriod, "ingester.retain-period", 5*time.Minute, "Period chunks will remain in memory after flushing.")
8383
f.DurationVar(&cfg.FlushOpTimeout, "ingester.flush-op-timeout", 1*time.Minute, "Timeout for individual flush operations.")
8484
f.DurationVar(&cfg.MaxChunkIdle, "ingester.max-chunk-idle", 5*time.Minute, "Maximum chunk idle time before flushing.")
85-
f.DurationVar(&cfg.MaxStaleChunkIdle, "ingester.max-stale-chunk-idle", 0, "Maximum chunk idle time for chunks terminating in stale markers before flushing. 0 disables it and a stale series is not flushed until the max-chunk-idle timeout is reached.")
85+
f.DurationVar(&cfg.MaxStaleChunkIdle, "ingester.max-stale-chunk-idle", 2*time.Minute, "Maximum chunk idle time for chunks terminating in stale markers before flushing. 0 disables it and a stale series is not flushed until the max-chunk-idle timeout is reached.")
8686
f.DurationVar(&cfg.MaxChunkAge, "ingester.max-chunk-age", 12*time.Hour, "Maximum chunk age before flushing.")
8787
f.DurationVar(&cfg.ChunkAgeJitter, "ingester.chunk-age-jitter", 20*time.Minute, "Range of time to subtract from -ingester.max-chunk-age to spread out flushes")
8888
f.BoolVar(&cfg.SpreadFlushes, "ingester.spread-flushes", false, "If true, spread series flushes across the whole period of -ingester.max-chunk-age.")

pkg/querier/querier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
6262
f.DurationVar(&promql.LookbackDelta, "promql.lookback-delta", promql.LookbackDelta, "Time since the last sample after which a time series is considered stale and ignored by expression evaluations.")
6363
}
6464
f.BoolVar(&cfg.Iterators, "querier.iterators", false, "Use iterators to execute query, as opposed to fully materialising the series in memory.")
65-
f.BoolVar(&cfg.BatchIterators, "querier.batch-iterators", false, "Use batch iterators to execute query, as opposed to fully materialising the series in memory. Takes precedent over the -querier.iterators flag.")
65+
f.BoolVar(&cfg.BatchIterators, "querier.batch-iterators", true, "Use batch iterators to execute query, as opposed to fully materialising the series in memory. Takes precedent over the -querier.iterators flag.")
6666
f.BoolVar(&cfg.IngesterStreaming, "querier.ingester-streaming", false, "Use streaming RPCs to query ingester.")
6767
f.IntVar(&cfg.MaxSamples, "querier.max-samples", 50e6, "Maximum number of samples a single query can load into memory.")
6868
f.DurationVar(&cfg.QueryIngestersWithin, "querier.query-ingesters-within", 0, "Maximum lookback beyond which queries are not sent to ingester. 0 means all queries are sent to ingester.")

pkg/ring/kv/consul/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet, prefix string) {
6363
f.StringVar(&cfg.Host, prefix+"consul.hostname", "localhost:8500", "Hostname and port of Consul.")
6464
f.StringVar(&cfg.ACLToken, prefix+"consul.acl-token", "", "ACL Token used to interact with Consul.")
6565
f.DurationVar(&cfg.HTTPClientTimeout, prefix+"consul.client-timeout", 2*longPollDuration, "HTTP timeout when talking to Consul")
66-
f.BoolVar(&cfg.ConsistentReads, prefix+"consul.consistent-reads", true, "Enable consistent reads to Consul.")
66+
f.BoolVar(&cfg.ConsistentReads, prefix+"consul.consistent-reads", false, "Enable consistent reads to Consul.")
6767
f.Float64Var(&cfg.WatchKeyRateLimit, prefix+"consul.watch-rate-limit", 0, "Rate limit when watching key or prefix in Consul, in requests per second. 0 disables the rate limit.")
6868
f.IntVar(&cfg.WatchKeyBurstSize, prefix+"consul.watch-burst-size", 1, "Burst size used in rate limit. Values less than 1 are treated as 1.")
6969
}

pkg/ring/lifecycler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (cfg *LifecyclerConfig) RegisterFlagsWithPrefix(prefix string, f *flag.Flag
8282
prefix = "ingester."
8383
}
8484

85-
f.IntVar(&cfg.NumTokens, prefix+"num-tokens", 128, "Number of tokens for each ingester.")
85+
f.IntVar(&cfg.NumTokens, prefix+"num-tokens", 512, "Number of tokens for each ingester.")
8686
f.DurationVar(&cfg.HeartbeatPeriod, prefix+"heartbeat-period", 5*time.Second, "Period at which to heartbeat to consul.")
8787
f.DurationVar(&cfg.JoinAfter, prefix+"join-after", 0*time.Second, "Period to wait for a claim from another member; will join automatically after this.")
8888
f.DurationVar(&cfg.ObservePeriod, prefix+"observe-period", 0*time.Second, "Observe tokens after generating to resolve collisions. Useful when using gossiping ring.")

0 commit comments

Comments
 (0)