alex-okrushko/backoff-rxjs

Support for Jitter

nbibler opened this issue ยท 2 comments

It's generally seen as a best practice to implement a random jitter in any backoff functions.

A reasonable explanation can be found here. TLDR: Random jitter avoids stampeding on prescribed intervals and more evenly distributes work load across a time series.

I know this library provides a default backoffDelay and gives the implementor an ability to define a custom backoffDelay which could include a jitter. Since most people don't tend to know about the benefits of it, or that the problem/idea even exists, I'm just curious if this library would be open to the idea of implementing a default random jitter in the default backoffDelay function.

Thanks @nbibler

I agree that jitter could be a good general addition.

Still, I'm inclined to not add it for three reasons:

  • e2e testing could become more unpredictable
  • My assumption is that backoff-rxjs is mostly used on the frontends (although that's not strictly the requirement), and only a few endpoints are put onto the backoff, so the pay-back is relatively low
  • folks who are aware and would need to add jitter would extend it with the custom backoffDelay, as you correctly pointed out

Thank you for taking the time to open the issue with the suggestion ๐Ÿ‘

@alex-okrushko: Cool. Thanks for the thoughtful consideration! ๐Ÿ˜„