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

Add backoff support to the redis output #7781

Merged
merged 6 commits into from
Jul 31, 2018
Merged

Conversation

urso
Copy link

@urso urso commented Jul 27, 2018

The PR adds backoff support to the redis output, similar to the Elasticsearch/Logstash output. 2 Settings backoff.init and backoff.max are available. On failure we will wait for backoff.init before trying to reconnect. If reconnect fails, the wait times increase exponentially. The backoff.max configures the maximum duration until retry.

We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect must not reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as failOther. A successfull connect will reset
the backoff timer.

urso added 4 commits July 27, 2018 14:58
We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.
@urso urso added review needs_backport PR is waiting to be backported to other branches. labels Jul 27, 2018
@ph ph self-requested a review July 30, 2018 13:48
@ph ph added the libbeat label Jul 30, 2018
Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

LGTM, a few typos in the comments to fix.


// failReason is used to track the cause of an error.
// The redis client forces us to reconnect on any error (even for redis
// internal errors). The backoff timer must not be reset on a successfully
Copy link
Contributor

Choose a reason for hiding this comment

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

s/successfully/successful

// failReason is used to track the cause of an error.
// The redis client forces us to reconnect on any error (even for redis
// internal errors). The backoff timer must not be reset on a successfully
// reconnect after publishing failed with a redis internal
Copy link
Contributor

Choose a reason for hiding this comment

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

double space between 'with' and 'a'

// give the client a chance to promote an internal error to a network error.
b.updateFailReason(err)
b.backoff.Wait()
} else if b.reason != failRedis { // Only reset backoff durartion if failure was due to IO errors.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/durartion/duration

@ph ph merged commit eaf516a into elastic:master Jul 31, 2018
@urso urso added v6.5.0 and removed needs_backport PR is waiting to be backported to other branches. labels Jul 31, 2018
urso pushed a commit to urso/beats that referenced this pull request Jul 31, 2018
* Add custom backoff support to redis client

We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.

(cherry picked from commit eaf516a)
@urso urso added the v6.4.0 label Jul 31, 2018
urso pushed a commit to urso/beats that referenced this pull request Jul 31, 2018
* Add custom backoff support to redis client

We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.

(cherry picked from commit eaf516a)
andrewvc added a commit that referenced this pull request Jul 31, 2018
Cherry-pick #7781 to 6.4: Add backoff support to the redis output
andrewvc added a commit that referenced this pull request Jul 31, 2018
Cherry-pick #7781 to 6.x: Add backoff support to the redis output
@ph ph added the needs_backport PR is waiting to be backported to other branches. label Aug 3, 2018
@ph
Copy link
Contributor

ph commented Aug 3, 2018

This PR need a 6.3 backport.

@urso urso added v6.3.3 and removed needs_backport PR is waiting to be backported to other branches. labels Aug 3, 2018
urso pushed a commit to urso/beats that referenced this pull request Aug 3, 2018
* Add custom backoff support to redis client

We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.

(cherry picked from commit eaf516a)
ruflin pushed a commit that referenced this pull request Aug 9, 2018
We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.

(cherry picked from commit eaf516a)
@urso urso deleted the output-redis-backoff branch February 19, 2019 18:40
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.

(cherry picked from commit 1415dc1)
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
* Add custom backoff support to redis client

We are forced to reconnect to redis on error. Even for redis internal
errors. The custom backoff client wrapper detects if the error has been
an redis internal error, or any other kind of error. If the actual error
comes from redis, a reconnect should reset the backoff timer. The
backoff client wrapper makes sure that the backoff timer is only reset
after a successfull publish.
In case of IO errors during connect (without having published any event
yet), we track these as `failOther`. A successfull connect will reset
the backoff timer.

(cherry picked from commit 1415dc1)
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Cherry-pick elastic#7781 to 6.4: Add backoff support to the redis output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants