29 Request retrial

This chapter covers

  • How to decide which failed API requests are safe to retry
  • Advanced exponential back-off strategies for retry timing
  • How to avoid stampeding herds
  • Ways APIs can dictate retry timing for clients

When errors occur in web APIs, some of them are due to client mistakes, while others are due to issues outside the client’s control. Often the best solution to this second group of errors is to retry the same request at a later time in hopes of a different result. In this pattern, we’ll explore a mechanism by which clients can have clear direction in both how and when they retry requests that have previously failed due to errors on the API server.

29.1 Motivation

It’s an inevitable fact of web APIs that some requests ...

Get API Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.