PHPackages                             avtonom/delay-exponential-backoff-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. avtonom/delay-exponential-backoff-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

avtonom/delay-exponential-backoff-bundle
========================================

Exponential backoff to delay for Symfony2 bundle for PHP

v1.1.0(9y ago)222MITPHPPHP &gt;=5.3.2

Since Feb 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Avtonom/delay-exponential-backoff-bundle)[ Packagist](https://packagist.org/packages/avtonom/delay-exponential-backoff-bundle)[ Docs](https://github.com/Avtonom/delay-exponential-backoff-bundle)[ RSS](/packages/avtonom-delay-exponential-backoff-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Avtonom Exponential backoff to delay
====================================

[](#avtonom-exponential-backoff-to-delay)

Exponential backoff is an algorithm that uses feedback to multiplicatively decrease the rate of some process, in order to gradually find an acceptable rate.

Page bundle:

```
    $ php bin/console exponential-backoff
    $ php bin/console exponential-backoff halfDelay -l 20

```

attemptmicrosecondssecondsminuteshours11500000001502.50.04230000000030050.083600000000600100.17412000000001200200.33524000000002400400.67648000000004800801.337960000000096001602.67819200000000192003205.339384000000003840064010.67107680000000076800128021.3311153600000000153600256042.67#### To Install

[](#to-install)

Run the following in your project root, assuming you have composer set up for your project

```
composer.phar require avtonom/exponential-backoff-bundle ~1.1
```

Switching `~1.1` for the most recent tag.

Add the bundle to app/AppKernel.php

```
$bundles(
    ...
            new Avtonom\ExponentialBackoffBundle\AvtonomExponentialBackoffBundle(),
    ...
);
```

Configuration options (parameters.yaml):

```
parameters:
    avtonom_exponential_backoff.cap: 1000000 # [OPTIONAL] - Max duration allowed (in microseconds). If backoff duration is greater than cap, cap is returned
    avtonom_exponential_backoff.max_attempts: 0 # [OPTIONAL] - Number of attemps before thrown an Exception

```

API
===

[](#api)

### getDefaultOptions():

[](#getdefaultoptions)

This method is static and returns an array with the default options:

- `cap`: Max duration allowed (in microseconds). If backoff duration is greater than cap, cap is returned, default is `1000000` microseconds.
- `maxAttempts`: Number of attempts before thrown an Yriveiro\\Backoff\\BackoffException. Default is `0`, no limit.

### halfDelay($attempt):

[](#halfdelayattempt)

### delay($attempt):

[](#delayattempt)

### exponential($attempt):

[](#exponentialattempt)

This method use and exponential function `E(attempt) = (2**attempt - 1)` to calculate backoff time.

#### Parameters

[](#parameters)

- `attempt`: incremental value that represents the current retry number.

### equalJitter($attempt);

[](#equaljitterattempt)

Exponential backoff has one disadvantage. In high concurrence, we can have multiples calls with the same backoff time due the time is highly bound to the current attempt, different calls could be in the same attempt.

To solve this we can add a jitter value to allow some randomization.

`equalJitter` uses the function: `E(attempt) = min(((2**attempt - 1) / 2), random(0, ((2**attempt - 1) / 2)))`.

#### Parameters

[](#parameters-1)

- `attempt`: incremental value that represents the current retry number.

### fullJitter($attempt);

[](#fulljitterattempt)

Full jitter behaves like `equalJitter` method, the main difference between them is the way in how the jitter value is calculated.

`fullJitter` uses the function: `E(attempt) = min(random(0, (2**attempt - 1) / 2))`.

#### Parameters

[](#parameters-2)

- `attempt`: incremental value that represents the current retry number.

Usage
=====

[](#usage)

```
    $attempt++;
    usleep($this->('avtonom_exponential_backoff')->equalJitter($attempt));

```

Read information

Use

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3423d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/851a2d4f8d02604c04bd2c4331a901e4fc92ed7ec1371cbceafb48c2495efc8c?d=identicon)[avtonomspb](/maintainers/avtonomspb)

---

Top Contributors

[![Avtonom](https://avatars.githubusercontent.com/u/988367?v=4)](https://github.com/Avtonom "Avtonom (1 commits)")

---

Tags

backoffbundledelayexponential-backoffjitterjobretrysymfony2bundleSymfony2jobretryJitterbackoffexponential backoffdelay

### Embed Badge

![Health badge](/badges/avtonom-delay-exponential-backoff-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/avtonom-delay-exponential-backoff-bundle/health.svg)](https://phpackages.com/packages/avtonom-delay-exponential-backoff-bundle)
```

###  Alternatives

[supertag/gearman-bundle

Gearman bundle for Symfony2 to manage and monitor PHP gearman jobs and queue

1441.3k](/packages/supertag-gearman-bundle)[yriveiro/php-backoff

Simple backoff / retry functionality

2679.3k1](/packages/yriveiro-php-backoff)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
