There can sometimes be confusion, in IoT scenarios, between IoT Hub and Event Hub, as they can both be valid choices for streaming data ingestion. My Microsoft colleague, Steve Busby, an IoT Technology Specialist, is here to clear up the confusion:
The majority of the time, if the data is coming directly from the devices, either directly or via a field-based gateway, IoT Hub will be the more appropriate choice. Event Hub will generally be the more appropriate choice if either the data will not be coming to Azure directly from the devices, but rather either cloud-to-cloud through another provider, intra-cloud, or if the data is already landing on-premise and needs to be streamed to the cloud from a small number of endpoints internally. There are exceptions to both conditions, of course.
Both solutions offer very high throughput data ingestion and can handle tremendous streaming data volumes. In fact, today, IoT Hub is primarily a set of additional services that wrap an underlying Event Hub.
Event Hub, however, has some limitations that may make it inappropriate for an IoT scenario when data is being pulled from devices in the field, specifically:
- Event Hub is limited to 5000 concurrent AMQP connections. At “IoT scale”, there would likely be a lot more devices than that
- Event Hub does not authenticate individual device connections, but rather all the devices essentially share the same (or few) access keys. You also cannot enable/disable communication from a single device.
- Event Hub is ingestion only and has no facility for sending traffic back to the devices (command and control or device management scenarios)
- Event Hub does not support MQTT. For better or worse, MQTT is a very popular IoT protocol and is supported by competitors, particularly AWS
In addition to the features of Event Hub, IoT Hub also adds:
- Scale out connections. A single IoT Hub has been tested to more than a million concurrent connections
- IoT Hub does individual device authentication (via either a device-specific key, or x.509 certificate) and you can enable/disable individual devices
- Bi-directional communication, allowing you to either do asynchronous or synchronous commands to the device
- Supports AMQP and HTTP, like Event Hub, but also adds support for MQTT as a transport protocol
- Device Management – the ability to orchestrate firmware updates and desired and reported configuration management with devices
- Device Twins – A queryable cloud-side representation of the state of a device, allowing customers to group and manage their devices “at IoT scale”
- File update – orchestrate file uploads from device through the hub
As you can see, both Event Hub and IoT Hub are valuable Azure services with distinct use cases. Event Hub is great for high throughput ingestion (only) of data from a limited number of sources (like cloud to cloud, on-prem to cloud, or intra-cloud). In those scenarios, Event Hub will generally be appropriate and significantly cheaper than IoT Hub. However, for IoT scenarios where interacting with the individual devices directly are involved, IoT Hub will generally be the better technology and adds a lot of features we need to be competitive.