11.04.2024
An Introduction to Technologies Used in Containerisation
& a re.alto Use Case Example
In this article, we want to focus on the more technical side of re.alto and are going to highlight some of the technologies currently used by our developers when it comes to container apps.
What is a container/containerisation?
Containerisation is the bundling of software code with all its necessary components into one single, easily portable package (a “container”). It allows software developers to deploy and scale applications more efficiently and removes the need for running a full operating system for individual applications.
Docker, an open-source platform for developing software in containers (applications and any supporting components), enables developers to separate their applications from their infrastructure. Developers write code to create a container image, this image is then deployed to a container image repository. A container is based on a container image – when the container starts up, it will pull the image and execute the code inside it. Depending on the number of requests (ie: calls to an API), a container can have zero to a lot of replicas (instances of a container) running simultaneously, in which case an orchestration tool such as Kubernetes is often required to handle this.
Why Kubernetes?
Kubernetes is an open-source platform that manages containerised applications and services as clusters. Kubernetes offers a framework for software developers to run distributed systems efficiently, handling the scaling of applications and providing other useful features, such as load balancing and self-repair of containers. However, it can be complicated to manage your own Kubernetes cluster without prior experience of doing so. Most developers lack interest and knowledge in this area as it is expertise that falls more within an infrastructural role in a company – and many start-ups have not yet scaled to the size where this hire is necessary. That is where Microsoft Azure Container apps comes in.
Game changer: Microsoft Azure Container Apps
Like many smaller companies (and especially start-ups), re.alto does not have the time or resources to manage our own Kubernetes cluster, so we decided to use Azure Container Apps, an orchestration service introduced by Microsoft in 2022 for deploying containerised applications. This service really is a game-changer for start-ups, as it greatly simplifies the management of a Kubernetes cluster. Developers can still create containers but no longer face the hassle of configuring and maintaining their own cluster, as Microsoft does all this for them. With Microsoft’s managed environment taking over the orchestration of their cluster, developers can focus more on the actual container apps they want to build.
Our Use Case: Combining technologies
How we use containerisation (Azure Container Apps) and Apache Kafka to get data from a smart meter dongle and stream it elsewhere.
One use case, for example, focuses on the flow of our Xenn dongles. The image above shows the stages of this flow. In this case, the IoT device – our Xenn dongle (attached to a smart meter for use with re.alto’s Xenn app) – pushes a message to an MQTT broker. A container consumes this message. The raw message is then distributed by Apache Kafka. Kafka has the ability to listen to millions of messages per second and has the benefit of storing messages for a certain period of time (in our case, seven days). That means if the connection to one container is temporarily lost, or if we stop and restart it, it will still read and process any messages from that period once it is back online – meaning no messages/commands are missed or lost. Kafka keeps track of which consumer groups (or container apps) have read which messages and, although we don’t do this currently, it is also possible to set up a schema for an Apache Kafka topic which only allows you to push messages in a specific format into a topic, guaranteeing that each message is of a specific format/standard. Using Kafka is greatly beneficial to companies like re.alto as we have far too many data streams to manage all of them ourselves. The message is then picked up by another container app and is stored in our data storage. While all containers receive the same message, they can be programmed to follow different instructions. This enables us to have containers with individual responsibilities, such as a container for tracking peak detection. In this case, the container would extract the relevant parts of the message and compare the readings with all other readings in the same quarter-of-an-hour to determine whether the consumer will run into a peak. If this is the case, the consumer receives a push notification in the Xenn app.
Azure Container Apps provides start-ups with an invaluable service in the management of Kubernetes clusters, while Kafka simplifies handling large amounts of data streams and ensures no messages from IoT devices get lost or go unread.
In our next article, we’ll be looking in more technical detail at how to scale with Kafka and Azure Container Apps and will provide you with some of the code needed to do so.