From 7d19258af9d41225c1d76227a54884188fe37c2e Mon Sep 17 00:00:00 2001 From: Philip Gough Date: Wed, 3 Aug 2022 12:02:19 +0100 Subject: [PATCH 1/2] receive: Expose write chunk queue as flag Signed-off-by: Philip Gough --- cmd/thanos/receive.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cmd/thanos/receive.go b/cmd/thanos/receive.go index a8a5ddeb39..dd259fed3e 100644 --- a/cmd/thanos/receive.go +++ b/cmd/thanos/receive.go @@ -73,14 +73,15 @@ func registerReceive(app *extkingpin.App) { } tsdbOpts := &tsdb.Options{ - MinBlockDuration: int64(time.Duration(*conf.tsdbMinBlockDuration) / time.Millisecond), - MaxBlockDuration: int64(time.Duration(*conf.tsdbMaxBlockDuration) / time.Millisecond), - RetentionDuration: int64(time.Duration(*conf.retention) / time.Millisecond), - NoLockfile: conf.noLockFile, - WALCompression: conf.walCompression, - AllowOverlappingBlocks: conf.tsdbAllowOverlappingBlocks, - MaxExemplars: conf.tsdbMaxExemplars, - EnableExemplarStorage: true, + MinBlockDuration: int64(time.Duration(*conf.tsdbMinBlockDuration) / time.Millisecond), + MaxBlockDuration: int64(time.Duration(*conf.tsdbMaxBlockDuration) / time.Millisecond), + RetentionDuration: int64(time.Duration(*conf.retention) / time.Millisecond), + NoLockfile: conf.noLockFile, + WALCompression: conf.walCompression, + AllowOverlappingBlocks: conf.tsdbAllowOverlappingBlocks, + MaxExemplars: conf.tsdbMaxExemplars, + EnableExemplarStorage: true, + HeadChunksWriteQueueSize: int(conf.tsdbWriteQueueSize), } // Are we running in IngestorOnly, RouterOnly or RouterIngestor mode? @@ -787,6 +788,7 @@ type receiveConfig struct { tsdbMaxBlockDuration *model.Duration tsdbAllowOverlappingBlocks bool tsdbMaxExemplars int64 + tsdbWriteQueueSize int64 walCompression bool noLockFile bool @@ -889,6 +891,11 @@ func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) { " ingesting a new exemplar will evict the oldest exemplar from storage. 0 (or less) value of this flag disables exemplars storage."). Default("0").Int64Var(&rc.tsdbMaxExemplars) + cmd.Flag("tsdb.write-queue-size", + "[EXPERIMENTAL] Enables configuring the size of the chunk write queue used in the head chunks mapper. "+ + "A queue size of zero (default) disables this feature entirely."). + Default("0").Hidden().Int64Var(&rc.tsdbWriteQueueSize) + cmd.Flag("hash-func", "Specify which hash function to use when calculating the hashes of produced files. If no function has been specified, it does not happen. This permits avoiding downloading some files twice albeit at some performance cost. Possible values are: \"\", \"SHA256\"."). Default("").EnumVar(&rc.hashFunc, "SHA256", "") From e635daf11462d8a93981c17dc940bed645e38979 Mon Sep 17 00:00:00 2001 From: Philip Gough Date: Wed, 3 Aug 2022 15:23:55 +0100 Subject: [PATCH 2/2] docs: Update changelog Signed-off-by: Philip Gough --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc2b98ccf..9cf6fd1952 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#5527](https://github.com/thanos-io/thanos/pull/5527) Receive: Add per request limits for remote write. - [#5520](https://github.com/thanos-io/thanos/pull/5520) Receive: Meta-monitoring based active series limiting - [#5555](https://github.com/thanos-io/thanos/pull/5555) Query: Added `--query.active-query-path` flag, allowing the user to configure the directory to create an active query tracking file, `queries.active`, for different resolution. +- [#5566](https://github.com/thanos-io/thanos/pull/5566) Receive: Added experimental support to enable chunk write queue via `--tsdb.write-queue-size` flag. ### Changed