Skip to content

Commit f486175

Browse files
committed
Address feedback
Signed-off-by: Goutham Veeramachaneni <[email protected]>
1 parent 0db2579 commit f486175

File tree

8 files changed

+32
-29
lines changed

8 files changed

+32
-29
lines changed

CHANGELOG.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
## master / unreleased
44

5-
* [CHANGE] Renamed the `memcache.write-back-goroutines` and `memcache.write-back-buffer` flags to `cache.write-back-concurrency` and `cache.write-back-buffer`. This affects the following flags:
6-
- `-frontend.memcache.write-back-buffer` --> `-frontend.cache.write-back-buffer`
7-
- `-frontend.memcache.write-back-goroutines` --> `-frontend.cache.write-back-concurrency`
8-
- `-store.index-cache-read.memcache.write-back-buffer` --> `-store.index-cache-read.cache.write-back-buffer`
9-
- `-store.index-cache-read.memcache.write-back-goroutines` --> `-store.index-cache-read.cache.write-back-concurrency`
10-
- `-store.index-cache-write.memcache.write-back-buffer` --> `-store.index-cache-write.cache.write-back-buffer`
11-
- `-store.index-cache-write.memcache.write-back-goroutines` --> `-store.index-cache-write.cache.write-back-concurrency`
12-
- `-memcache.write-back-buffer` --> `-store.chunks-cache.cache.write-back-buffer`. Note the next change log for the difference.
13-
- `-memcache.write-back-goroutines` --> `-store.chunks-cache.cache.write-back-concurrency`. Note the next change log for the difference.
5+
* [CHANGE] Renamed the `memcache.write-back-goroutines` and `memcache.write-back-buffer` flags to `background.write-back-concurrency` and `background.write-back-buffer`. This affects the following flags:
6+
- `-frontend.memcache.write-back-buffer` --> `-frontend.background.write-back-buffer`
7+
- `-frontend.memcache.write-back-goroutines` --> `-frontend.background.write-back-concurrency`
8+
- `-store.index-cache-read.memcache.write-back-buffer` --> `-store.index-cache-read.background.write-back-buffer`
9+
- `-store.index-cache-read.memcache.write-back-goroutines` --> `-store.index-cache-read.background.write-back-concurrency`
10+
- `-store.index-cache-write.memcache.write-back-buffer` --> `-store.index-cache-write.background.write-back-buffer`
11+
- `-store.index-cache-write.memcache.write-back-goroutines` --> `-store.index-cache-write.background.write-back-concurrency`
12+
- `-memcache.write-back-buffer` --> `-store.chunks-cache.background.write-back-buffer`. Note the next change log for the difference.
13+
- `-memcache.write-back-goroutines` --> `-store.chunks-cache.background.write-back-concurrency`. Note the next change log for the difference.
1414

1515
* [CHANGE] Renamed the chunk cache flags to have `store.chunks-cache.` as prefix. This means the following flags have been changed:
1616
- `-cache.enable-fifocache` --> `-store.chunks-cache.cache.enable-fifocache`
1717
- `-default-validity` --> `-store.chunks-cache.default-validity`
1818
- `-fifocache.duration` --> `-store.chunks-cache.fifocache.duration`
1919
- `-fifocache.size` --> `-store.chunks-cache.fifocache.size`
20-
- `-memcache.write-back-buffer` --> `-store.chunks-cache.cache.write-back-buffer`. Note the previous change log for the difference.
21-
- `-memcache.write-back-goroutines` --> `-store.chunks-cache.cache.write-back-concurrency`. Note the previous change log for the difference.
20+
- `-memcache.write-back-buffer` --> `-store.chunks-cache.background.write-back-buffer`. Note the previous change log for the difference.
21+
- `-memcache.write-back-goroutines` --> `-store.chunks-cache.background.write-back-concurrency`. Note the previous change log for the difference.
2222
- `-memcached.batchsize` --> `-store.chunks-cache.memcached.batchsize`
2323
- `-memcached.consistent-hash` --> `-store.chunks-cache.memcached.consistent-hash`
2424
- `-memcached.expiration` --> `-store.chunks-cache.memcached.expiration`

docs/configuration/arguments.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ The ingester query API was improved over time, but defaults to the old behaviour
108108

109109
When caching query results, it is desirable to prevent the caching of very recent results that might still be in flux. Use this parameter to configure the age of results that should be excluded.
110110

111-
- `-memcached.{hostname, service, timeout}`
111+
- `-frontend.memcached.{hostname, service, timeout}`
112112

113113
Use these flags to specify the location and timeout of the memcached cluster used to cache query results.
114114

115-
- `-redis.{endpoint, timeout}`
115+
- `-frontend.redis.{endpoint, timeout}`
116116

117117
Use these flags to specify the location and timeout of the Redis service used to cache query results.
118118

@@ -288,7 +288,7 @@ It also talks to a KVStore and has it's own copies of the same flags used by the
288288

289289
- `-ingester.spread-flushes`
290290

291-
Makes the ingester flush each timeseries at a specific point in the `max-chunk-age` cycle. This means multiple replicas of a chunk are very likely to contain the same contents which cuts chunk storage space by up to 66%. Set `-ingester.chunk-age-jitter` to `0` when using this option. If a chunk cache is configured (via `-memcached.hostname`) then duplicate chunk writes are skipped which cuts write IOPs.
291+
Makes the ingester flush each timeseries at a specific point in the `max-chunk-age` cycle. This means multiple replicas of a chunk are very likely to contain the same contents which cuts chunk storage space by up to 66%. Set `-ingester.chunk-age-jitter` to `0` when using this option. If a chunk cache is configured (via `-store.chunks-cache.memcached.hostname`) then duplicate chunk writes are skipped which cuts write IOPs.
292292

293293
- `-ingester.join-after`
294294

docs/configuration/config-file-reference.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,11 @@ results_cache:
645645
646646
background:
647647
# At what concurrency to write back to cache.
648-
# CLI flag: -frontend.cache.write-back-concurrency
648+
# CLI flag: -frontend.background.write-back-concurrency
649649
[writeback_goroutines: <int> | default = 10]
650650
651651
# How many key batches to buffer for background write-back.
652-
# CLI flag: -frontend.cache.write-back-buffer
652+
# CLI flag: -frontend.background.write-back-buffer
653653
[writeback_buffer: <int> | default = 10000]
654654
655655
# The memcached_config block configures how data is stored in Memcached (ie.
@@ -1517,12 +1517,12 @@ index_queries_cache_config:
15171517
background:
15181518
# Cache config for index entry reading. At what concurrency to write back to
15191519
# cache.
1520-
# CLI flag: -store.index-cache-read.cache.write-back-concurrency
1520+
# CLI flag: -store.index-cache-read.background.write-back-concurrency
15211521
[writeback_goroutines: <int> | default = 10]
15221522

15231523
# Cache config for index entry reading. How many key batches to buffer for
15241524
# background write-back.
1525-
# CLI flag: -store.index-cache-read.cache.write-back-buffer
1525+
# CLI flag: -store.index-cache-read.background.write-back-buffer
15261526
[writeback_buffer: <int> | default = 10000]
15271527

15281528
# The memcached_config block configures how data is stored in Memcached (ie.
@@ -1570,12 +1570,12 @@ chunk_cache_config:
15701570
15711571
background:
15721572
# Cache config for chunks. At what concurrency to write back to cache.
1573-
# CLI flag: -store.chunks-cache.cache.write-back-concurrency
1573+
# CLI flag: -store.chunks-cache.background.write-back-concurrency
15741574
[writeback_goroutines: <int> | default = 10]
15751575
15761576
# Cache config for chunks. How many key batches to buffer for background
15771577
# write-back.
1578-
# CLI flag: -store.chunks-cache.cache.write-back-buffer
1578+
# CLI flag: -store.chunks-cache.background.write-back-buffer
15791579
[writeback_buffer: <int> | default = 10000]
15801580
15811581
# The memcached_config block configures how data is stored in Memcached (ie.
@@ -1609,12 +1609,12 @@ write_dedupe_cache_config:
16091609
background:
16101610
# Cache config for index entry writing. At what concurrency to write back to
16111611
# cache.
1612-
# CLI flag: -store.index-cache-write.cache.write-back-concurrency
1612+
# CLI flag: -store.index-cache-write.background.write-back-concurrency
16131613
[writeback_goroutines: <int> | default = 10]
16141614
16151615
# Cache config for index entry writing. How many key batches to buffer for
16161616
# background write-back.
1617-
# CLI flag: -store.index-cache-write.cache.write-back-buffer
1617+
# CLI flag: -store.index-cache-write.background.write-back-buffer
16181618
[writeback_buffer: <int> | default = 10000]
16191619
16201620
# The memcached_config block configures how data is stored in Memcached (ie.
@@ -2093,7 +2093,7 @@ The `memcached_client_config` configures the client used to connect to Memcached
20932093
&nbsp;
20942094

20952095
```yaml
2096-
# Hostname for memcached service to use when caching chunks. If empty, no
2096+
# Hostname for memcached service to use. If empty and if addresses is unset, no
20972097
# memcached will be used.
20982098
# CLI flag: -<prefix>.memcached.hostname
20992099
[host: <string> | default = ""]

docs/guides/caching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ These are typically a few KB in size, and depend mostly on the duration and enco
121121
The chunk cache is a write-through cache - chunks are written to the cache as they are flushed to the chunk store. This ensures the cache always contains the most recent chunks.
122122
Items stay in the cache indefinitely.
123123

124-
The chunk cache should be configured on the **ingester**, **querier** and **ruler** using the flags with a prefix: `-store.chunks-cache`.
124+
The chunk cache should be configured on the **ingester**, **querier** and **ruler** using the flags with the prefix `-store.chunks-cache`.
125125

126126
It is best practice to ensure the chunk cache is big enough to accommodate at least 24 hours of chunk data.
127127
You can use the following query (from the [cortex-mixin](https://github.com/grafana/cortex-jsonnet)) to estimate the required number of memcached replicas:

k8s/memcached-dep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
spec:
1818
containers:
1919
- name: memcached
20-
image: memcached:1.6.0
20+
image: memcached:1.4.25
2121
imagePullPolicy: IfNotPresent
2222
args:
2323
- -m 64 # Maximum memory to use, in megabytes. 64MB is default.

pkg/chunk/cache/background.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ type BackgroundConfig struct {
3232

3333
// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
3434
func (cfg *BackgroundConfig) RegisterFlagsWithPrefix(prefix string, description string, f *flag.FlagSet) {
35-
f.IntVar(&cfg.WriteBackGoroutines, prefix+"cache.write-back-concurrency", 10, description+"At what concurrency to write back to cache.")
36-
f.IntVar(&cfg.WriteBackBuffer, prefix+"cache.write-back-buffer", 10000, description+"How many key batches to buffer for background write-back.")
35+
f.IntVar(&cfg.WriteBackGoroutines, prefix+"background.write-back-concurrency", 10, description+"At what concurrency to write back to cache.")
36+
f.IntVar(&cfg.WriteBackBuffer, prefix+"background.write-back-buffer", 10000, description+"How many key batches to buffer for background write-back.")
3737
}
3838

3939
type backgroundCache struct {

pkg/chunk/cache/memcached_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type MemcachedClientConfig struct {
4949

5050
// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
5151
func (cfg *MemcachedClientConfig) RegisterFlagsWithPrefix(prefix, description string, f *flag.FlagSet) {
52-
f.StringVar(&cfg.Host, prefix+"memcached.hostname", "", description+"Hostname for memcached service to use when caching chunks. If empty, no memcached will be used.")
52+
f.StringVar(&cfg.Host, prefix+"memcached.hostname", "", description+"Hostname for memcached service to use. If empty and if addresses is unset, no memcached will be used.")
5353
f.StringVar(&cfg.Service, prefix+"memcached.service", "memcached", description+"SRV service used to discover memcache servers.")
5454
f.IntVar(&cfg.MaxIdleConns, prefix+"memcached.max-idle-conns", 16, description+"Maximum number of idle connections in pool.")
5555
f.DurationVar(&cfg.Timeout, prefix+"memcached.timeout", 100*time.Millisecond, description+"Maximum time to wait before giving up on memcached requests.")

pkg/chunk/chunk_store.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ type StoreConfig struct {
5555
// Limits query start time to be greater than now() - MaxLookBackPeriod, if set.
5656
MaxLookBackPeriod time.Duration `yaml:"max_look_back_period"`
5757

58-
// Not visible in yaml because the setting shouldn't be common between ingesters and queriers
58+
// Not visible in yaml because the setting shouldn't be common between ingesters and queriers.
59+
// This exists in case we don't want to cache all the chunks but still want to take advantage of
60+
// ingester chunk write deduplication. But for the queriers we need the full value. So when this option
61+
// is set, use different caches for ingesters and queriers.
5962
chunkCacheStubs bool // don't write the full chunk to cache, just a stub entry
6063
}
6164

0 commit comments

Comments
 (0)