MQTT vs CoAP Data Cost

MQTT vs CoAP Data Cost

animation
mqtt
coap
protocols
Try Change Reporting interval (minutes) while keeping message sizes fixed. Then press Calculate data cost.
Observe After pressing Calculate data cost, watch publish data per month and monthly cost as Reporting interval (minutes) changes.
Explain Explain why Reporting interval (minutes) changes publish data but leaves keepalive data fixed after you press Calculate data cost.

Technical boundaries. Application-byte budgets exclude lower-layer overhead and retransmissions. The model counts MQTT keepalive exchanges every 60 seconds; actual billed traffic includes framing, security and carrier policy.

TipPutting Numbers to It

This debate gets clearer when you quantify monthly traffic for each protocol strategy.

Dmonth=Nmsg/day×Smsg×3010242 MiB D_{month}=\frac{N_{msg/day}\times S_{msg}\times 30}{1024^2}\text{ MiB}

Worked example: 500 sensors sending every 15 minutes:

Nmsg/day=500×96=48,000 N_{msg/day}=500\times 96=48{,}000

Assume illustrative application-byte budgets, excluding lower-layer overhead and retransmissions: - CoAP message size Smsg=20S_{msg}=20 bytes - MQTT publish size =40=40 bytes plus a 30-byte allowance for each keepalive exchange every 60 s while the connection is idle

DCoAP=48,000×20×3010242≈27.5 MiB/monthDMQTT,pub=48,000×40×3010242≈54.9 MiB/monthDMQTT,keepalive=500×1440×30×3010242≈618.0 MiB/month \begin{aligned} D_{CoAP} &= \frac{48{,}000\times 20\times 30}{1024^2} \approx 27.5\text{ MiB/month}\\ D_{MQTT,pub} &= \frac{48{,}000\times 40\times 30}{1024^2} \approx 54.9\text{ MiB/month}\\ D_{MQTT,keepalive} &= \frac{500\times 1440\times 30\times 30}{1024^2} \approx 618.0\text{ MiB/month} \end{aligned}

Total MQTT traffic in this deliberately keepalive-heavy model is about 672.9672.9 MiB/month. At an illustrative $0.10/MiB, that is about $67.29 versus $2.75 for the CoAP model. Actual billed traffic includes lower-layer framing, security, and carrier policy.

MQTT vs CoAP Data Cost

Back to the chapter