diff --git a/app/vmctl/backoff/backoff.go b/app/vmctl/backoff/backoff.go index 9dc9637e8..bedde6cdc 100644 --- a/app/vmctl/backoff/backoff.go +++ b/app/vmctl/backoff/backoff.go @@ -11,9 +11,9 @@ import ( ) const ( - backoffRetries = 5 - backoffFactor = 1.7 - backoffMinDuration = time.Second + backoffRetries = 10 + backoffFactor = 1.8 + backoffMinDuration = time.Second * 2 ) // retryableFunc describes call back which will repeat on errors diff --git a/app/vmctl/backoff/backoff_test.go b/app/vmctl/backoff/backoff_test.go index 46556d2d2..6d6d001a1 100644 --- a/app/vmctl/backoff/backoff_test.go +++ b/app/vmctl/backoff/backoff_test.go @@ -37,7 +37,7 @@ func TestRetry_Do(t *testing.T) { }, ctx: context.Background(), want: 0, - wantErr: false, + wantErr: true, }, { name: "only one retry test", @@ -82,7 +82,7 @@ func TestRetry_Do(t *testing.T) { { name: "cancel context", backoffRetries: 5, - backoffFactor: 0.1, + backoffFactor: 1.7, backoffMinDuration: time.Millisecond * 10, retryableFunc: func() error { t := time.NewTicker(time.Millisecond * 5) @@ -93,14 +93,14 @@ func TestRetry_Do(t *testing.T) { return nil }, ctx: context.Background(), - cancelTimeout: time.Second * 5, + cancelTimeout: time.Millisecond * 40, want: 3, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - r := New() + r := &Backoff{retries: tt.backoffRetries, factor: tt.backoffFactor, minDuration: tt.backoffMinDuration} if tt.cancelTimeout != 0 { newCtx, cancelFn := context.WithTimeout(tt.ctx, tt.cancelTimeout) tt.ctx = newCtx diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 435495456..f2ea6ed6e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -29,6 +29,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): Adds `enable_http2` on scrape configuration level. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4283). Thanks to @Haleygo for [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4295). * FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): add verbose output for docker installations or when TTY isn't available. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4081). * FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): interrupt backoff retries when import process is cancelled. The change makes vmctl more responsive in case of errors during the import. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4442). +* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): update backoff policy on retries to reduce probability of overloading for `source` or `destination` databases. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4442). * FEATURE: vmstorage: suppress "broken pipe" errors for search queries on vmstorage side. See [this commit](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4418/commits/a6a7795b9e1f210d614a2c5f9a3016b97ded4792). * FEATURE: [Official Grafana dashboards for VictoriaMetrics](https://grafana.com/orgs/victoriametrics): add panel for tracking rate of syscalls while writing or reading from disk via `process_io_(read|write)_syscalls_total` metrics.