1 minute read

The retry pattern, a common cloud design pattern when dealing with third-party interactions, encourages applications to expect failures. Processes that implement the retry pattern create fault-tolerant systems that require minimal long-term maintenance. These processes are implemented with the ability to safely retry failed operations.

The retry pattern is often seen in webhook implementations. When one service tries to send a webhook to another service, that request can do one of two things:

  1. Succeed. If it succeeds, then the operation is completed.
  2. Fail. If it fails, the sending service can resend the webhook a limited number of times until the request is successful. To avoid overloading the target system, many webhook implementations will use an incremental backoff, gradually adding time delays between each request to give a faulty destination time to recover before giving up.

The retry pattern only works when both the sender and receiver know that failed requests can be re-sent. In the webhook example, a unique identifier for each webhook is often provided, allowing the receiver to validate that a request is never processed more than once.

This avoids duplicates while also making it possible for the sender to experience its own errors that could erroneously re-send redundant data.