August 19, 2014
###Corrections:
###Note:
I’ve been chatting with some very helpful RabbitMQ-knowledgeable people, and they have some suggestions for the issues I’m seeing that I’m going to check out. I will update this article with my findings.
I want to thank Alvaro Videla and Michael Klishin for reading my first attempt at this post and suggesting different avenues to explore.
For the two of you who don’t know, RabbitMQ is a really neat AMQP-compliant queue broker. It exists to facilitate the passing of messages between or within systems. I’ve used it for a couple of different projects, and I’ve found it to be tremendously capable: I’ve seen a RabbitMQ instance running on a single, moderately sized, VM handle almost 3GB/s.
I was doing some load testing with RabbitMQ recently, and I found
that, if I started attempting to publish more than around 2500 10KB
messages per second, about 4% as much as 0.2% of those
messages wouldn’t make it to the queue during some test runs. I am not
sure if this is my code’s fault or if I am running into the limits of
the RabbitMQ instance I was testing against (probably the former), but
with the help of the RabbitMQ community, I was able to come up with some
best practices that I’ve described below.
The examples below are all in Go, but I’ve tried my best to explain them in such a way that people who are not familiar with Go can understand them.
If you’re unfamiliar with AMQP, here’s some terminology to help understand what’s possible with a queue broker and what the words mean.
Here is the load tester I wrote: https://github.com/backstop/rabbit-mq-stress-tester. It uses the streadway/amqp library. Per this issue, my stress tester does not share connections or channels between Goroutines – it launches a configurably-sized pool of Goroutines, each of which maintains its own connection to the RabbitMQ server.