From c9caedb37508b7728b7666abcdfc272c6cdbe432 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Mon, 24 Feb 2020 02:33:07 -0500 Subject: [PATCH 1/3] [dbnode] Add aggregator client maxBatchSize to configure the buffer for sending data from coordinator to aggregator --- src/aggregator/client/config.go | 4 ++++ src/aggregator/client/options.go | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/aggregator/client/config.go b/src/aggregator/client/config.go index 8f69a5bc20..d99a553862 100644 --- a/src/aggregator/client/config.go +++ b/src/aggregator/client/config.go @@ -45,6 +45,7 @@ type Configuration struct { ShardCutoffLingerDuration *time.Duration `yaml:"shardCutoffLingerDuration"` Encoder EncoderConfiguration `yaml:"encoder"` FlushSize int `yaml:"flushSize"` + MaxBatchSize int `yaml:"maxBatchSize"` MaxTimerBatchSize int `yaml:"maxTimerBatchSize"` QueueSize int `yaml:"queueSize"` QueueDropType *DropType `yaml:"queueDropType"` @@ -127,6 +128,9 @@ func (c *Configuration) newClientOptions( if c.FlushSize != 0 { opts = opts.SetFlushSize(c.FlushSize) } + if c.MaxBatchSize != 0 { + opts = opts.SetMaxBatchSize(c.MaxBatchSize) + } if c.MaxTimerBatchSize != 0 { opts = opts.SetMaxTimerBatchSize(c.MaxTimerBatchSize) } diff --git a/src/aggregator/client/options.go b/src/aggregator/client/options.go index 40c635df61..6681d3469f 100644 --- a/src/aggregator/client/options.go +++ b/src/aggregator/client/options.go @@ -37,6 +37,8 @@ const ( // By default there is no limit on the timer batch size. defaultMaxTimerBatchSize = 0 + // defaultInstanceQueueSize determines how many metrics can be buffered + // before it must wait for an existing batch to be flushed to an instance. defaultInstanceQueueSize = 4096 // By default traffic is cut over to shards 10 minutes before the designated @@ -51,10 +53,10 @@ const ( // By default the oldest metrics in the queue are dropped when it is full. defaultDropType = DropOldest - // By default set maximum batch size to 32k - defaultMaxBatchSize = 2 << 14 + // By default set maximum batch size to 16mb. + defaultMaxBatchSize = 2 << 23 - // By default write at least every 100ms + // By default write at least every 100ms. defaultBatchFlushDeadline = 100 * time.Millisecond ) From 9611b3625347d16e7705af41c9c2e38c8b2809f4 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Mon, 24 Feb 2020 02:35:58 -0500 Subject: [PATCH 2/3] Increase instance queue size --- src/aggregator/client/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aggregator/client/options.go b/src/aggregator/client/options.go index 6681d3469f..5cd88cee5c 100644 --- a/src/aggregator/client/options.go +++ b/src/aggregator/client/options.go @@ -39,7 +39,7 @@ const ( // defaultInstanceQueueSize determines how many metrics can be buffered // before it must wait for an existing batch to be flushed to an instance. - defaultInstanceQueueSize = 4096 + defaultInstanceQueueSize = 2 << 15 // ~65k // By default traffic is cut over to shards 10 minutes before the designated // cutover time in case there are issues with the instances owning the shards. From bace1cf1d1b5e3e1bb3275ce04a6c41b42496d9b Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Mon, 24 Feb 2020 02:54:16 -0500 Subject: [PATCH 3/3] Use 8mb default buffer --- src/aggregator/client/options.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aggregator/client/options.go b/src/aggregator/client/options.go index 5cd88cee5c..14c338bc45 100644 --- a/src/aggregator/client/options.go +++ b/src/aggregator/client/options.go @@ -53,8 +53,8 @@ const ( // By default the oldest metrics in the queue are dropped when it is full. defaultDropType = DropOldest - // By default set maximum batch size to 16mb. - defaultMaxBatchSize = 2 << 23 + // By default set maximum batch size to 8mb. + defaultMaxBatchSize = 2 << 22 // By default write at least every 100ms. defaultBatchFlushDeadline = 100 * time.Millisecond