Connect. Control. Secure.

High-Availability IoT Cluster Example

The SMQ broker, at the heart of SMQ's publish-subscribe protocol, manages message transmission between the publisher and subscriber. In SMQ, publishers send messages to the broker which sorts these based on topics. Subscribers receive these sorted messages. SMQ broker clustering is a collaboration of brokers ensuring service continuity and high availability, crucial for businesses that cannot afford downtime.

Why SMQ Broker Clustering?

Imagine thousands of IoT devices connected to a single SMQ broker, which then goes offline. All connections are lost, disrupting data flow. Broker clustering distributes the load, mitigating such risks, and ensuring scalability.

Key Benefits of SMQ Broker Clustering

  • Scalability: SMQ broker clustering can effortlessly scale up for growth. As IoT network demands increase, more brokers can be added to manage the load without compromising performance.
  • High Availability: In a clustered setup, if a broker fails, others ensure unbroken service. This redundancy creates a robust and reliable network.
  • Load Balancing: SMQ broker clusters can evenly distribute load, preventing performance bottlenecks and improving efficiency.
  • Centralized Management: Clustering allows for broker management from a single point, simplifying administration and providing a comprehensive system performance view.
  • Maintenance Flexibility: With a cluster, maintenance can be performed on individual nodes without disrupting service.

Interactive SMQ Cluster Example

The following interactive example shows how to set up a very cost effective High-Availability Internet of Things Cluster. A High-Availability (HA) cluster may use a load-balancer and/or use DNS, or other technologies such as Anycast. In this example, we use a load-balancer-less solution based purely on DNS -- a so called DNS Round-Robin setup.

Round Robin DNS provides a low cost alternative to traditional cloud services. We recommend reading the DZone article Cheaper Alternatives to IoT Cloud Services if you are new to Round Robin DNS.

We have selected a low cost Virtual Private Server (VPS) provider for our example, and we have the two servers located in Portland and Los Angeles. The geographical dispersion provides strong redundancy. The yearly lease for each server is $12, thus the total cost for our example cluster is $24 per year.

We have two html frames below, and each html frame opens the SMQ IoT LED example on a separate server. The domain name translates to two IP addresses (two online servers) and you randomly get one of these IP addresses when navigating to However, we have also configured the DNS such that you can navigate directly to a specific cluster node.

Notice that clicking a button in any frame window below is synchronized. Not only does the SMQ protocol provide synchronization between multiple HTML5 clients, SMQ also automatically synchronizes between the servers in the cluster.

Before clicking any of the LED buttons below, make sure to select the same device in each window. You do this by clicking the same IP address in the left pane for each window below.

You can connect your own device to the cluster by downloading the SMQ source code. However, to test the cluster initially, perform the following steps:

  1. Navigate to our online demo server and open a Linux shell by clicking this link:
  2. Copy all of the following commands and paste them into the shell:
    git clone
    cd SMQ
  3. After the code has compiled and started, you should see a printout that includes:
     Connected to:
  4. You can now control the LEDs using the Linux shell and using the above UI.

For more information on the SMQ LED example, see the SMQ tutorial: LED control using SMQ.

Connect your own ESP32 to the cluster

You can purchase an ESP32 development board and use the SharkSSL FreeRTOS/lwIP IDE to deploy the SMQ LED C code example onto it. Refer to the Noobs friendly IoT C Code IDE tutorial for a beginner-friendly introduction to ESP32 C programming. However, if you aim to rapidly establish an ESP32 IoT solution within less than 10 minutes, use our Xedge32 ESP32 Lua development environment. The tutorial Your First IoT Project, showcased in the video below, thoroughly explains the simplicity of connecting to the SMQ cluster using Lua.

Additional SMQ Videos

The above video is for the tutorial:
A Modern Approach to Embedding a Web Server in a Device.

Download SMQ Source Code

Download SMQ Source Code and Libraries