Most of Those Messages Never Needed to Exist
Ada re-derives this chapter’s own numbers step by step, at full precision
ADA · CALCULATION AUDIT
Most of Those Messages Never Needed to Exist
In this lab, 50 sensors publishing every 5 seconds each emit 17,280 messages a day, and the chapter notes that about 99% of them report an unchanged value. Switch to publishing on change with a 5-minute heartbeat and each sensor drops to 360 messages a day. This audit traces the counts end to end to size the real win and confirm that most of those messages never needed to exist.
Companion to the chapter Lab: MQTT Hands-On — every number here comes from that chapter.
Ada: The worked example quotes several message counts and a monthly bill. Let me trace them end to end and pin down the true size of the reduction, because it is the metered message count, not the sensor count, that drives the cost.
Timer-based publishing, every 5 seconds:
- Per sensor:
86,400 s/day / 5 s = 17,280 msgs/day - Fifty sensors:
17,280 x 50 = 864,000 msgs/day - Per month:
864,000 x 30 = 25,920,000 msgs, about25.9M, costing25.92 x $1 = $25.92at $1 per million
Change-plus-heartbeat publishing:
- Per sensor:
72 changes/day + 288 heartbeats/day = 360 msgs/day - Per month:
360 x 50 x 30 = 540,000 msgs, costing0.54 x $1 = $0.54
Now the honest size of the win: 17,280 / 360 = 48x fewer messages, equivalently a 1 - 540,000 / 25,920,000 = 97.9% cut, the same ~98% the chapter’s bandwidth line reports. Put plainly, when a room’s temperature is flat, roughly forty-seven of every forty-eight five-second messages carry no new information. Publishing on change with a heartbeat floor deletes that redundancy at the source, so the metered bill and the broker load fall with the message count, not with the number of sensors.
Every number above is taken from the chapter’s own material and re-derived step by step.