Increasing popularity of AMQP interop prompted a wave of questions regarding which adapter is the fastest. In this post, I am going to share my findings of message publishing performance. There will be a similar post about consumption side.

as well as their interop adapters:

and one from Golang world:

We are going to compare performance of the libraries, the cost of an interop wrappers. It would also be also interesting to compare PHP implementations with something from another world to feel the difference. I chose streadway/amqp Go’s library which seems like widely used one.

A quick note on methodology. I ran benchmarks on DigitalOcean droplet (1Gb RAM, 1 CPU, Ubuntu 16.04 x64) inside docker containers. Every run was done in new containers. The benchmarks source code could be found here.

A picture is worth a thousand words so here’s some statistics:

Check for yourself

You can run benchmarks yourself. For that, you have to download enqueue dev repository, do composer install and run bench script. Like this:



composer install

BODY_SIZE=10000 ./bin/bench bench/AmqpExtBench.php --report=aggregate git clone https://github.com/php-enqueue/enqueue-dev.git composer installBODY_SIZE=10000 ./bin/bench bench/AmqpExtBench.php --report=aggregate

Conclusion