Asynchronous messaging is a cornerstone of modern distributed systems, enabling decoupled communication for scalable and resilient applications. Today's message queue (MQ) ecosystem spans a wide range of designs, from high-throughput streaming platforms to lightweight protocols tailored for edge and IoT environments. Despite this diversity, choosing an appropriate MQ system remains difficult. Existing evaluations largely focus on throughput and latency on fixed hardware, while overlooking CPU and memory footprint and the effects of resource constraints, factors that are critical for edge and IoT deployments. In this paper, we present a systematic performance study of eight prominent message brokers: Mosquitto, EMQX, HiveMQ, RabbitMQ, ActiveMQ Artemis, NATS Server, Redis (Pub/Sub), and Zenoh Router. We introduce mq-bench, a unified benchmarking framework to evaluate these systems under identical conditions, scaling up to 10,000 concurrent client pairs across three VM configurations representative of edge hardware. This study reveals several interesting and sometimes counter-intuitive insights. Lightweight native brokers achieve sub-millisecond latency, while feature-rich enterprise platforms incur 2-3X higher overhead. Under high connection loads, multi-threaded brokers like NATS and Zenoh scale efficiently, whereas the widely-deployed Mosquitto saturates earlier due to its single-threaded architecture. We also find that Java-based brokers consume significantly more memory than native implementations, which has important implications for memory-constrained edge deployments. Based on these findings, we provide practical deployment guidelines that map workload requirements and resource constraints to appropriate broker choices for telemetry, streaming analytics, and IoT use cases.
翻译:异步消息传递是现代分布式系统的基石,支持可扩展和弹性应用中的解耦通信。当今的消息队列生态系统涵盖了从高吞吐量流式处理平台到为边缘和物联网环境量身定制的轻量级协议的广泛设计。尽管存在这种多样性,但选择合适的消息队列系统仍然困难。现有的评估主要关注固定硬件上的吞吐量和延迟,而忽略了中央处理器和内存占用以及资源约束的影响,这些因素对于边缘和物联网部署至关重要。在本文中,我们对八个主流的消息代理:Mosquitto、EMQX、HiveMQ、RabbitMQ、ActiveMQ Artemis、NATS Server、Redis (Pub/Sub) 和 Zenoh Router 进行了系统的性能研究。我们引入了 mq-bench,一个统一的基准测试框架,用于在相同条件下评估这些系统,在三种代表边缘硬件的虚拟机配置中扩展到多达 10,000 个并发客户端对。这项研究揭示了一些有趣且有时反直觉的见解。轻量级的原生代理实现了亚毫秒级的延迟,而功能丰富的企业级平台则会产生 2-3 倍的更高开销。在高连接负载下,像 NATS 和 Zenoh 这样的多线程代理可以高效扩展,而广泛部署的 Mosquitto 由于其单线程架构而更早饱和。我们还发现,基于 Java 的代理比原生实现消耗的内存显著增加,这对内存受限的边缘部署具有重要意义。基于这些发现,我们提供了实用的部署指南,将工作负载需求和资源约束映射到遥测、流式分析和物联网用例中合适的代理选择上。