GithubHelp home page GithubHelp logo

cameroncf / step-function-retry-calculator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jesterxl/step-function-retry-calculator

0.0 0.0 0.0 135 KB

Visualize how long retries can take and how many seconds each retry is with a total.

Home Page: https://jessewarden.com/tools/step-function-retry-calculator/

Elm 84.96% HTML 15.04%

step-function-retry-calculator's Introduction

What

Helps visualize how long your retries will take in a Step Function. Uses Elm for the code, and Bulma for the CSS.

Building

To see it yourself:

  1. run npm install
  2. run npm start
  3. open a browser at http://localhost:8000

To make an optmized build, run npm run build.

Why

AWS Step Functions allow you to orchestrate microservices. One of their killer features is retry; they handle all the state of retry, and they can run for up to a year. While that's great, sometimes during development, or perhaps for timeout reasons, you don't want your retries to take that long.

Step Functions offer 3 properties that a Task can use to define this retry:

  • IntervalSeconds: How long to wait.
  • MaxAttempts: How many times to retry.
  • BackoffRate: Each time it backs off, it'll multiply this times the IntervalSeconds.

Now, even an art student like me can do the IntervalSeconds and MaxAttempts math in my head.

MaxAttempts is 3, and IntervalSeconds is 1, so... it'll try, fail, 1 second later try again, fail, try again 1 second later, fail, then try again a final time 1 second later.

Once you put BackoffRate in there, though... my brain kind of melts. Worse, I'll sometimes get angry at some unstable downstream service I'm testing, and wonder why my Step Function didn't timeout after 30 minutes and it ends up I set the retry time way higher than my patience.

This UI helps you see the math instantly, and visualize the calls. For example, most defaults go like this:

IntervalSeconds = 1 MaxAttempts = 3 BackoffRate = 2

Which means she'll:

  1. try
  2. fail and wait 1 second
  3. try again
  4. fail and wait 2 seconds
  5. try again
  6. fail and wait 4 seconds
  7. then try again a final time.

Sometimes, however, you may be in a QA environment, and don't want to exponentially back off. You know either service just constantly and randomly goes down despite plenty of infrastructure resources, or you know the developers are taking the service down but don't really care about when they say it'll come back up.

IntervalSeconds = 3 MaxAttempts = 10 BackoffRate = 1

In this case, she'll:

  1. try
  2. fail and wait 3 seconds
  3. try again
  4. fail and wait 3 seconds
  5. try again

... and on and on 8 more times. No jitter, no slowly calling each time to be nice to the server and DDOS, nope, just "Are we there yet? Are we there yet?"

step-function-retry-calculator's People

Contributors

jesterxl 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.