Live data from Hacker News

Retries – An interactive study of request retry methods

encore.dev

11–20 of 56 posts

Re: Retries – An interactive study of request retry methods

#11
post #2

Thanks for sharing! I’m the author of this post, and happy to answer any questions :)

What technology did you use for the animations? I've a bunch of itches I'd like to scratch that would be improved by having some canvas animated explainers or UI but I never clicked with anything. D3 back in the day.

A rudimentary look in the source code showed a element but I'm not up to date enough with web standards to guess where to look for that in your JS bundle to guess at the framework!

Re: Retries – An interactive study of request retry methods

#12
post #8
post #2

Thanks for sharing! I’m the author of this post, and happy to answer any questions :)

There's a subtle insight that could be added to the post if you consider worth it, and it's something that's actually there already, but difficult to realize: Clients in your simulation have an absolute maximum number of retries. I noticed this mid-read, when looking at one of the animations with 28 clients, that they would hammer the server but suddenly go into wait state, without apparent reason. Later in the final…

You know, I hadn't actually considered mentioning it. Another commenter brought it up, too. It's so second nature I forgot about it entirely.

I'll look about giving it a nod in the text, thank you for the feedback. :)

Re: Retries – An interactive study of request retry methods

#13
post #2

Thanks for sharing! I’m the author of this post, and happy to answer any questions :)

What technology did you use for the animations? I've a bunch of itches I'd like to scratch that would be improved by having some canvas animated explainers or UI but I never clicked with anything. D3 back in the day. A rudimentary look in the source code showed a element but I'm not up to date enough with web standards to guess where to look for that in your JS bundle to guess at the framework!

It uses PixiJS (https://pixijs.com/) for the 2D rendering and GSAP3 (https://gsap.com/) for the animation. The blocks are custom HTMl elements (https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...) which I use to encapsulate the logic.

I've been thinking about creating a separate repo to house the source code of posts I've finished so people can see it. I don't like all the bundling and minification but sadly it serves a very real purpose to the end user experience (faster load speeds on slow connections).

Until then feel free to email me (you'll find my address at the bottom of my site) and I'd be happy to share a zip of this post with you.

Re: Retries – An interactive study of request retry methods

#14
This is the client side of things. And I think this is a great resource that everyone who writes clients for anything, should see.

But there is an additional piece of info everyone who writes clients needs to see: And that's what people like me, who implement backend services, may do if clients ignore such wisdom.

Because: I'm not gonna let bad clients break my service.

What that means in practice: Clients are given a choice: They can behave, or they can

    HTTP 429 Too Many Requests

Re: Retries – An interactive study of request retry methods

#15
post #10

This still isn't what I'd call "safe". Retries are amazing at supporting clients in handling temporary issues, but horrible for helping them deal with consistently overloaded servers. While jitter & exponential backoff help with the timing, they don't reduce the overall load sent to the service. The next step is usually local circuit breakers. The two easiest to implement are terminating the request if the error rate…

Totally! Thanks for bringing those up. I tried to keep the scope specifically on retries and client-side mitigation. There's a whole bunch of cool stuff to visualise on the server-side, and I'm hoping to get to it in the future.

Do you have a newsletter?

Re: Retries – An interactive study of request retry methods

#16

This is the client side of things. And I think this is a great resource that everyone who writes clients for anything, should see. But there is an additional piece of info everyone who writes clients needs to see: And that's what people like me, who implement backend services, may do if clients ignore such wisdom. Because: I'm not gonna let bad clients break my service. What that means in practice: Clients are given…

> This is the client side of things.

The article is about making requests, and strategies to implement when the request fails. By definition, these are clients. Was there any ambiguity?

> But there is an additional piece of info everyone who writes clients needs to see: And that's what people like me, who implement backend services, may do if clients ignore such wisdom.

I don't think this is the obscure detail you are making it out to be. A few of the most basic and popular retry strategies are designed explicitly with a) handling throttled responses by the servers, b) mitigate the risk of causing self-inflicted DDoS attacks. This article covers a few of those, such as the exponential backoff and jitters.

Re: Retries – An interactive study of request retry methods

#17
post #15
post #10

Earlier quoted context omitted.

Totally! Thanks for bringing those up. I tried to keep the scope specifically on retries and client-side mitigation. There's a whole bunch of cool stuff to visualise on the server-side, and I'm hoping to get to it in the future.

Do you have a newsletter?

Not a newsletter as such but I do have an email list where I post whenever I write something new. You can find it here: https://buttondown.email/samwho

Re: Retries – An interactive study of request retry methods

#18

A must-read (or rather: must-see) for anyone who thinks exponential backoff is overrated.

> A must-read (or rather: must-see) for anyone who thinks exponential backoff is overrated.

I don't think exponential backoffs were ever accused of being overrated. Retries in general have been criticized for being counterproductive in multiple aspects, including the risk of creating self-inflicted DDOS attacks, and exponential backoffs can result in untenable performance and usability problems without adding any upside. These are known problems, but none of them is hardly classified as "overrating".

Re: Retries – An interactive study of request retry methods

#19
post #12
post #8

Earlier quoted context omitted.

There's a subtle insight that could be added to the post if you consider worth it, and it's something that's actually there already, but difficult to realize: Clients in your simulation have an absolute maximum number of retries. I noticed this mid-read, when looking at one of the animations with 28 clients, that they would hammer the server but suddenly go into wait state, without apparent reason. Later in the final…

You know, I hadn't actually considered mentioning it. Another commenter brought it up, too. It's so second nature I forgot about it entirely. I'll look about giving it a nod in the text, thank you for the feedback. :)

Exponential retries can effectively have a maximum number of requests if the gap between retries gets long enough quickly enough. In practice, the user will refresh or close the page if things look broken for too long.

Re: Retries – An interactive study of request retry methods

#20
This is one of those things that sort of exposes our industry maturity versus other engineering that's been around longer. You would think by now that the various frameworks for remote calls would have standardized down to include the best practice retry patterns, with standard names, setting ranges, etc. But we mostly still roll our own for most languages/frameworks. And that's full of footguns around DNS caching, when/how to retry on certain failures (unauthorized, for example), and so on.

(Yes, there should also be the non-abstracted direct path for cases where you do want to roll your own).

Post reply on HN