TL;DR:
- Mosquitto is the right choice for small-scale edge deployments, single-server setups, and development/testing — it’s lightweight, well-documented, and runs on a Raspberry Pi
- HiveMQ is the enterprise choice: Java-based, horizontally scalable, with strong tooling for compliance-heavy industries (automotive, industrial, healthcare)
- EMQX is designed for cloud-native scale: Erlang-based clustering, millions of concurrent connections, Kubernetes-native, and the most comprehensive MQTT 5.0 implementation available
MQTT is the dominant protocol for IoT device-to-cloud and device-to-device messaging. But the protocol is just the spec — the broker is what you’re actually running in production, and broker choice shapes everything from operational complexity to maximum connection count to your disaster recovery options.
Three brokers dominate the market: Mosquitto (the lean open-source standard), HiveMQ (the enterprise-grade Java platform), and EMQX (the cloud-native scale contender). Here’s when each is the right tool.
Mosquitto: The Lean Standard
Eclipse Mosquitto is the reference MQTT broker — it’s what most developers learn MQTT on, it implements the spec cleanly, and it runs on hardware that would make other brokers laugh. A Mosquitto instance runs comfortably on a Raspberry Pi Zero with minimal RAM overhead.
Strengths:
- Minimal resource footprint: handles tens of thousands of connections on modest hardware
- Dead simple configuration: a single text config file covers everything
- Excellent documentation, massive community
- Supports MQTT 3.1, 3.1.1, and 5.0
- Available as a package on every major Linux distribution
Limitations:
- Single-process architecture: no native horizontal clustering (third-party clustering exists but adds complexity)
- Limited observability out of the box: you need external tooling for metrics dashboards
- Basic persistence: message queuing for offline clients works but lacks advanced delivery guarantees at scale
- No built-in web management interface
Best for: Edge deployments (factory floor, facility), development environments, single-server setups below ~100,000 connections, home automation (Home Assistant ships with Mosquitto), and scenarios where resource footprint matters.
Basic configuration:
# /etc/mosquitto/mosquitto.conf
listener 1883
listener 8883
cafile /etc/mosquitto/ca.crt
certfile /etc/mosquitto/server.crt
keyfile /etc/mosquitto/server.key
allow_anonymous false
password_file /etc/mosquitto/passwd
persistence true
persistence_location /var/lib/mosquitto/
log_type all
log_dest file /var/log/mosquitto/mosquitto.log
HiveMQ: Enterprise Java Platform
HiveMQ is the broker of choice in industries where messaging reliability has safety or compliance implications: automotive (V2X communication), industrial automation, healthcare device connectivity, financial services IoT. It’s Java-based, runs as a cluster, and ships with an enterprise feature set that reflects the requirements of organisations that can’t afford message loss.
Strengths:
- Native horizontal clustering: add nodes without downtime, distribute load across the cluster
- Built-in control plane web interface (HiveMQ Control Center) for monitoring and management
- Extension SDK: build custom authentication, authorization, logging, and message transformation extensions in Java
- MQTT over WebSockets support for browser-based clients
- Strong enterprise support contracts
- HIVEMQ Cloud (managed hosting) for teams who don’t want to run infrastructure
Limitations:
- Java resource footprint: significantly heavier than Mosquitto, requires proper JVM tuning
- Commercial licensing for the full feature set (HiveMQ Community Edition is open source but limited)
- Configuration complexity scales with cluster size
Best for: Enterprise production deployments where horizontal scaling is required, industries with compliance requirements, organisations that need extension points for custom auth/authz logic, and teams that benefit from commercial support.
Connection limits: HiveMQ Enterprise clusters can handle millions of concurrent connections distributed across nodes. The Community Edition is capped at 25 connected clients — not suitable for production.
# Docker Compose for HiveMQ
services:
hivemq:
image: hivemq/hivemq4:latest
ports:
- "1883:1883"
- "8083:8083" # WebSocket
- "8080:8080" # Control Center
environment:
- HIVEMQ_CLUSTER_ENABLED=false
volumes:
- ./hivemq-config.xml:/opt/hivemq/conf/config.xml
EMQX: Cloud-Native at Millions of Connections
EMQX (written in Erlang/OTP) is designed from the ground up for high-concurrency scenarios. Erlang’s actor model and fault-tolerance primitives make it a natural fit for a message broker handling millions of simultaneous connections. A single EMQX node can handle 2M+ concurrent MQTT connections depending on hardware; a 3-node cluster can support 100M connections in benchmark conditions.
Strengths:
- True horizontal clustering with automatic load distribution and node discovery
- Kubernetes operator for cloud-native deployment and scaling
- The most comprehensive MQTT 5.0 support including Shared Subscriptions, Message Expiry, Flow Control, and Reason Codes
- Built-in rule engine for message routing, transformation, and filtering at the broker level (before messages reach your backend)
- Extensive integrations: Kafka, Pulsar, TimescaleDB, InfluxDB, Redis, MySQL, PostgreSQL — configured via the rule engine
- EMQX Cloud: managed global MQTT cloud infrastructure
- Active open-source community and commercial backing from EMQ Technologies
Limitations:
- More complex than Mosquitto to configure and operate
- Erlang expertise required for deep customisation or debugging
- The open-source edition is feature-rich but some enterprise features (SSO, audit logging, advanced RBAC) are in the commercial EMQX Enterprise tier
Best for: Cloud-native IoT platforms handling 100K+ concurrent connections, deployments that need Kubernetes-native scaling, scenarios requiring message transformation/routing at the broker layer, and applications connecting MQTT to Kafka or time-series databases without a separate integration layer.
Rule engine example (route temperature readings to TimescaleDB):
-- EMQX rule engine
SELECT
payload.device_id as device_id,
payload.temperature as temperature,
payload.timestamp as ts
FROM "sensors/+/temperature"
WHERE payload.temperature > 0
-- Action: INSERT INTO timescaledb
# Kubernetes deployment with EMQX Operator
kubectl apply -f https://github.com/emqx/emqx-operator/releases/download/2.2.0/emqx-operator-controller.yaml
cat <<EOF | kubectl apply -f -
apiVersion: apps.emqx.io/v2beta1
kind: EMQX
metadata:
name: emqx
spec:
image: emqx:5.8
replicantTemplate:
spec:
replicas: 3
EOF
MQTT 5.0 Support Comparison
MQTT 5.0 introduced features that matter significantly for production IoT — particularly for device fleet management and reliability:
| Feature | Mosquitto | HiveMQ | EMQX |
|---|---|---|---|
| Shared subscriptions | ✓ | ✓ | ✓ |
| Message expiry interval | ✓ | ✓ | ✓ |
| Reason codes | ✓ | ✓ | ✓ |
| Topic aliases | ✓ | ✓ | ✓ |
| Request/response pattern | ✓ | ✓ | ✓ |
| Flow control (receive maximum) | ✓ | ✓ | ✓ |
| Enhanced auth | Partial | ✓ | ✓ |
| Subscriptions options (retain handling) | ✓ | ✓ | ✓ |
All three brokers cover the core MQTT 5.0 spec. HiveMQ and EMQX offer more complete implementations of enhanced authentication flows.
Decision Framework
Choose Mosquitto when:
- You need a lightweight broker at the edge or on constrained hardware
- Your connection count stays below ~50,000 concurrent clients on a single server
- You want minimum operational overhead and a single-file configuration
- Development, testing, or home automation
Choose HiveMQ when:
- You operate in a regulated industry (automotive, healthcare, industrial) where enterprise support contracts matter
- You need custom extension logic in Java integrated directly into the broker
- Your team is comfortable with Java-based infrastructure
- You want a polished web management console out of the box
Choose EMQX when:
- You’re building a cloud-native IoT platform at scale (100K+ connections)
- You’re deploying on Kubernetes and want an operator-managed cluster
- You need message routing, transformation, and database integration at the broker layer without a separate service
- You want the most complete MQTT 5.0 implementation and active open-source development
A Note on Security for All Three
Whichever broker you choose, these configuration points apply:
- Always use TLS: MQTT over plain TCP should not exist in production. Both port 8883 (MQTT over TLS) and 8084 (MQTT over WebSocket TLS) should be enabled.
- Disable anonymous clients: The default in Mosquitto is to allow anonymous connections. Disable it.
- Use client certificates where device identity matters: mutual TLS authentication is the right approach for device-to-broker authentication in industrial settings.
- Enable ACLs: Topic-level access control prevents one device from subscribing to another device’s telemetry stream.
Summary
For most new IoT projects: start with Mosquitto if you’re building at modest scale with operational simplicity as a priority, and EMQX if you expect to scale to many tens of thousands of connections or want Kubernetes-native operation. HiveMQ’s sweet spot is established enterprise organisations in regulated industries where commercial support and Java extensibility are worth the cost. All three implement the MQTT protocol correctly — you’re choosing based on your operational requirements and growth trajectory.