Code Monkey home page Code Monkey logo

exponential-backoff-algorithm's Introduction

Exponential backoff retries with jitter

A simple exponential backoff library written in C and easily portable to other languages.

On operation failures, this module ensures to double the time interval between retries slowing down the rate of retries. It also adds jitter to the intervals between each retry to ensure the timing of operations doesn't collide when multiple clients are sending requests to the server, this ensures the server doesn't get overwhelmed with requests. Below are the variables and usage.

exponential_retry_config_t

delay_base_s        \\ The base delay is used between retries.
delay_backoff_max_s  \\ The delay used between retries when all retries have exhausted.
jitter_percentage    \\ Percentage of jitter to the retry interval.
retry_count_max      \\ Maximum number of exponential retries before retrying every delay_backoff_max_s seconds

exponential_retry_t

retry_counter          \\ Internally used to keep track of the retry counts
total_jitter_period_s  \\ Internally used to keep track of the cumulative jitter added between retries 

Functions

exponential_retry_init(...)  \\ Initializes the context
exponential_retry_next(...)  \\ Calculates and returns the retry period to be used 

Warning

delay_backoff_max_s should always have a valid (>0) value, if invalid (<=0), subsequent retry intervals are based off delay_base_s.

Enjoy ๐Ÿ™‚

exponential-backoff-algorithm's People

Contributors

deeplyembeddedwp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.