← Back to the chapter · Next detail →

Technical detail · MQTT Session Management

Storage cost of saved subscriptions and queued messages

An MQTT broker routes messages between clients; a retained session stores client state, including subscriptions that select incoming messages and eligible messages queued while the receiver is offline.

Saved subscriptions avoid rebuilding the same routing requests after every short break. Queued messages let an eligible offline receiver catch up. Neither benefit means every client should retain state indefinitely. The operations screen, when used temporarily for debugging, has no reason to leave a permanent subscription record behind.

A planning example has 1,000 devices, an average of 5 subscriptions and 10 queued messages per device. Its modeled session-and-queue subtotal is 1,000 × (5 kB + 10 kB) = 15 MB, before broker and index overhead. This is a worksheet assumption, not a measured broker requirement. The useful question is which state earns its storage cost for this client’s task.

← Back to the chapter · Next detail →