Microservices and containers were not created with the internet of things in mind. However, they are in a position to solve several of the key challenges associated with software delivery for IoT devices.
To understand the relationship between microservices and IoT, you first have to understand the special challenges associated with IoT devices and the software that runs on them. In certain key respects, IoT is very different from other types of infrastructure:
- The "smartness" of IoT devices varies widely. Some IoT devices -- such as internet-connected thermostats -- are very "smart" because they have lots of memory and computing power. Others, like remote sensors or embedded RFID tags in animals, are "dumb" because they have very limited hardware resources. Their ability to perform compute tasks is minimal or, in some cases, even nonexistent.
- IoT connectivity solutions vary widely. Some IoT devices are connected via traditional internet connections delivered over Ethernet or conventional Wi-Fi. But in cases where traditional networking infrastructure is not available, devices rely on long-range or low-power wireless networks. These networks generally have lower bandwidth rates and less reliable connections.
- IoT devices aren't always connected or turned on. Some IoT devices are constantly connected to the internet. Others are only connected when a network is available, which isn't always the case in scenarios where devices rely on intermittent types of connections. Additionally, some devices may not always be powered on due to limited battery life or a reliance on intermittent energy sources like the sun.
IoT software delivery solutions need to be able to address these challenges. They have to work with devices that vary widely in the amount of computing they can perform as well as storage capacity. They need to be able to support low-bandwidth or intermittent network connections and handle devices that aren't always available.
Solving IoT's challenges
Microservices and containers were not developed specifically with IoT in mind. Microservices are a modern take on service-oriented architecture (SOA) approaches to software design. Microservices and SOA were conceived to simplify the deployment of traditional applications -- the type hosted on commodity servers and delivered via traditional network infrastructure. For their part, containers -- especially Docker, the leading container platform available today -- were also designed for deploying server-based applications.
Yet, despite not being designed for IoT, microservices and containers are ideally suited to solve IoT's challenges in several ways:
- Make the footprints of applications and environments smaller. To work effectively, low-power, resource-poor IoT devices need host operating systems and individual applications that consume as few resources as possible. Microservices and containers fit this bill. They allow applications to become lighter and distributed. Microservices even make it possible for the collective resources of a group of IoT devices to be shared to host a service, thereby working around the hardware limitations of individual devices.
- Ensure faster, more reliable updates. Ensuring that updates are installed quickly and reliably is difficult for IoT devices that are intermittently connected or lack extensive computing power. Containers can help to deliver updates efficiently because new container images can be dropped onto an IoT device in neat, self-contained, preconfigured packages. The device itself does not have to do much work to receive, install or configure updates delivered in this way.
- Enable immutability. IoT devices that are not always connected or that have low resource profiles can't be secured effectively using security tools that require constant connectivity or that run agents on the hosts they monitor. But by using containers, IoT applications -- or entire IoT software environments -- can be made immutable. Immutable environments can't be modified once they're running; they can only be wiped out and replaced. Immutability mitigates some security concerns and makes it easier to address attacks.
Challenges using containers and microservices
To make full use of microservices and containers for IoT software delivery, some challenges still need to be addressed.
- Docker device compatibility. Docker was designed first and foremost for traditional, x86-based computer architectures. Most IoT devices aren't powered by x86 chips. Docker also supports ARM architectures -- the kind that power many IoT devices -- but Docker on ARM has received much less testing and vetting by the community. In addition, Docker doesn't currently support operating systems other than traditional Linux and certain Windows systems. Android, which is used for some IoT devices -- particularly those in the "smarter" category -- is not supported, even though the Android kernel was derived from Linux.
- Microservices and network connectivity. Most microservices-based apps rely heavily on network connectivity. Microservices interact with one another over the network. With IoT, microservices architectures would need to be adapted to support situations where networks aren't constantly available or where bandwidth is limited and would require a new approach to microservices design.
Unikernels: The key to IoT's future?
Perhaps the most promising application of microservices and containers in IoT will not involve standard Docker containers, but rather unikernels -- a container-like technology. They package everything required to run a particular application or service, including the operating system, into a portable, self-booting environment. Since all nonessential components are stripped out of the unikernel package -- even software libraries are reduced to the bare minimum -- unikernels consume very few resources.
Today, most unikernel technology remains experimental. Few unikernels are currently capable of booting directly on real hardware; most only work using emulators. In the future, however, if unikernels evolve to the point of being production-ready, they likely will become key to delivering lean, mean, microservices-based software for IoT devices.
Wrestling with IoT connectivity challenges
Where Agile, SOA and microservices intersect
An inside look at application development for IoT