Skip to content

Commit

Permalink
[m3msg] Increase default writer initial backoff (#3820)
Browse files Browse the repository at this point in the history
  • Loading branch information
Antanukas authored Oct 7, 2021
1 parent 6da0a4a commit b11cf74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions site/content/includes/m3query/annotated_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ clusters:
connectTimeout: <duration>
# Configuration for retrying write operations
writeRetry:
# Defaults to 5s.
initialBackoff: <duration>
# Factor for exponential backoff
backoffFactor: <float>
Expand Down
6 changes: 5 additions & 1 deletion src/msg/producer/writer/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const (
// Using 65k which provides much better performance comparing
// to lower values like 1k ~ 8k.
defaultConnectionBufferSize = 2 << 15 // ~65kb

defaultWriterRetryInitialBackoff = time.Second * 5
)

// ConnectionOptions configs the connections.
Expand Down Expand Up @@ -397,11 +399,13 @@ type writerOptions struct {

// NewOptions creates Options.
func NewOptions() Options {
messageRetryOpts := retry.NewOptions().
SetInitialBackoff(defaultWriterRetryInitialBackoff)
return &writerOptions{
topicWatchInitTimeout: defaultTopicWatchInitTimeout,
placementOpts: placement.NewOptions(),
placementWatchInitTimeout: defaultPlacementWatchInitTimeout,
messageRetryOpts: retry.NewOptions(),
messageRetryOpts: messageRetryOpts,
messageQueueNewWritesScanInterval: defaultMessageQueueNewWritesScanInterval,
messageQueueFullScanInterval: defaultMessageQueueFullScanInterval,
messageQueueScanBatchSize: defaultMessageQueueScanBatchSize,
Expand Down
3 changes: 3 additions & 0 deletions src/msg/producer/writer/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func TestOptions(t *testing.T) {
require.Equal(t, time.Second, opts.SetCloseCheckInterval(time.Second).CloseCheckInterval())

require.Nil(t, opts.SetInstrumentOptions(nil).InstrumentOptions())

require.NotNil(t, opts.MessageRetryOptions())
require.Equal(t, defaultWriterRetryInitialBackoff, opts.MessageRetryOptions().InitialBackoff())
}

func TestConnectionOptions(t *testing.T) {
Expand Down

0 comments on commit b11cf74

Please sign in to comment.