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 support for exponential backoff in FirehoseProducer #17

Open
bobtiernay-okta opened this issue Apr 15, 2021 · 1 comment
Open

Add support for exponential backoff in FirehoseProducer #17

bobtiernay-okta opened this issue Apr 15, 2021 · 1 comment

Comments

@bobtiernay-okta
Copy link

bobtiernay-okta commented Apr 15, 2021

Currently, FirehoseProducer performs linear backoff via:

//Full Jitter: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
long timeToSleep = RandomUtils.nextLong(0, Math.min(configuration.getMaxBackOffInMillis(), (configuration.getBaseBackOffInMillis() * 2 * attempts)));

While the code comment points to https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/, it fails to implement exponentiation:
image

Compare this with this code from FullJitterBackoff's calculateFullJitterBackoff:

public long calculateFullJitterBackoff(long baseMillis, long maxMillis, double power, int attempt) {
   long exponentialBackoff = (long) Math.min(maxMillis, baseMillis * Math.pow(power, attempt));
   return (long) (seed.nextDouble() * exponentialBackoff);
}
@GS-KeithLee
Copy link

Thank you for reporting the issue. We will plan this into our upcoming releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants