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.
- 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.
- 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.
- 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.
- 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.
- Do use a realistic payload size. Don’t send tiny messages and conclude the broker handles your traffic. Message size changes throughput and latency.
- Do warm up before judging. Don’t read the first seconds as steady state. Connections, partition leaders and caches are cold at the start.
- Do separate send-path errors from consume-path errors. Don’t treat one failure count as a verdict. The
<queue> sendand<queue> end-to-endlabels fail for different reasons. - 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.
- Do store broker URLs and credentials as bound
SECRET_*secrets. Don’t paste credentials into thelocustfile.py. - 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.