142

PHP AMQP clients. Benchmark them all! – formapro

 6 years ago
source link: https://blog.forma-pro.com/php-amqp-clients-benchmark-them-all-8a4e6adb1a6b?gi=12da26e2d35d
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PHP AMQP clients. Benchmark them all!

1*kAyK0H5TbNt3FUyh6PWGXA.png

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:

1*k6tczEH9wwCespNY7PCHZA.png
1*x0EwmWsVwm3sTK2Epw1VWQ.png

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 https://github.com/php-enqueue/enqueue-dev.git
composer install
BODY_SIZE=10000 ./bin/bench bench/AmqpExtBench.php --report=aggregate

Conclusion

  • 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.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK