Available Backoff Strategies

Cadence currently includes the following backoff strategies:

StrategyDescription
exponentialApplies progressively increasing delays using an exponential growth pattern, causing the delay to increase rapidly as failures accumulate.
fibonacciApplies progressively increasing delays following the Fibonacci sequence, providing a gradual and adaptive backoff pattern.
linearApplies progressively increasing delays using a linear growth pattern, increasing the delay by a consistent amount after each failure.
quadraticApplies progressively increasing delays using a quadratic growth pattern, causing the delay to increase at an accelerating rate as failures accumulate.

Every built-in backoff strategy can optionally be combined with a jitter algorithm. See Applying Jitter for examples and available algorithms.

Exponential Backoff

The exponential strategy applies delays that grow exponentially based on the configured base_delay.

$cadence = Cadence::driver('exponential');

Configuration:

'exponential' => [
    'base_delay' => 2,
],

Behavior: Each violation doubles the delay from the previous one, starting from the base delay.

Fibonacci Backoff

The fibonacci strategy applies delays that follow the Fibonacci sequence, multiplied by the configured base_delay.

$cadence = Cadence::driver('fibonacci');

Configuration:

'fibonacci' => [
    'base_delay' => 1,
],

Behavior: Each violation progresses through the Fibonacci sequence (1, 1, 2, 3, 5, 8, ...), multiplied by the base delay.

Linear Backoff

The linear strategy applies delays that increase linearly based on the configured base_delay.

$cadence = Cadence::driver('linear');

Configuration:

'linear' => [
    'base_delay' => 2,
],

Behavior: Each violation increases the delay by the base delay amount.

Quadratic Backoff

The quadratic strategy applies delays that grow quadratically based on the configured base_delay.

$cadence = Cadence::driver('quadratic');

Configuration:

'quadratic' => [
    'base_delay' => 1,
],

Behavior: Each violation increases the delay proportionally to the square of the violation count, multiplied by the base delay.

Choosing a Strategy

StrategyBest For
ExponentialMost use cases; fast escalation
FibonacciModerate escalation with predictable growth
LinearPredictable, steady increase in delays
QuadraticAggressive escalation for sensitive operations