A few months ago I produced some tutorials on using Windows 10 IoT Core and Azure IOT Hubs https://blogs.msdn.microsoft.com/uk_faculty_connection/2016/01/27/windows-10-iot-core-beginners-walkthrough-using-raspberry-pi-2-and-the-fez-hat/ this seems to have been popular with a number of student projects. I am aware of academics who have adopted IoT scenarios and labs. Well one of the questions I recently had was around scale and cost of running IOT Scenarios.
Scalability and costs
Since then Azure has introduced a new piece of technology, Azure IoT Hub. It has the same downstream programming model that Azure Event Hubs has, built on consumer groups, etc, but has added device handling capabilities. When we were using Azure Event Hubs we had to create our own Service Bus Shared Access Signatures to enable the telemetry to be posted. Not only does Azure IoT Hub enable reliable and secure bidirectional communications between IoT devices, it handles the per-device security credentials and access control, so it was one less thing for us manage, so we switched over to using it.
Azure IoT Hub is a fully managed service that enables reliable and secure bidirectional communications between millions of IoT devices and a solution back end.
Azure IoT Hub
- Provides reliable device-to-cloud and cloud-to-device messaging at scale.
- Enables secure communications using per-device security credentials and access control.
- Provides extensive monitoring for device connectivity and device identity management events.
- Includes device libraries for the most popular languages and platforms.
Azure IoT Hub is offered in four editions:
(pricing correct as of Sept 2016 – please check the latest pricing information)
Free: The Free edition is designed to transmit up to a total of 8,000 messages a day, and is suitable for gaining familiarity and testing out the capabilities of the IoT Hub service. Note: IoT Hub only allows one free hub per subscription.
S1: IoT Hub S1 edition is designed for IoT solutions that generate relatively small amounts of data. Each unit of the S1 edition allows up to 400,000 messages per day across all connected devices.
S2: IoT Hub S2 edition is designed for IoT solutions that generate large amounts of data. Each unit of the S2 edition will allow up to 6 million messages per day across all connected devices.
S3: IoT Hub S3 edition is designed for IoT solutions that generate large amounts of data. Each unit of the S2 edition will allow up to 300 million messages per day across all connected devices.
So what factors do you need to consider
The FREE limit of 8,000 messages a day sounds quite high, but our devices or app begins to push out one message per second, it equates to just over two hours of constant use, so we very quickly reached the daily limit. Obviously you can easily reduce the frequency of transmission with negligible impact, and we could buffer up the telemetry into a single call,as payload are typically very small. But, as soon as you start to support multiple devices, once again, when a lot of people start using it, it would take us over the limit very quickly. for example take a class of 30 students all running a Raspberry PI sending a message each second. So 30 devices sending a message every second for 2 hours = 216,000 messages so your will soon need to scale to S1 Series after a few labs.
So you may need to considering moving over to an S1 edition of IoT hubs,
Once you start getting into scale, these sorts of calculations and architectural design decisions get increasingly important. The Azure Pricing Calculator is a good tool for assessing how much cloud services will cost to operate and maintain.
One thing that may not be obvious from the way the pricing is laid out, is that this pricing is per unit, and you can have up to 200 units in a subscription (that limit is a soft limit I understand, and can be raised upon request).
There are some other aspects of scale you need to be aware of when designing these types of solutions. The best way to size an IoT Hub solution is to evaluate the traffic on a per-unit basis. Device-to-cloud messages follow these sustained throughput guidelines:
Think about the payload sizes and think through any peak scenarios. You also need to be aware of the IoT Hub quotas and throttles and design accordingly and ensure you design your labs appropriately. see https://azure.microsoft.com/en-gb/documentation/articles/iot-hub-guidance/
You can read more about provisioning an Azure IoT Hub