The Internet of Things (IoT) is the network of physical objects or “things” which enables these objects to collect and exchange data. The capabilities of an IoT solution include the following
- Device Management: The device, upon initialization, register to the cloud gateway. Once it registers, it can send and receive the data to and from the cloud. It should have the device management feature to add, activate, inactivate, remove the device and update the attributes of the device.
- Telemetry Ingestion: Devices may be sending multiple messages in a second, and there may be hundreds to thousands of devices or more, which would result in 10’s of thousands to possibly millions of messages a day. The cloud platform provides high-volume message ingestion using a single logical endpoint.
- Transformation and Storage: Once the messages arrive, the cloud provides a mechanism to select, transform, and route messages to various storage mediums for the purpose of archival and staging for downstream processing.
- Status and Notifications: The cloud solution will provide the ability to visualize the status of the messages in real time through tabular or graphical UI components. In addition, some messages may contain information of an alert status so the IoT solution must provide a mechanism for real-time notifications to actionable operation.
- Analytics and Data Visualization: The value of collecting huge data in a continuous fashion is to build up a historical record for the purpose of performing analytics to glean business insight. Traditional data warehouse techniques or more modern predictive analytics tools can be employed.
Following diagram gives the overview of the different parts of an IoT system
Microsoft Azure has end-to-end PaaS offering for IoT solution. The Azure services are easy to provision, use and manage, scale as you need, hyper scale, globally available and secured at the physical, network, host, application, and data layers. The list of services are recommended here to use
- Device Connectivity – IoT Hub, Event Hub, Service Bus Queue
- Storage – SQL Database, Table Storage, Blob Storage, Redis Cache, Data Lake, DocumentDB etc.
- Analytics – Stream Analytics, Apache Storm, HDInsight, Machine Learning, Data Factory etc.
- Presentation & Action – App Service, Power BI, Notification Services etc.
There are two important aspects of architecting an IoT solution e.g.; scalability and security. The IoT solution should be scalable at every level to support the unpredictable traffic surge while security is important especially at the device level to ensure it is hack-proofed. Azure IoT Hub gives the reliability to secure the connection between device and cloud and vice-versa but scalability has to implemented at the architecture level. It is recommended to follow microservice pattern for the IoT solution.
- Autonomous: Existing or capable of existing independently, responding, reacting, or developing independently of the whole.
- Isolated: Separate from others, happening in different places and at different times.
- Elastic: Capable of returning to its original length, shape, etc. after being stretched, deformed, compressed, or expanded.
- Resilient: Able to become strong, healthy, or successful again after something bad happens.
- Responsive: Quick to respond or react.
- Message-Oriented: Software that connects separate systems in a network by carrying and distributing messages between them.
- Programmable: A plan of tasks that are done in order to achieve a specific result.
- Configurable: To design or adapt to form a specific configuration or for some specific purpose.
- Automated: Having controls that allow something to work or happen without being directly controlled by a person.
A layered architecture uses a separation of concerns to provide the implementation of both simple and complex applications. Consider the 3-tier architecture, a logical separation between user experience (presentation layer), business capabilities (application layer), and persistence (data layer) would exists in the layered architecture. Applying this to a simple model to a real world scenarios, the layers increase in complexity and responsibility as mentioned below.
A microservice architecture maintains the logical separation of presentation, business, and data layers where microservice architecture derives from a monolithic application to a collection of distinct and isolated services. The business and data layers are vertically sliced along functional areas, each with its own domain model and API. The data services layer is a collection of microservice providing various types of persistence services from caching, NoSQL stores, relational databases, and cloud storage in the form of blobs, tables and queues. These services are instantiated on-demand and provide secure end points that are accessed using an API invoked over a network protocol (web role/app service) or by an automated process (worker role). Traditional cross-cutting concerns such as logging, configuration, reference data, and discoverability also exist within this architecture as microservice. Putting all these together in a block diagram, it would look like
The benefits of the microservice pattern is
- Evolutionary: It can evolve towards one service at a time, identifying a business capability, implementing it as a microservice, and integrating using a loose coupling pattern, with the existing architecture.
- Open: Microservices are designed to expose their functionality through industry standards for network-addressable APIs and data contracts, and are hosted on highly scalable, elastic, resilient cloud platforms.
- Reusable and Composable: Microservices are reusable. They are not beholden to any one solution. They are independent entities providing a business or platform capability and exposing that functionality through open internet standards.
- Flexible: By defining deployment and scale scenarios through automation tools, the microservice team can exert a great deal of control.
- Versionable and Replaceable: Since there is complete control over the deployment scenarios for a microservice, it becomes possible to have multiple versions of a service running side by side, providing backward compatibility and easy migration.
- Owned by One Team: A microservice architecture approach requires organizing cross-functional teams for the purpose of owning the microservice product lifecycle from design through deployment.
The IoT reference architecture can be used to implement the IoT solution. It is suggested to extend the reference architecture as per the requirement.
This reference implementation provides an example of how one can incorporate IoT capabilities into a larger solution. The reference implementation uses Microsoft Azure IoT stack, consisting of Event Hub and Stream Analytics for telemetry ingestion, data transformation, and routing to SQL Database. Real-Time notifications are provided using Event Hub, a custom Event Hub Consumer Cloud Service called Notification Worker, and Notification Hub. Real-time data visualization is provided through a custom API combined with SignalR, which uses Web Sockets to push updates to a web front end. The command & control is sent from the Web App to API to Command microservice which sends the event to the device through IoT Hub.
IoT is not new in the industry. Devices connected on a network delivering real-time telemetry have been around for a long time. What has changed in the past couple of years is the commoditization and proliferation of sensors and devices and the commoditization of the services necessary to connect to these devices and ingest the sensor data at volume with high speed internet connectivity and smartphone adaptability. Azure is at the forefront of this movement, providing an IoT microservice stack that allows to bring these types of solutions with less time-to-market. Several Azure PaaS services provide the necessary foundational services that, when combined with your custom microservices, deliver a highly scalable, fault tolerant, reliable Software as a Service IoT solution.