PHP AMQP clients. Benchmark them all!

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:

git clone
composer install
BODY_SIZE=10000 ./bin/bench bench/AmqpExtBench.php --report=aggregate


  • amqp-ext is the fastest among PHP implementations.
  • bunny is almost as fast as the AMQP extension.
  • php-amqplib is sometimes two times slower than other solutions.
  • Interestingly Go script was the real winner only for a really small payload. For the rest it showed a bit better result than amqp-ext. It should’ve been much better IMO.
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.