Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Yii2 Queue Wait Time Benchmark
$ php tests/yii benchmark/waiting fast 1000 10

- gearmanQueue:     MEDIAN = 0.0005 s; AVG = 0.0006 s; MIN = 0.0002 s; MAX = 0.0049 s
- beanstalkQueue:   MEDIAN = 0.0007 s; AVG = 0.0008 s; MIN = 0.0004 s; MAX = 0.0135 s
- redisQueue:       MEDIAN = 0.0013 s; AVG = 0.0014 s; MIN = 0.0006 s; MAX = 0.0056 s
- amqpQueue:        MEDIAN = 0.0016 s; AVG = 0.0020 s; MIN = 0.0007 s; MAX = 0.0595 s
- mysqlQueue:       MEDIAN = 0.8187 s; AVG = 0.7847 s; MIN = 0.0021 s; MAX = 0.9679 s
- fileQueue:        MEDIAN = 0.8408 s; AVG = 0.8332 s; MIN = 0.0407 s; MAX = 0.9703 s

Completed in 443 s.

Here 1000 jobs were pushed into queue and 10 workers handled this. Each worker was started without isolate mode to evaluate waiting time witout command bootstraping of each job.

$ php tests/yii benchmark/waiting default 1000 10

- gearmanQueue:     MEDIAN = 0.0763 s; AVG = 0.0783 s; MIN = 0.0442 s; MAX = 0.1274 s
- beanstalkQueue:   MEDIAN = 0.0763 s; AVG = 0.0786 s; MIN = 0.0474 s; MAX = 0.1296 s
- redisQueue:       MEDIAN = 0.0766 s; AVG = 0.0794 s; MIN = 0.0484 s; MAX = 0.1443 s
- amqpQueue:        MEDIAN = 0.0791 s; AVG = 0.0814 s; MIN = 0.0461 s; MAX = 0.1935 s
- mysqlQueue:       MEDIAN = 0.7793 s; AVG = 0.6619 s; MIN = 0.0423 s; MAX = 1.0258 s
- fileQueue:        MEDIAN = 0.8024 s; AVG = 0.6933 s; MIN = 0.0413 s; MAX = 1.1020 s

Completed in 493 s.

The second test shows result that was caught using workers in isolate mode. There is ~75 ms bootstrap time of each job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment