MQTT Data Usage


#1

Long time lurker, thinker, and potential user. I’m probably doing more thinking and learning than I should and just dive in and experiment.

Has anyone logged how much data overhead you can expect per message while sending via an MQTT connection with a Hologram SIM? I know a message sent through the Hologram Cloud via a TCP connection typically costs ~500 bytes in overhead. My potential application is sending GPS coordinates at once or twice per minute, so cutting down on the overhead would be a huge data saver. @phogan @benstr @ChrisGammell any input?

I’ve read this thread SerialCloud.print data usage as well as the linked post on Medium by @ross Hologram.io Data Usage Breakdown but I have yet to see a quantified amount of data overhead when using an MQTT connection. I know this will probably vary based on which broker, but from what I’ve read MQTT is supposed to be a much more “light weight” connection on data usage. Just curious if anyone has any quantifiable numbers.

Thanks!

Disclaimer: I am extremely new, still learning a lot, and may be using terminology incorrectly, so please politely correct me if I’m wrong.


#2

@CoreyHass great question. The answer is it depends. :smile:

MQTT uses TCP under the covers. Data is saved by keeping a TCP session open and sending multiple stream messages during one extended session.

For example lets say you connect to a MQTT broker and start a session that lasts 24 hours. Every minute you send new coordinates. That would add up to a savings of 720kb of overhead.

But if you disconnect from the MQTT Broker and then reconnect between messages the savings are lost since each MQTT connection is running a TCP connection behind the scenes. Also, there is an overhead to keep a MQTT connection open but I think it is negligible.

If you want to try this our Adafruit.io offers a great free tier and access to a MQTT Broker.