Google Cloud Tasks offer a good solution for controlling workflows in our backend infastructure, increasing load peaks resilency while keeping costs controlled.
Such a powerful solution requires a careful configuration to properly work, specially when dealing with task retrying policy. This feature is basically controlled by a set of properties described in the Google Cloud documentation and quickly described here:
- minBackoff: Elapsed time in seconds, from the initial task execution, that defines the lower limit of the incremental retry time window. The first retry will occur minBackoff seconds after the initial task execution.
- maxBackoff: Elapsed time in seconds, from the initial task execution, that defines the higher limit of the incremental retry time window. After reaching maxBackoff the retry time will not increment, and retries will occur every maxBackoff seconds.
- maxDoublings: Number of times that minBackoff will be doubled (multiplied by two) in order to be used as ellapsed time between retries. maxBackoff takes precedence over maxDoublings.
- maxRetryDuration: Time in seconds to retry running failed tasks. Tasks failing after maxRetryDuration seconds AND being retried maxAttemps times (both conditions) will be discarded.
- maxAttemps: Number of times a task execution is (re)tried. Note that if a task fails, it will be retried maxAttemps-1 times, since the first task execution must be also considered as an attempt. As previously said, tasks failing after maxRetryDuration seconds AND being (re)tried maxAttemps times (both conditions) will be discarded.
These properties can be seen in action in the next example diagram, in which they are set with these values:
- minBackoff: 1 second
- maxBackoff: 90 seconds
- maxDoublings: 5 times
- maxRetryDuration: 600 seconds (10 minutes)
- maxAttempts: 21 times
Comentarios
Publicar un comentario