Skip to content

Message queue testing: do and don't

Queue tests fail in quiet ways: a deep backlog, a skewed clock or a shared topic can make a healthy system look broken, or a broken one look healthy. These rules cover the mistakes that matter most. They apply to every guide in Message queue testing.

  1. Do test a non-production broker, or an isolated topic or queue you are authorised to load. Don’t point a load test at a shared production queue. Test messages mix with real ones and consumers process them.
  2. Do keep consumers at or below the partition count (Kafka) and tune prefetch (RabbitMQ). Don’t add consumers past the partition count. The extras sit idle and the consume rate stops scaling.
  3. Do keep producers and consumers on one runner when you read end-to-end latency, or sync clocks with NTP. Don’t compare timestamps across unsynchronised machines. Clock skew adds straight into end-to-end latency.
  4. Do watch the trend of end-to-end latency over the run. Don’t rely on its average. A steady climb means consumers are falling behind even when the average looks fine.
  5. Do use a realistic payload size. Don’t send tiny messages and conclude the broker handles your traffic. Message size changes throughput and latency.
  6. Do warm up before judging. Don’t read the first seconds as steady state. Connections, partition leaders and caches are cold at the start.
  7. Do separate send-path errors from consume-path errors. Don’t treat one failure count as a verdict. The <queue> send and <queue> end-to-end labels fail for different reasons.
  8. Do clean up the test topics, queues and streams afterwards. Don’t leave test data behind. Leftover backlog skews the next run and may cost money.
  9. Do store broker URLs and credentials as bound SECRET_* secrets. Don’t paste credentials into the locustfile.py.
  10. Do make sure the broker is reachable from the runners. Don’t expect managed runners to reach a private network. Use a private datacenter outpost.