How an IoT Cloud Application Works? A Deep Dive into the Software Architecture and Data Flow

How an IoT Cloud Application Works? A Deep Dive into the Software Architecture and Data Flow

In one of our earlier blogs, we had discussed about the role of Cloud backend in an IoT solution.

In this blog, let us delve deeper to understand what the main components of an IoT cloud application are and how they work together to store and process the enterprise data?

The Building Blocks of an IoT Cloud Application:

Data storage and processing within cloud application is a result of the symphony between the cloud computing components of the IoT cloud application.

At a basic level, a web-based cloud application is made of the three primary components, namely the web server, the application server, and the database server.

Let us take a closer look at these components:

IoT Cloud Application

Image 1: Primary components of a typical web based cloud application.

  1. Web server: A web server is responsible for managing web requests. The web servers are widely used for downloading requests for files, downloading webpages, processing email request among others.  Some of the commonly used web servers include Apache, Nginx, Microsoft Internet Information Server (IIS), and more.
  2. Application server: An application server is a software framework that supports development of the web applications, while providing a server environment to run these applications.An application server can be visualized as a middleware connecting the backend server with the users.

    Web applications are written in the programming languages supported by the application servers and invoke runtime libraries offered by the Application Server.

  3. Database server: The Database server handles the database related request and enables the Cloud Application to access the stored data.A database server is independent of the architecture of the database. This means it is compatible with various database types like Relational, Non-relation database or even flat files.

And then there is the messaging/ communication protocol that facilitates communication between the cloud application and the IOT enabled devices. MQTT is one of the most commonly used messaging protocols in IoT applications.

How does a Cloud Application work?

We will try to understand the mechanics of the Cloud Application by tracing the flow of the data. Please refer to the following block diagram while you read this section.

data transmission on IoT cloud

Image 2:  Block diagram representing how data transmission occurs in an IoT cloud application

  • How a Cloud Application Collects Data from Field Deployed IoT Devices:

Data collected from the IoT enabled devices is sent to the Cloud Application through the MQTT protocol and stored in a database. The key component of the MQTT protocol is the MQTT broker, which acts as the central hub of messages exchanged between the publishers/ sender and subscribers/receiver.

An MQTT broker manages the core functions such as receiving messages from the publishers, filtering them, determining the subscribers, sending the messages to the subscribers based on the topic they have selected.

The following block diagram offers a detailed view of the device-cloud communication over MQTT, in a cloud application based on Python script, with Django as the web application framework:

We app framework

  • Whenever a device wants to communicate with the cloud server, it will send a ‘connect’ command to the intermittent MQTT broker.
  • The MQTT broker responds to this connection request with a ‘connack’ (connection acknowledge) after verifying device authenticity.
  • Once the verification is completed successfully, the device starts publishing the message.Below is a sample of the MQTT message Publish pattern:

    mosquitto_pub -p 1883 -t “sensor/Device001” -m “{‘temp’:22}” -h “

    where ‘p’ is the port used for communication, ‘t’ is the topic, ‘m’ is the actual message being sent , and ‘-h ‘ is the domain or IP address of the application

  • Once the MQTT broker gets the message it stores the data for a short duration.
  • On the server side, the python script in the application server acts as the subscriber.Below is a sample of  the example of the MQTT Subscribe pattern:

    mosquitto_sub -p 1883 -t “sensor/Device001” -m “{‘temp’:22}” -h “

  • Once python script (the application server) gets the message, it executes the database queries and stores the data in the database.

In the cloud to device communication, the python script acts as the Publisher and device acts as Subscriber.

Now the data aggregated from IoT enabled devices is stored in the database server of the IoT cloud application via the MQTT protocol.

  • Making the Data in the Cloud database Available for the End User:

We will now look at how this stored data is made available for further processing and for implementing business logic.

An end-user interacts with the backend systems and requests for specific information using the web pages running on the web browsers.

The web browser, at the front-end, sends this request to the back end over HTTP/ HTTPS. And the database server responds by sending the required data or content depending on the scripting as well as how the user requests the information to be visualized.

At the front-end, the user can get the information as flat file or textual/numerical data, or even as charts and graphs with the help of visual tools such as Highcharts or Google charts.

At the back-end side, a web server such as NGINX handles various requests such as form submission, received from the front end and passes it on to the next layer, the application server.

Similarly, the web server passes on the data fetched from the database server (via application server) to the webpages via HTTP/HTTPS.

The web server is designed to handle multiple requests (10,000 client connections) at a time and thus helps in load balancing for a smooth cloud application performance.

Additionally, the web server also takes care of security of information exchanged between the clients (the browser) and the servers through SSL certificates.

Next is the application server software which consists of programming language, run time libraries, database connectors, and is entrusted with the task of handling communications to and from the database.

Based on the scripting language, it handles communications with the front end/ web application. The web server passes on requests for connection from the front-end to the application server, based on a first in first out (FIFO) basis.

The application program forwards this to the database and fetches the requested data and sends it to the front-end via the web server over HTTP.

Thus, inside the cloud application data exchange chiefly happens between the front-end (web application) and the back end (the database) through a middleware layer, formed by web server and the application server.

Hope you found this blog on IoT cloud application informative and useful. If you wish to know more about Embitel’s IoT cloud development services, you may get in touch with us our cloud experts.


Happy to Help!