MQTT, CoAP and HTTP Under Constrained Networks: A Reproducible Benchmark with JSON and CBOR Encodings
IoT devices often communicate over slow, lossy links, yet protocol comparisons are frequently run on clean networks. We present a reproducible benchmark of MQTT, CoAP and HTTP with JSON and CBOR payloads under five emulated network profiles (baseline, 4G-like, 3G-like, 2G-like and 10% loss). Across 18,000 measured messages (three repetitions per configuration, plus 3,600 calibration messages), all three protocols delivered every message, but their costs differed sharply. CoAP needed 185 bytes on the wire per message versus 630 for HTTP (3.4x less) and tracked the link's one-way delay most closely. With 10% packet loss, however, CoAP's fixed 2-3 s retransmission timer produced a 95th-percentile latency of 2,670 ms, compared with 78 ms for HTTP and 382 ms for MQTT, and 7 of 1,200 CoAP messages were delivered but never acknowledged within 15 s. CBOR reduced payload size by 18% but total traffic by only 3-11%. We also document configuration pitfalls, including missing keep-alive, split writes interacting with Nagle's algorithm, and host-side emulation artifacts, which initially made HTTP appear about four times slower than it is. Code and data are released.
Authors
- Divij Karanam
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-02
- DOI
- https://doi.org/10.5281/zenodo.23885253
- Primary Topic
- IoT Networks and Protocols
- Type
- preprint