← Back to the chapter · Previous detail
Technical detail · MQTT Production Operations
Operating limits, monitoring and rollback
To operate a house service carrying sensor readings and valve commands, I’ll turn the workload evidence into limits, alarms and a recovery plan.
Quality of Service (QoS) describes the protocol delivery level. MQTT 5.0 reason codes distinguish responses such as authorization failure, quota limits and a busy server. Keep the reason with the affected identity and operation. It describes a protocol response, not proof that the valve acted.
Shared subscriptions distribute matching traffic to one eligible session per shared subscription. They are standardized in MQTT 5.0; MQTT 3.1.1 use depends on broker extensions. Monitor consumer lag as well as broker acceptance. Receive Maximum bounds unacknowledged QoS 1 and QoS 2 publications per connection and direction. It does not bound offline queues, retained storage or QoS 0 traffic. Apply separate storage and rate limits, then test a slow consumer.
Monitor message rates, dropped messages, retained-topic count, queue depth and age, authorization failures, certificate expiry and bridge reconnects. Give each alarm an owner and prove it with a controlled fault. For the house, include stale readings and unconfirmed command results alongside connection health.
A bridge forwards selected messages between broker deployments; for the house, test forwarding from Bex to a backup deployment. It needs its own client ID, TLS credentials, permissions, Keep Alive (a nonzero maximum interval in seconds between outgoing client control packets; an effective value of zero disables the mechanism) and topic prefix. Allow only intended branches. Test loops, stale forwards and accidental command exposure. Before changing the deployment, retain a canary result from a limited trial, a rollback route to the previous deployment, an alarm owner and a saturation threshold. Rehearse rollback with the same workload and state requirements.