Smart-city protocol selection practice
Smart-city protocol selection practice
The exercise below preserves the original wording. Its 166.7 messages/s is the streetlight publication rate, not proof that a single broker supports the complete workload. Test connections, subscriptions and dashboard deliveries before sizing capacity. The 52-byte subtotal omits MQTT variable headers, topic names, acknowledgements and transport costs; 8.47 is KiB/s, not decimal KB/s.
The $8/month broker price, $40,480 hybrid total, $80K+ AMQP estimate and $60K+ custom-routing estimate are illustrative assumptions, not verified provider prices or engineering costs. Cost the actual deployment independently.
MQTT supports hierarchical topic selection with subscription filters; the camera routing example alone does not require custom MQTT logic. AMQP is useful when exchange-to-queue topology and backend work handling are needed. Neither protocol’s ordinary routing rules perform arbitrary numerical payload classification; classify alerts in the application first. Persistent, acknowledged AMQP delivery requires the corresponding queue, message and acknowledgement configuration.
For the final question, MQTT QoS 1 permits duplicate delivery on one hop. AMQP 0-9-1 transactions group broker publishes and acknowledgements; neither makes external application actions atomic.
Scenario: You’re architecting a smart city platform with 50,000 streetlights, 200 traffic cameras, and 10 city-wide dashboards. Each streetlight sends on/off status + energy data every 5 minutes (50 bytes). Cameras stream alerts to 3 emergency services (police, fire, ambulance). Budget: $200K for backend messaging infrastructure over 5 years.
Think about:
- Would you use MQTT or AMQP for streetlight telemetry? Why?
- How would you route camera alerts so only relevant agencies receive them?
Key Insight: Use MQTT for streetlights (simple pub/sub and minimal overhead in this 50,000-device scenario) and AMQP for camera alerts (complex routing by jurisdiction and severity, with persistent, acknowledged delivery).
MQTT broker handles 50,000 streetlights at approximately 167 messages/second (50,000 ÷ 300 s = 166.7 msg/s, easily managed by a single AWS IoT Core broker at $8/month). AMQP exchanges route camera alerts using bindings like routing_key: "zone.north.fire.critical" ensuring the North Fire Station only sees its relevant emergencies—this complex routing would require custom logic in MQTT.
Let’s quantify the message throughput for streetlights precisely. Each streetlight sends status and energy data every 5 minutes:
With an average message size of 50 bytes plus MQTT’s 2-byte header:
For the hybrid architecture 5-year total cost of ownership:
This compares favorably to pure AMQP (estimated $80K+) or pure MQTT with custom routing ($60K+ in development costs).
Hybrid cost: MQTT broker ($96/year) + RabbitMQ cluster ($15K one-time, $5K/year maintenance) = ~$40K over 5 years vs $80K+ for pure AMQP everywhere or poor routing with pure MQTT.
Verify Your Understanding:
- Why might you bridge MQTT and AMQP at the backend (not choose one exclusively)?
- How does QoS 1 in MQTT compare to transactional guarantees in AMQP?