MQTT vs CoAP vs AMQP benchmarks: what a 16-byte reading costs

Networking

Three protocols are the usual candidates when a device has to send small readings to a server. MQTT keeps one TCP connection open to a broker and publishes to topics. CoAP is HTTP’s shape (GET, POST, URIs, response codes) squeezed into UDP datagrams, made for constrained devices; it secures itself with DTLS, TLS’s datagram sibling, and lets a client observe a resource to be told about every change. AMQP is the enterprise message queue: RabbitMQ’s original AMQP 0-9-1 and the different, standardised AMQP 1.0, which RabbitMQ 4 speaks natively on the same port.

Each has a fire-and-forget mode and an acknowledged one, and the difference is where the interesting costs are. This benchmark measures all eight modes with the same 16-byte reading, on the same machine and the same emulated links: what goes over the wire, what the device’s radio has to send and receive, how long a connection takes to open, what packet loss does to delivery, and what it costs to stay connected. It follows the method of the MQTT vs HTTPS benchmark. Every message carries its sequence number and a payload derived from it, and every receiver checks every byte: 21,353,004 delivered messages, 0 corrupted, 0 duplicated.

SetupDetails
MQTTMosquitto 2.1.2 (eclipse-mosquitto:2), defaults apart from the TLS 1.3 listener, anonymous clients and set_tcp_nodelay true (the MQTT vs HTTPS benchmark measured what Nagle’s algorithm costs without it) · client: a minimal MQTT 5 client, QoS 0 and QoS 1
CoAPGo 1.26 server and client on go-coap 3.5.9 over pion/dtls 3.1.15, DTLS 1.2 · POST publishes, GET with Observe (RFC 7641) subscribes · NON: non-confirmable, with No-Response (RFC 7967) so nothing comes back · CON: confirmable, answered by a 2.04 in the acknowledgement · notifications to the subscriber in the same mode · RFC 7252 timers: 2 s acknowledgement timeout, 4 retransmissions, one exchange in flight (NSTART = 1)
AMQPRabbitMQ 4.4.0 (Erlang/OTP 29), one node, defaults apart from TLS 1.3 only · publishes to the amq.topic exchange, transient messages, classic queues · 0-9-1 (amqp091-go 1.16): without and with publisher confirms · 1.0 (go-amqp 1.7): pre-settled and unsettled transfers · SASL ANONYMOUS on both
SecurityTCP protocols: TLS 1.3, TLS_AES_128_GCM_SHA256 · CoAP: DTLS 1.2, TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8, the suite RFC 7252 mandates for certificates, with the cookie exchange · both: key exchange X25519, the same ECDSA P-256 certificate, full handshake every time (no resumption) · a second CoAP variant with a pre-shared key, TLS_PSK_WITH_AES_128_CCM_8
NetworkOne network namespace, IPv4 loopback at a 1,500-byte MTU with offloads off, so packets have real sizes · packets counted per direction by firewall rules on the server ports · links emulated with tc netem: LAN (nothing added), 50 ms round trip, 200 ms round trip with 1 % and with 5 % random loss in each direction
CPUAMD Ryzen AI Max+ 395 · cores 0–7 and their SMT siblings reserved for the benchmark · Mosquitto, RabbitMQ (one Erlang scheduler) and the CoAP server one core each, clients on four more
MethodEvery cell is a fresh client process, run 5 times · reported value: median of the 5 run values, with min–max · p99: each run’s 99th percentile, median across runs · one warm-up message before every latency and throughput cell, and a wait for a quiet link before every cell

The scoreboard

Scoreboard, median per protocol, acknowledged modes. Bytes per message, both directions: MQTT QoS 1 192 B, CoAP CON 172 B, AMQP 0-9-1 257 B, AMQP 1.0 229 B. New connection, 50 ms link: MQTT QoS 1 203 ms, CoAP CON 204 ms, AMQP 0-9-1 406 ms, AMQP 1.0 457 ms. New connection, 200 ms + 5 % loss: MQTT QoS 1 803 ms, CoAP CON 804 ms, AMQP 0-9-1 1,608 ms, AMQP 1.0 1,809 ms. Delivery, LAN: MQTT QoS 1 14 µs, CoAP CON 30 µs, AMQP 0-9-1 45 µs, AMQP 1.0 41 µs. Delivery p99, 200 ms + 5 % loss: MQTT QoS 1 696 ms, CoAP CON 2,210 ms, AMQP 0-9-1 849 ms, AMQP 1.0 866 ms. Messages/s, LAN: MQTT QoS 1 117,759 msg/s, CoAP CON 39,568 msg/s, AMQP 0-9-1 31,924 msg/s, AMQP 1.0 38,217 msg/s. Messages/s, 50 ms link: MQTT QoS 1 397 msg/s, CoAP CON 20 msg/s, AMQP 0-9-1 397 msg/s, AMQP 1.0 347 msg/s. Idle hour at a 60 s keep-alive: MQTT QoS 1 12.2 KB, CoAP CON 7.3 KB, AMQP 0-9-1 27.0 KB, AMQP 1.0 33.8 KB. Best in every run, out of 8 measures: MQTT QoS 1 on 2 · CoAP CON on 1; 5 have no fixed order Eight measures from the sections below · acknowledged modes · each protocol as a multiple of the best MQTT QoS 1 CoAP CON AMQP 0-9-1 AMQP 1.0 1× = the best median; grey line: lowest to highest run 1× (best) 2× 3× 5× 10× 20× Bytes per message, both directions MQTT QoS 1 192 B CoAP CON 172 B AMQP 0-9-1 257 B AMQP 1.0 229 B New connection, 50 ms link MQTT QoS 1 203 ms CoAP CON 204 ms AMQP 0-9-1 406 ms AMQP 1.0 457 ms New connection, 200 ms + 5 % loss MQTT QoS 1 803 ms CoAP CON 804 ms AMQP 0-9-1 1,608 ms AMQP 1.0 1,809 ms Delivery, LAN MQTT QoS 1 14 µs CoAP CON 30 µs AMQP 0-9-1 45 µs AMQP 1.0 41 µs Delivery p99, 200 ms + 5 % loss MQTT QoS 1 696 ms CoAP CON 2,210 ms AMQP 0-9-1 849 ms AMQP 1.0 866 ms Messages/s, LAN MQTT QoS 1 117,759 msg/s CoAP CON 39,568 msg/s AMQP 0-9-1 31,924 msg/s AMQP 1.0 38,217 msg/s Messages/s, 50 ms link MQTT QoS 1 397 msg/s CoAP CON 20 msg/s AMQP 0-9-1 397 msg/s AMQP 1.0 347 msg/s Idle hour at a 60 s keep-alive MQTT QoS 1 12.2 KB CoAP CON 7.3 KB AMQP 0-9-1 27.0 KB AMQP 1.0 33.8 KB Each bar is that protocol’s median as a multiple of the best median for the measure, log scale: 1× is the best, a bar twice as long is twice as costly. Grey line: lowest to highest of the 5 process runs; the median is printed after each bar.
Eight headline measures from the sections below, each protocol's median as a multiple of the best median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 5 process runs; grey line: lowest to highest run. Each protocol in its acknowledged mode: MQTT QoS 1, CoAP CON, AMQP 0-9-1 with publisher confirms, AMQP 1.0 unsettled; the fire-and-forget modes are in the sections. CoAP CON on the LAN is a 60,000-message burst (see the throughput section); the idle hour is per protocol, with the same 60 s setting for all.
Scoreboard, median per protocol, acknowledged modes. Bytes per message, both directions: MQTT QoS 1 192 B, CoAP CON 172 B, AMQP 0-9-1 257 B, AMQP 1.0 229 B. New connection, 50 ms link: MQTT QoS 1 203 ms, CoAP CON 204 ms, AMQP 0-9-1 406 ms, AMQP 1.0 457 ms. New connection, 200 ms + 5 % loss: MQTT QoS 1 803 ms, CoAP CON 804 ms, AMQP 0-9-1 1,608 ms, AMQP 1.0 1,809 ms. Delivery, LAN: MQTT QoS 1 14 µs, CoAP CON 30 µs, AMQP 0-9-1 45 µs, AMQP 1.0 41 µs. Delivery p99, 200 ms + 5 % loss: MQTT QoS 1 696 ms, CoAP CON 2,210 ms, AMQP 0-9-1 849 ms, AMQP 1.0 866 ms. Messages/s, LAN: MQTT QoS 1 117,759 msg/s, CoAP CON 39,568 msg/s, AMQP 0-9-1 31,924 msg/s, AMQP 1.0 38,217 msg/s. Messages/s, 50 ms link: MQTT QoS 1 397 msg/s, CoAP CON 20 msg/s, AMQP 0-9-1 397 msg/s, AMQP 1.0 347 msg/s. Idle hour at a 60 s keep-alive: MQTT QoS 1 12.2 KB, CoAP CON 7.3 KB, AMQP 0-9-1 27.0 KB, AMQP 1.0 33.8 KB. Best in every run, out of 8 measures: MQTT QoS 1 on 2 · CoAP CON on 1; 5 have no fixed order Eight measures from the sections below · acknowledged modes · each protocol as a multiple of the best MQTT QoS 1 CoAP CON AMQP 0-9-1 AMQP 1.0 1× = the best median; grey line: lowest to highest run 1× (best) 2× 3× 5× 10× 20× Bytes per message MQTT QoS 1 192 B CoAP CON 172 B AMQP 0-9-1 257 B AMQP 1.0 229 B New connection, 50 ms MQTT QoS 1 203 ms CoAP CON 204 ms AMQP 0-9-1 406 ms AMQP 1.0 457 ms New connection, 5 % loss MQTT QoS 1 803 ms CoAP CON 804 ms AMQP 0-9-1 1,608 ms AMQP 1.0 1,809 ms Delivery, LAN MQTT QoS 1 14 µs CoAP CON 30 µs AMQP 0-9-1 45 µs AMQP 1.0 41 µs Delivery p99, 5 % loss MQTT QoS 1 696 ms CoAP CON 2,210 ms AMQP 0-9-1 849 ms AMQP 1.0 866 ms Messages/s, LAN MQTT QoS 1 117,759 msg/s CoAP CON 39,568 msg/s AMQP 0-9-1 31,924 msg/s AMQP 1.0 38,217 msg/s Messages/s, 50 ms MQTT QoS 1 397 msg/s CoAP CON 20 msg/s AMQP 0-9-1 397 msg/s AMQP 1.0 347 msg/s Idle hour, 60 s keep-alive MQTT QoS 1 12.2 KB CoAP CON 7.3 KB AMQP 0-9-1 27.0 KB AMQP 1.0 33.8 KB Each bar is that protocol’s median as a multiple of the best median for the measure, log scale: 1× is the best, a bar twice as long is twice as costly. Grey line: lowest to highest of the 5 process runs; the median is printed after each bar.
Eight headline measures from the sections below, each protocol's median as a multiple of the best median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 5 process runs; grey line: lowest to highest run. Each protocol in its acknowledged mode: MQTT QoS 1, CoAP CON, AMQP 0-9-1 with publisher confirms, AMQP 1.0 unsettled; the fire-and-forget modes are in the sections. CoAP CON on the LAN is a 60,000-message burst (see the throughput section); the idle hour is per protocol, with the same 60 s setting for all.
MeasureMQTT QoS 1CoAP CONAMQP 0-9-1AMQP 1.0
Bytes per message, both directions192 B
192 B
172 B
172–262 B · 1.1×
257 B
257 B · 0.75×
229 B
229 B · 0.84×
New connection, 50 ms link203 ms
202–203 ms
204 ms
202–204 ms · same
406 ms
405–410 ms · 0.50×
457 ms
455–460 ms · 0.44×
New connection, 200 ms + 5 % loss803 ms
802–1,207 ms
804 ms
802–1,803 ms · same
1,608 ms
1,607–2,226 ms · 0.50×
1,809 ms
1,806–3,070 ms · 0.44×
Delivery, LAN14 µs
14–24 µs
30 µs
28–38 µs · 0.47×
45 µs
44–45 µs · 0.31×
41 µs
39–43 µs · 0.34×
Delivery p99, 200 ms + 5 % loss696 ms
622–1,048 ms
2,210 ms
2,209–4,208 ms · 0.31×
849 ms
661–1,011 ms · 0.82×
866 ms
633–2,045 ms · 0.80×
Messages/s, LAN117,759 msg/s
116,908–118,137 msg/s
39,568 msg/s
34,518–40,082 msg/s · 0.34×
31,924 msg/s
31,599–31,994 msg/s · 0.27×
38,217 msg/s
38,087–38,453 msg/s · 0.32×
Messages/s, 50 ms link397 msg/s
394–397 msg/s
20 msg/s
20 msg/s · 0.05×
397 msg/s
393–397 msg/s · same
347 msg/s
343–356 msg/s · 0.87×
Idle hour at a 60 s keep-alive12.2 KB
12.2–13.1 KB
7.3 KB
7.3 KB · 1.7×
27.0 KB
25.9–27.0 KB · 0.45×
33.8 KB
33.8 KB · 0.36×

Median of 5 process runs, lowest to highest run beneath; bold: best in every run; after the range, the factor against MQTT QoS 1: above 1× better than MQTT QoS 1, below 1× worse, same: rounds to 1×.

Counting a measure only where every run agrees, against MQTT QoS 1: CoAP CON is better on 1 (up to 1.7× on idle hour at a 60 s keep-alive), worse on 4 (down to 0.05× on messages/s, 50 ms link) and ties on 3; AMQP 0-9-1 is never better: worse on 6 (down to 0.27× on messages/s, LAN) and ties on 2; AMQP 1.0 is never better: worse on 7 (down to 0.32× on messages/s, LAN) and ties on 1. The sections below take each measure in turn, with the fire-and-forget modes, the 1 % loss link, CoAP with a pre-shared key and the runs behind every median.

Factor against MQTT QoS 1 per measure, above 1 is better than MQTT. Bytes per message, both directions: CoAP CON 1.1×, AMQP 0-9-1 0.75×, AMQP 1.0 0.84×. New connection, 50 ms link: CoAP CON 1.00×, AMQP 0-9-1 0.50×, AMQP 1.0 0.44×. New connection, 200 ms + 5 % loss: CoAP CON 1.00×, AMQP 0-9-1 0.50×, AMQP 1.0 0.44×. Delivery, LAN: CoAP CON 0.47×, AMQP 0-9-1 0.31×, AMQP 1.0 0.34×. Delivery p99, 200 ms + 5 % loss: CoAP CON 0.31×, AMQP 0-9-1 0.82×, AMQP 1.0 0.80×. Messages/s, LAN: CoAP CON 0.34×, AMQP 0-9-1 0.27×, AMQP 1.0 0.32×. Messages/s, 50 ms link: CoAP CON 0.05×, AMQP 0-9-1 1.00×, AMQP 1.0 0.87×. Idle hour at a 60 s keep-alive: CoAP CON 1.7×, AMQP 0-9-1 0.45×, AMQP 1.0 0.36×. Against MQTT QoS 1, 8 measures: CoAP CON better on 1; never better: AMQP 0-9-1 · AMQP 1.0 Medians of 5 process runs · log scale · above 1× is better than MQTT QoS 1 CoAP CON AMQP 0-9-1 AMQP 1.0 0.05× 0.1× 0.2× 0.5× 1× (parity) 2× Bytes per message, both directions CoAP CON 1.1× AMQP 0-9-1 0.75× AMQP 1.0 0.84× New connection, 50 ms link CoAP CON same AMQP 0-9-1 0.50× AMQP 1.0 0.44× New connection, 200 ms + 5 % loss CoAP CON same AMQP 0-9-1 0.50× AMQP 1.0 0.44× Delivery, LAN CoAP CON 0.47× AMQP 0-9-1 0.31× AMQP 1.0 0.34× Delivery p99, 200 ms + 5 % loss CoAP CON 0.31× AMQP 0-9-1 0.82× AMQP 1.0 0.80× Messages/s, LAN CoAP CON 0.34× AMQP 0-9-1 0.27× AMQP 1.0 0.32× Messages/s, 50 ms link CoAP CON 0.05× AMQP 0-9-1 same AMQP 1.0 0.87× Idle hour at a 60 s keep-alive CoAP CON 1.7× AMQP 0-9-1 0.45× AMQP 1.0 0.36× ← MQTT QoS 1 better the others better →
Each protocol's median against MQTT QoS 1's on the same measure, log scale; above 1× it is better than MQTT (fewer bytes, faster, more messages per second). Median of 5 process runs.
Factor against MQTT QoS 1 per measure, above 1 is better than MQTT. Bytes per message, both directions: CoAP CON 1.1×, AMQP 0-9-1 0.75×, AMQP 1.0 0.84×. New connection, 50 ms link: CoAP CON 1.00×, AMQP 0-9-1 0.50×, AMQP 1.0 0.44×. New connection, 200 ms + 5 % loss: CoAP CON 1.00×, AMQP 0-9-1 0.50×, AMQP 1.0 0.44×. Delivery, LAN: CoAP CON 0.47×, AMQP 0-9-1 0.31×, AMQP 1.0 0.34×. Delivery p99, 200 ms + 5 % loss: CoAP CON 0.31×, AMQP 0-9-1 0.82×, AMQP 1.0 0.80×. Messages/s, LAN: CoAP CON 0.34×, AMQP 0-9-1 0.27×, AMQP 1.0 0.32×. Messages/s, 50 ms link: CoAP CON 0.05×, AMQP 0-9-1 1.00×, AMQP 1.0 0.87×. Idle hour at a 60 s keep-alive: CoAP CON 1.7×, AMQP 0-9-1 0.45×, AMQP 1.0 0.36×. Against MQTT QoS 1, 8 measures: CoAP CON better on 1; never better: AMQP 0-9-1 · AMQP 1.0 Medians of 5 process runs · log scale · above 1× is better than MQTT QoS 1 CoAP CON AMQP 0-9-1 AMQP 1.0 0.05× 0.1× 0.2× 0.5× 1× (parity) 2× Bytes per message CoAP CON 1.1× AMQP 0-9-1 0.75× AMQP 1.0 0.84× New connection, 50 ms CoAP CON same AMQP 0-9-1 0.50× AMQP 1.0 0.44× New connection, 5 % loss CoAP CON same AMQP 0-9-1 0.50× AMQP 1.0 0.44× Delivery, LAN CoAP CON 0.47× AMQP 0-9-1 0.31× AMQP 1.0 0.34× Delivery p99, 5 % loss CoAP CON 0.31× AMQP 0-9-1 0.82× AMQP 1.0 0.80× Messages/s, LAN CoAP CON 0.34× AMQP 0-9-1 0.27× AMQP 1.0 0.32× Messages/s, 50 ms CoAP CON 0.05× AMQP 0-9-1 same AMQP 1.0 0.87× Idle hour, 60 s keep-alive CoAP CON 1.7× AMQP 0-9-1 0.45× AMQP 1.0 0.36× ← MQTT QoS 1 better the others better →
Each protocol's median against MQTT QoS 1's on the same measure, log scale; above 1× it is better than MQTT (fewer bytes, faster, more messages per second). Median of 5 process runs.

One reading on the wire

On a connection that is already open, what does the device send for one 16-byte reading? Start with the fire-and-forget modes and the single packet each one sends:

How the bytes of the one packet a device sends for a 16-byte reading divide into IP and TCP or UDP headers, TLS or DTLS framing, the protocol's own bytes and the payload. MQTT QoS 0: 52 B IP+TCP, 22 B TLS, 20 B protocol, 16 B payload, 110 B in total. CoAP NON: 28 B IP+UDP, 29 B DTLS, 33 B protocol, 16 B payload, 106 B in total. AMQP 0-9-1: 52 B IP+TCP, 22 B TLS, 71 B protocol, 16 B payload, 161 B in total. AMQP 1.0: 52 B IP+TCP, 22 B TLS, 40 B protocol, 16 B payload, 130 B in total. The packet a sensor sends for a 16-byte reading: 106 B over CoAP, 110 B over MQTT, 161 B over AMQP 0-9-1 Fire-and-forget mode, connection open · UDP’s header is 24 B smaller than TCP’s; DTLS framing is 7 B larger than TLS’s IP + TCP / UDP TLS / DTLS framing the protocol itself your 16 bytes grey line: lowest to highest run MQTT QoS 0 110 B 52 B IP + TCP + 22 B TLS + 20 B MQTT + 16 B payload CoAP NON 106 B 28 B IP + UDP + 29 B DTLS + 33 B CoAP + 16 B payload AMQP 0-9-1 161 B 52 B IP + TCP + 22 B TLS + 71 B AMQP + 16 B payload AMQP 1.0 130 B 52 B IP + TCP + 22 B TLS + 40 B AMQP + 16 B payload CoAP’s own framing is not small (33 B with go-coap’s 8-byte token and the path as three options, MQTT 20 B); what saves bytes is UDP. AMQP pays for a method frame, a content header and a body frame per message.
The packet the device sends for one 16-byte reading on an open connection, fire-and-forget mode, as counted on the interface (median of 5 runs × 200 messages), divided by what each layer costs per packet: 52 B of IPv4 + TCP (with timestamps) or 28 B of IPv4 + UDP, 22 B per TLS 1.3 record, 29 B per DTLS 1.2 record with AES-128-CCM-8. Replies and TCP acknowledgements are in the next figure.
How the bytes of the one packet a device sends for a 16-byte reading divide into IP and TCP or UDP headers, TLS or DTLS framing, the protocol's own bytes and the payload. MQTT QoS 0: 52 B IP+TCP, 22 B TLS, 20 B protocol, 16 B payload, 110 B in total. CoAP NON: 28 B IP+UDP, 29 B DTLS, 33 B protocol, 16 B payload, 106 B in total. AMQP 0-9-1: 52 B IP+TCP, 22 B TLS, 71 B protocol, 16 B payload, 161 B in total. AMQP 1.0: 52 B IP+TCP, 22 B TLS, 40 B protocol, 16 B payload, 130 B in total. The packet a sensor sends for a 16-byte reading: 106 B over CoAP, 110 B over MQTT, 161 B over AMQP 0-9-1 Fire-and-forget mode, connection open · UDP’s header is 24 B smaller than TCP’s; DTLS framing is 7 B larger than TLS’s IP + TCP / UDP TLS / DTLS framing the protocol itself your 16 bytes grey line: lowest to highest run MQTT QoS 0 110 B 52 B IP + TCP + 22 B TLS + 20 B MQTT + 16 B payload CoAP NON 106 B 28 B IP + UDP + 29 B DTLS + 33 B CoAP + 16 B payload AMQP 0-9-1 161 B 52 B IP + TCP + 22 B TLS + 71 B AMQP + 16 B payload AMQP 1.0 130 B 52 B IP + TCP + 22 B TLS + 40 B AMQP + 16 B payload CoAP’s own framing is not small (33 B with go-coap’s 8-byte token and the path as three options, MQTT 20 B); what saves bytes is UDP. AMQP pays for a method frame, a content header and a body frame per message.
The packet the device sends for one 16-byte reading on an open connection, fire-and-forget mode, as counted on the interface (median of 5 runs × 200 messages), divided by what each layer costs per packet: 52 B of IPv4 + TCP (with timestamps) or 28 B of IPv4 + UDP, 22 B per TLS 1.3 record, 29 B per DTLS 1.2 record with AES-128-CCM-8. Replies and TCP acknowledgements are in the next figure.

CoAP sends 106 B, MQTT 110 B. CoAP’s own framing is not the reason: with go-coap’s default 8-byte token, the path /sensors/42/temp as three Uri-Path options, a Content-Format and the No-Response option, its message is 33 bytes before the payload, against MQTT’s 20. DTLS framing is larger than TLS’s too: a 13-byte record header with the epoch and sequence number in it, and an 8-byte explicit nonce. What CoAP saves is the transport: UDP’s 8-byte header instead of TCP’s 32.

The bigger difference is what comes back. Counting both directions:

Bytes on the wire per 16-byte message, both directions, publisher connection only, connection open: MQTT QoS 0 162 B in 2.0 packets, MQTT QoS 1 192 B in 2.0 packets, CoAP NON 106 B in 1.0 packets, CoAP CON 172 B in 2.0 packets, AMQP 0-9-1 213 B in 2.0 packets, AMQP 0-9-1, confirms 257 B in 2.0 packets, AMQP 1.0, settled 168 B in 1.7 packets, AMQP 1.0, unsettled 229 B in 2.0 packets. Per 16-byte reading: CoAP NON 106 B in one packet; every TCP protocol at least 162 B in two, because TCP acknowledges even a fire-and-forget message Connection open · all headers included · bytes sent and received by the device · packets in brackets MQTT CoAP AMQP 0-9-1 AMQP 1.0 grey line: lowest to highest run MQTT QoS 0 162 B · 1↑ 1↓ MQTT QoS 1 192 B · 1↑ 1↓ CoAP NON 106 B · 1↑ 0↓ CoAP CON 172 B · 1↑ 1↓ AMQP 0-9-1 213 B · 1↑ 1↓ AMQP 0-9-1, confirms 257 B · 1↑ 1↓ AMQP 1.0, settled 168 B · 1↑ 1↓ AMQP 1.0, unsettled 229 B · 1↑ 1↓ ↑ packets the device sends · ↓ packets it receives, per message An acknowledgement is cheap over TCP: it replaces the ACK packet TCP sends anyway (MQTT QoS 1 +30 B). Over UDP it is a second packet: CoAP CON costs 66 B and one received packet more than NON.
Median of 5 process runs × 200 messages, IP packets counted on the interface before and after, split by direction. Sent = device to server, received = server to device (replies, acknowledgements and TCP's ACKs). In each pair the first mode is fire-and-forget, the second waits for the server's acknowledgement. Grey line: lowest to highest run. In one of the 5 runs the CoAP received count is higher: the server was still notifying a subscriber from an earlier cell (a likely cause, not verified: its DTLS close was lost on the 5 % link), and the firewall counts everything the server sends; the device itself sent and received the same packets in every run.
Bytes on the wire per 16-byte message, both directions, publisher connection only, connection open: MQTT QoS 0 162 B in 2.0 packets, MQTT QoS 1 192 B in 2.0 packets, CoAP NON 106 B in 1.0 packets, CoAP CON 172 B in 2.0 packets, AMQP 0-9-1 213 B in 2.0 packets, AMQP 0-9-1, confirms 257 B in 2.0 packets, AMQP 1.0, settled 168 B in 1.7 packets, AMQP 1.0, unsettled 229 B in 2.0 packets. Per 16-byte reading: CoAP NON 106 B in one packet; every TCP protocol at least 162 B in two, because TCP acknowledges even a fire-and-forget message Connection open · all headers included · bytes sent and received by the device · packets in brackets MQTT CoAP AMQP 0-9-1 AMQP 1.0 grey line: lowest to highest run MQTT QoS 0 162 B · 1↑1↓ MQTT QoS 1 192 B · 1↑1↓ CoAP NON 106 B · 1↑0↓ CoAP CON 172 B · 1↑1↓ AMQP 0-9-1 213 B · 1↑1↓ 0-9-1 confirms 257 B · 1↑1↓ AMQP 1.0 settled 168 B · 1↑1↓ 1.0 unsettled 229 B · 1↑1↓ ↑ packets the device sends · ↓ packets it receives, per message An acknowledgement is cheap over TCP: it replaces the ACK packet TCP sends anyway (MQTT QoS 1 +30 B). Over UDP it is a second packet: CoAP CON costs 66 B and one received packet more than NON.
Median of 5 process runs × 200 messages, IP packets counted on the interface before and after, split by direction. Sent = device to server, received = server to device (replies, acknowledgements and TCP's ACKs). In each pair the first mode is fire-and-forget, the second waits for the server's acknowledgement. Grey line: lowest to highest run. In one of the 5 runs the CoAP received count is higher: the server was still notifying a subscriber from an earlier cell (a likely cause, not verified: its DTLS close was lost on the 5 % link), and the firewall counts everything the server sends; the device itself sent and received the same packets in every run.
Per 16-byte messageSentReceivedPackets
sent / received
MQTT QoS 0110 B52 B1.00 / 1.00
MQTT QoS 1113 B79 B1.01 / 1.00
CoAP NON106 B0 B1.00 / 0.00
CoAP CON103 B69 B1.00 / 1.00
AMQP 0-9-1161 B52 B1.00 / 1.00
AMQP 0-9-1, confirms162 B95 B1.01 / 1.00
AMQP 1.0, settled130 B38 B1.00 / 0.72
AMQP 1.0, unsettled130 B99 B1.02 / 1.01

For a battery-powered radio the packet count matters more than the bytes. Waking up to transmit and staying awake to listen for a reply costs far more energy than the extra bytes in either packet. On that count CoAP NON is in a class of its own: one transmission, nothing to wait for. Every other mode, fire-and-forget or not, transmits once and then has to receive.

Opening a connection

From nothing to the first message acknowledged: the TCP handshake and TLS 1.3 for MQTT and AMQP, the DTLS 1.2 handshake for CoAP, then whatever the protocol needs before it may publish.

Time from nothing to the first message acknowledged, split into handshake, protocol session and first message. 50 ms round trip: MQTT, TLS 1.3 203 ms, CoAP, DTLS 1.2 certificate 204 ms, CoAP, DTLS 1.2 PSK 203 ms, AMQP 0-9-1, TLS 1.3 406 ms, AMQP 1.0, TLS 1.3 457 ms. 200 ms round trip, 1 % loss: MQTT, TLS 1.3 802 ms, CoAP, DTLS 1.2 certificate 803 ms, CoAP, DTLS 1.2 PSK 801 ms, AMQP 0-9-1, TLS 1.3 1,605 ms, AMQP 1.0, TLS 1.3 1,805 ms. 200 ms round trip, 5 % loss: MQTT, TLS 1.3 803 ms, CoAP, DTLS 1.2 certificate 804 ms, CoAP, DTLS 1.2 PSK 802 ms, AMQP 0-9-1, TLS 1.3 1,608 ms, AMQP 1.0, TLS 1.3 1,809 ms. A new connection on a 50 ms link: MQTT and CoAP 203 ms–204 ms (4 round trips each), AMQP 0-9-1 406 ms, AMQP 1.0 457 ms From nothing until the first message is acknowledged · each bar split into its phases TCP + TLS / DTLS handshake protocol session first message: protocol colour grey line: lowest to highest run 50 ms round trip MQTT, TLS 1.3 203 ms · 4.1 RTT CoAP, DTLS 1.2 certificate 204 ms · 4.1 RTT CoAP, DTLS 1.2 PSK 203 ms · 4.1 RTT AMQP 0-9-1, TLS 1.3 406 ms · 8.1 RTT AMQP 1.0, TLS 1.3 457 ms · 9.1 RTT 200 ms round trip, 5 % loss MQTT, TLS 1.3 803 ms · 4.0 RTT CoAP, DTLS 1.2 certificate 804 ms · 4.0 RTT CoAP, DTLS 1.2 PSK 802 ms · 4.0 RTT AMQP 0-9-1, TLS 1.3 1,608 ms · 8.0 RTT AMQP 1.0, TLS 1.3 1,809 ms · 9.0 RTT TLS 1.3 needs one round trip after TCP’s; DTLS 1.2 needs three (cookie, keys, finished) but no TCP. Then AMQP 0-9-1 spends 5 more round trips opening its connection, channel and confirms before the first message; CoAP none. With 5 % loss a lost handshake packet costs a 1 s timer on both sides (the stacks’ retransmission timers; not measured here).
New connection, full handshake (no session resumption), then one 16-byte message until it is acknowledged (MQTT QoS 1, CoAP CON, AMQP 0-9-1 with publisher confirms, AMQP 1.0 unsettled). Median of 5 process runs × 5 connections per phase boundary. RTT = round trips at that link's delay. LAN numbers and bytes are in the table below.
Time from nothing to the first message acknowledged, split into handshake, protocol session and first message. 50 ms round trip: MQTT, TLS 1.3 203 ms, CoAP, DTLS 1.2 certificate 204 ms, CoAP, DTLS 1.2 PSK 203 ms, AMQP 0-9-1, TLS 1.3 406 ms, AMQP 1.0, TLS 1.3 457 ms. 200 ms round trip, 1 % loss: MQTT, TLS 1.3 802 ms, CoAP, DTLS 1.2 certificate 803 ms, CoAP, DTLS 1.2 PSK 801 ms, AMQP 0-9-1, TLS 1.3 1,605 ms, AMQP 1.0, TLS 1.3 1,805 ms. 200 ms round trip, 5 % loss: MQTT, TLS 1.3 803 ms, CoAP, DTLS 1.2 certificate 804 ms, CoAP, DTLS 1.2 PSK 802 ms, AMQP 0-9-1, TLS 1.3 1,608 ms, AMQP 1.0, TLS 1.3 1,809 ms. A new connection on a 50 ms link: MQTT and CoAP 203 ms–204 ms (4 round trips each), AMQP 0-9-1 406 ms, AMQP 1.0 457 ms From nothing until the first message is acknowledged · each bar split into its phases TCP + TLS / DTLS handshake protocol session first message: protocol colour grey line: lowest to highest run 50 ms round trip MQTT 203 ms · 4.1 RTT CoAP cert. 204 ms · 4.1 RTT CoAP PSK 203 ms · 4.1 RTT AMQP 0-9-1 406 ms · 8.1 RTT AMQP 1.0 457 ms · 9.1 RTT 200 ms round trip, 5 % loss MQTT 803 ms · 4.0 RTT CoAP cert. 804 ms · 4.0 RTT CoAP PSK 802 ms · 4.0 RTT AMQP 0-9-1 1,608 ms · 8.0 RTT AMQP 1.0 1,809 ms · 9.0 RTT TLS 1.3 needs one round trip after TCP’s; DTLS 1.2 needs three (cookie, keys, finished) but no TCP. Then AMQP 0-9-1 spends 5 more round trips opening its connection, channel and confirms before the first message; CoAP none. With 5 % loss a lost handshake packet costs a 1 s timer on both sides (the stacks’ retransmission timers; not measured here).
New connection, full handshake (no session resumption), then one 16-byte message until it is acknowledged (MQTT QoS 1, CoAP CON, AMQP 0-9-1 with publisher confirms, AMQP 1.0 unsettled). Median of 5 process runs × 5 connections per phase boundary. RTT = round trips at that link's delay. LAN numbers and bytes are in the table below.
New connectionLAN50 ms200 ms
1 % loss
200 ms
5 % loss
BytesPackets
sent / received
MQTT, TLS 1.31.11 ms203 ms802 ms803 ms2,647 B9 / 7
CoAP, DTLS 1.2 certificate1.39 ms204 ms803 ms804 ms1,538 B4 / 4
CoAP, DTLS 1.2 PSK714 µs203 ms801 ms802 ms885 B4 / 4
AMQP 0-9-1, TLS 1.33.19 ms406 ms1,605 ms1,608 ms3,981 B13 / 11
AMQP 1.0, TLS 1.33.46 ms457 ms1,805 ms1,809 ms4,232 B14 / 12

The two security handshakes, exactly as measured:

After the handshake, the protocols differ by how many round trips they need before the first message counts:

On the 200 ms link loss barely moves the medians: at 5 % they are 804 ms for CoAP, 803 ms for MQTT, 1,608 ms and 1,809 ms for AMQP, the same round trips as at 1 %; most of the 25 connections per mode lost nothing. The loss shows in the slowest connection of each mode: 3,812 ms for CoAP, 2,067 ms for MQTT, 4,142 ms and 6,295 ms for AMQP. The explanation, from the stacks’ timers rather than a measurement: a lost handshake packet costs about a second on both sides, because TCP waits 1 s before resending a lost SYN and pion/dtls resends a handshake flight after 1 s. The more round trips a protocol needs, the more chances it has to lose one.

Delivery latency, and what loss does to it

Once connected: how long from publishing until the subscriber has the message? Through the broker or the CoAP server, so every message crosses the link twice. One message at a time.

Median deliveryLAN50 ms200 ms
1 % loss
200 ms
5 % loss
MQTT QoS 011 µs50.1 ms200 ms
p99 200 ms
200 ms
p99 1,020 ms
MQTT QoS 114 µs50.3 ms200 ms
p99 611 ms
200 ms
p99 696 ms
CoAP NON24 µs50.2 ms200 ms
p99 201 ms
200 ms
p99 201 ms
CoAP CON30 µs50.2 ms200 ms
p99 2,209 ms
200 ms
p99 2,210 ms
AMQP 0-9-130 µs50.2 ms200 ms
p99 605 ms
200 ms
p99 1,031 ms
AMQP 0-9-1, confirms45 µs50.3 ms200 ms
p99 201 ms
201 ms
p99 849 ms
AMQP 1.0, settled31 µs50.5 ms201 ms
p99 605 ms
200 ms
p99 637 ms
AMQP 1.0, unsettled41 µs50.5 ms201 ms
p99 605 ms
201 ms
p99 866 ms
CoAP CON, go-coap default tick––201 ms
p99 4,565 ms
201 ms
p99 5,224 ms

Without loss the protocols are indistinguishable once a connection is open: tens of microseconds on the LAN, one round trip on the 50 ms link (MQTT QoS 1 50.3 ms, CoAP CON 50.2 ms, AMQP 0-9-1 with confirms 50.3 ms). Acknowledgements do not delay delivery: every broker forwards a message before, or while, it acknowledges it.

Loss is where the transports part ways:

Delivery latency, publisher to subscriber, on the 200 ms link with 1 % and 5 % loss, median and 99th percentile: 200 ms round trip, 1 % loss: MQTT QoS 1 200 ms median, 611 ms p99, CoAP CON 200 ms median, 2,209 ms p99, CoAP CON, go-coap default tick 201 ms median, 4,565 ms p99, AMQP 0-9-1, confirms 200 ms median, 201 ms p99, AMQP 1.0, unsettled 201 ms median, 605 ms p99, MQTT QoS 0 200 ms median, 200 ms p99, CoAP NON 200 ms median, 201 ms p99, AMQP 0-9-1 200 ms median, 605 ms p99, AMQP 1.0, settled 201 ms median, 605 ms p99. 200 ms round trip, 5 % loss: MQTT QoS 1 200 ms median, 696 ms p99, CoAP CON 200 ms median, 2,210 ms p99, CoAP CON, go-coap default tick 201 ms median, 5,224 ms p99, AMQP 0-9-1, confirms 201 ms median, 849 ms p99, AMQP 1.0, unsettled 201 ms median, 866 ms p99, MQTT QoS 0 200 ms median, 1,020 ms p99, CoAP NON 200 ms median, 201 ms p99, AMQP 0-9-1 200 ms median, 1,031 ms p99, AMQP 1.0, settled 200 ms median, 637 ms p99. With 5 % loss the slowest 1 % of CoAP CON messages take 2,210 ms, acknowledged TCP modes 696 ms–866 ms, CoAP at go-coap’s default timer tick 5,224 ms 200 ms link · median stays at one round trip for everyone; loss shows in the tail MQTT CoAP AMQP 0-9-1 AMQP 1.0 99th percentile grey line: lowest to highest run median 200 ms round trip, 1 % loss MQTT QoS 1 200 ms → 611 ms CoAP CON 200 ms → 2,209 ms CoAP CON, go-coap default tick 201 ms → 4,565 ms AMQP 0-9-1, confirms 200 ms → 201 ms AMQP 1.0, unsettled 201 ms → 605 ms MQTT QoS 0 200 ms → 200 ms CoAP NON 200 ms → 201 ms · 3 % lost AMQP 0-9-1 200 ms → 605 ms AMQP 1.0, settled 201 ms → 605 ms 200 ms round trip, 5 % loss MQTT QoS 1 200 ms → 696 ms CoAP CON 200 ms → 2,210 ms CoAP CON, go-coap default tick 201 ms → 5,224 ms AMQP 0-9-1, confirms 201 ms → 849 ms AMQP 1.0, unsettled 201 ms → 866 ms MQTT QoS 0 200 ms → 1,020 ms CoAP NON 200 ms → 201 ms · 11 % lost AMQP 0-9-1 200 ms → 1,031 ms AMQP 1.0, settled 200 ms → 637 ms TCP resends after its RTO (200 ms minimum plus the round trip, doubling on repeated loss) and holds back what follows; CoAP CON resends after its 2 s ACK timeout, per message. CoAP NON never waits and never resends: what is lost is gone.
One 16-byte message at a time from the publisher until the subscriber has it, through the broker or CoAP server: two hops, each crossing the emulated link. Solid bar: median of 5 runs × 50 messages; lighter extension: each run's 99th percentile, median across runs. CoAP NON drops what is lost (lost share after the bar). Go-coap checks its retransmission timer every 4 s unless told otherwise; the 4 s tick row keeps that default, every other CoAP row checks every 10 ms. Grey line: lowest to highest run median.
Delivery latency, publisher to subscriber, on the 200 ms link with 1 % and 5 % loss, median and 99th percentile: 200 ms round trip, 1 % loss: MQTT QoS 1 200 ms median, 611 ms p99, CoAP CON 200 ms median, 2,209 ms p99, CoAP CON, go-coap default tick 201 ms median, 4,565 ms p99, AMQP 0-9-1, confirms 200 ms median, 201 ms p99, AMQP 1.0, unsettled 201 ms median, 605 ms p99, MQTT QoS 0 200 ms median, 200 ms p99, CoAP NON 200 ms median, 201 ms p99, AMQP 0-9-1 200 ms median, 605 ms p99, AMQP 1.0, settled 201 ms median, 605 ms p99. 200 ms round trip, 5 % loss: MQTT QoS 1 200 ms median, 696 ms p99, CoAP CON 200 ms median, 2,210 ms p99, CoAP CON, go-coap default tick 201 ms median, 5,224 ms p99, AMQP 0-9-1, confirms 201 ms median, 849 ms p99, AMQP 1.0, unsettled 201 ms median, 866 ms p99, MQTT QoS 0 200 ms median, 1,020 ms p99, CoAP NON 200 ms median, 201 ms p99, AMQP 0-9-1 200 ms median, 1,031 ms p99, AMQP 1.0, settled 200 ms median, 637 ms p99. With 5 % loss the slowest 1 % of CoAP CON messages take 2,210 ms, acknowledged TCP modes 696 ms–866 ms, CoAP at go-coap’s default timer tick 5,224 ms 200 ms link · median stays at one round trip for everyone; loss shows in the tail MQTT CoAP AMQP 0-9-1 AMQP 1.0 99th percentile grey line: lowest to highest run median 200 ms round trip, 1 % loss MQTT QoS 1 → 611 ms CoAP CON → 2,209 ms CoAP CON, 4 s tick → 4,565 ms 0-9-1 confirms → 201 ms 1.0 unsettled → 605 ms MQTT QoS 0 → 200 ms CoAP NON → 201 ms · 3 % lost AMQP 0-9-1 → 605 ms AMQP 1.0 settled → 605 ms 200 ms round trip, 5 % loss MQTT QoS 1 → 696 ms CoAP CON → 2,210 ms CoAP CON, 4 s tick → 5,224 ms 0-9-1 confirms → 849 ms 1.0 unsettled → 866 ms MQTT QoS 0 → 1,020 ms CoAP NON → 201 ms · 11 % lost AMQP 0-9-1 → 1,031 ms AMQP 1.0 settled → 637 ms TCP resends after its RTO (200 ms minimum plus the round trip, doubling on repeated loss) and holds back what follows; CoAP CON resends after its 2 s ACK timeout, per message. CoAP NON never waits and never resends: what is lost is gone.
One 16-byte message at a time from the publisher until the subscriber has it, through the broker or CoAP server: two hops, each crossing the emulated link. Solid bar: median of 5 runs × 50 messages; lighter extension: each run's 99th percentile, median across runs. CoAP NON drops what is lost (lost share after the bar). Go-coap checks its retransmission timer every 4 s unless told otherwise; the 4 s tick row keeps that default, every other CoAP row checks every 10 ms. Grey line: lowest to highest run median.

Throughput on one connection

How many messages per second can one connection deliver from a publisher to a subscriber? The publisher sends as fast as the mode allows, for 3 s on the LAN and 8 s on the 50 ms link. Acknowledged modes may have at most 20 messages unacknowledged: that is the receive maximum Mosquitto announces for MQTT QoS 1, and the same window is used for AMQP. CoAP CON may have one (NSTART = 1, as RFC 7252 says by default), and the CoAP server keeps one confirmable notification outstanding per subscriber, as RFC 7641’s congestion rules ask.

Messages delivered per second on one connection over the 50 ms link, log scale: MQTT QoS 0 81,334, MQTT QoS 1 397, CoAP NON 98,488, CoAP CON 20, AMQP 0-9-1 51,276, AMQP 0-9-1, confirms 397, AMQP 1.0, settled 3,171, AMQP 1.0, unsettled 347. One connection, 50 ms link: CoAP CON delivers 20 messages a second, the acknowledged TCP modes 347–397, MQTT QoS 0 and AMQP 0-9-1 51,276–81,334 Log scale: each gridline is 10× the previous one · what limits each row is how many messages it may have in flight MQTT CoAP AMQP 0-9-1 AMQP 1.0 grey line: lowest to highest run 10 100 1k 10k 100k 1M msg/s MQTT QoS 0 81,334 · 18 % dropped MQTT QoS 1 · 20 in flight 397 CoAP NON 98,488 · 49 % dropped CoAP CON · 1 in flight 20 AMQP 0-9-1 51,276 AMQP 0-9-1, confirms · 20 in flight 397 AMQP 1.0, settled · link credit 3,171 AMQP 1.0, unsettled · 20 in flight 347 In-flight limits set the ceiling on a slow link, not header size. CoAP NON has no limit and no back-pressure: 49 % of what it sent never arrived.
Publisher sending as fast as the mode allows for 8 s on the 50 ms link, 16-byte messages delivered to the subscriber per second, median of 5 runs. Acknowledged modes keep at most 20 messages in flight (Mosquitto's receive maximum; the same window for AMQP), CoAP CON one (NSTART = 1, RFC 7252's default). Log scale: each gridline is 10× the previous one. Grey line: lowest to highest run. Both links in the table below.
Messages delivered per second on one connection over the 50 ms link, log scale: MQTT QoS 0 81,334, MQTT QoS 1 397, CoAP NON 98,488, CoAP CON 20, AMQP 0-9-1 51,276, AMQP 0-9-1, confirms 397, AMQP 1.0, settled 3,171, AMQP 1.0, unsettled 347. One connection, 50 ms link: CoAP CON delivers 20 messages a second, the acknowledged TCP modes 347–397, MQTT QoS 0 and AMQP 0-9-1 51,276–81,334 Log scale: each gridline is 10× the previous one · what limits each row is how many messages it may have in flight MQTT CoAP AMQP 0-9-1 AMQP 1.0 grey line: lowest to highest run 10 100 1k 10k 100k 1M msg/s MQTT QoS 0 81,334 · 18 % dropped MQTT QoS 1 · 20 in flight 397 CoAP NON 98,488 · 49 % dropped CoAP CON · 1 in flight 20 AMQP 0-9-1 51,276 AMQP 0-9-1, confirms · 20 in flight 397 AMQP 1.0, settled · link credit 3,171 AMQP 1.0, unsettled · 20 in flight 347 In-flight limits set the ceiling on a slow link, not header size. CoAP NON has no limit and no back-pressure: 49 % of what it sent never arrived.
Publisher sending as fast as the mode allows for 8 s on the 50 ms link, 16-byte messages delivered to the subscriber per second, median of 5 runs. Acknowledged modes keep at most 20 messages in flight (Mosquitto's receive maximum; the same window for AMQP), CoAP CON one (NSTART = 1, RFC 7252's default). Log scale: each gridline is 10× the previous one. Grey line: lowest to highest run. Both links in the table below.
Messages/sLAN50 msLost
LAN / 50 ms
MQTT QoS 0223k
215k–231k
81k
77k–82k
0 / 18 %
MQTT QoS 1118k
117k–118k
397
394–397
0
CoAP NON111k
74k–111k
98k
66k–99k
55 % / 49 %
CoAP CON40k
35k–40k · a 60,000-message burst, see below
20
20–20
0
AMQP 0-9-155k
54k–55k
51k
51k–52k
0
AMQP 0-9-1, confirms32k
32k–32k
397
393–397
0
AMQP 1.0, settled64k
61k–65k
3,171
3,164–3,191
0
AMQP 1.0, unsettled38k
38k–38k
347
343–356
0

On the LAN this measures software: TLS or DTLS, the broker, the library. On the slow links it measures how many messages each mode allows in flight:

None of this matters for a sensor sending a reading a minute. It matters for a gateway forwarding a fleet over one uplink.

The cost of an idle hour

A device that has nothing to say still pays to stay connected.

Bytes per hour to keep one idle connection alive at a 60 s keep-alive setting: MQTT PINGREQ / PINGRESP 12.2 KB in 180 packets, CoAP ping (empty CON → RST) 7.3 KB in 120 packets, AMQP 0-9-1 heartbeat frames 27.0 KB in 380 packets, AMQP 1.0 empty frames 33.8 KB in 500 packets. An hour of staying connected at a 60 s setting: CoAP 7.3 KB, MQTT 12.2 KB, AMQP 27.0–33.8 KB Per hour, all headers included · packets per hour after the bar MQTT CoAP AMQP 0-9-1 AMQP 1.0 grey line: lowest to highest run MQTT PINGREQ / PINGRESP 12.2 KB · 180 packets CoAP ping (empty CON → RST) 7.3 KB · 120 packets AMQP 0-9-1 heartbeat frames 27.0 KB · 380 packets AMQP 1.0 empty frames 33.8 KB · 500 packets AMQP sends a heartbeat from both ends every half interval, so twice as often as an MQTT ping. CoAP has no protocol keep-alive; it pings only to keep a NAT mapping, or a server’s idle-session timer, from expiring.
Measured over 12 s per run (5 runs) with the keep-alive at 2 s (MQTT, CoAP: the client pings) or the heartbeat / idle timeout at 4 s (AMQP: both ends send at half of it), all headers and TCP acknowledgements included, then scaled to the same protocol setting of 60 s. Grey line: lowest to highest run.
Bytes per hour to keep one idle connection alive at a 60 s keep-alive setting: MQTT PINGREQ / PINGRESP 12.2 KB in 180 packets, CoAP ping (empty CON → RST) 7.3 KB in 120 packets, AMQP 0-9-1 heartbeat frames 27.0 KB in 380 packets, AMQP 1.0 empty frames 33.8 KB in 500 packets. An hour of staying connected at a 60 s setting: CoAP 7.3 KB, MQTT 12.2 KB, AMQP 27.0–33.8 KB Per hour, all headers included · packets per hour after the bar MQTT CoAP AMQP 0-9-1 AMQP 1.0 grey line: lowest to highest run MQTT ping 12.2 KB · 180 packets CoAP ping 7.3 KB · 120 packets AMQP 0-9-1 27.0 KB · 380 packets AMQP 1.0 33.8 KB · 500 packets AMQP sends a heartbeat from both ends every half interval, so twice as often as an MQTT ping. CoAP has no protocol keep-alive; it pings only to keep a NAT mapping, or a server’s idle-session timer, from expiring.
Measured over 12 s per run (5 runs) with the keep-alive at 2 s (MQTT, CoAP: the client pings) or the heartbeat / idle timeout at 4 s (AMQP: both ends send at half of it), all headers and TCP acknowledgements included, then scaled to the same protocol setting of 60 s. Grey line: lowest to highest run.

What this does not show

What the numbers say

Reproduce it

The harness is one Go program (the CoAP server, and clients for all four protocols), two broker configuration files and a driver script. It builds one image, starts Mosquitto, RabbitMQ and the CoAP server in the client’s network namespace, and runs every cell as a fresh client process:

./certs.sh                    # throwaway CA and ECDSA P-256 certificate for localhost
docker build -t iotb .        # Go 1.26 build, runs a self-test of the encoders and the checker
./up.sh 4-7 1 2 3             # client cores, then Mosquitto, RabbitMQ and CoAP server cores
docker exec iot-net tc qdisc replace dev lo root netem delay 100ms loss 5% limit 100000   # the 5 % link
docker exec iot-net ib run -test lat -kind coapcon -n 50 -settle 800ms

Each run prints one JSON line with every latency sample, the bytes and packets counted in each direction, and the check results: messages sent, received, corrupted, duplicated, missing and lost.

Questions? Let's Chat :)

protocols