Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[m3msg] Increase default writer initial backoff #3820

Merged
merged 5 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions src/x/retry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
// Configuration configures options for retry attempts.
type Configuration struct {
// Initial retry backoff.
// Defaults to 5s if unspecified.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: no need for this comment, eventually it would go out of sync with the actual value.

InitialBackoff time.Duration `yaml:"initialBackoff" validate:"min=0"`

// Backoff factor for exponential backoff.
Expand Down