COMP3310/6331 Assignment 3 – Testing MQTT
MQTT is the most common open IoT protocol being deployed today. It provides a publisher/subscriber
model, using a broker or server. It allows for an almost-unbounded number of sources to publish
information, each at their own rate, and subscribers to receive information (and act on it). As such, it is
designed to provide high-performance communication mechanisms, with minimal delays and excellent
scaling performance. We’ll use it to monitor the performance of some imaginary system: say counting the
total kilograms of minerals rushing by on a conveyor belt, that you can control. This assignment will look at
the functionality and performance of the publishers, brokers, the network and the subscribers.
This is a coding, analysis and writing assignment. You may code in any programming language (hope that’s
enough for everyone), and yes, you may use MQTT and other helper libraries. The assessment will not rely
solely on running on your code, but more on the data gathering and your analysis. However we will review
the code and may briefly test it against our own broker running in the usual lab-type environments or
similar. You will need to identify in your code any libraries you are using.
Please note, you will be working in pairs or small groups for a key part of this assignment, to test each
other’s systems across the Internet. If you don’t have somebody to work with, ask your tutors NOW to
identify somebody in your tutorial group. You do not need to be in the same location at any time.
You will be submitting your code and your analysis report. Note that there will be two submission links on
the course-site in wattle:
1. Your code must be submitted to wattle as a zip file, with instructions on how to compile/run the
components as appropriate.
2. Your analysis report (pdf) must be submitted via TurnItIn on the wattle site, so ensure you quote
and cite sources properly.
Each question has an indication of how much (rough maximum) you should write.
We’re assessing your understanding of MQTT, your code’s functionality in subscribing/publishing to a
broker, dealing with high message rates, and your insight to interpret what you’re seeing. You will be
exploring MQTT functionality, the quality-of-service (QoS) levels, describing how they work, why you would
use different levels, and how they perform in real-world deployments given various publishers.
You will need to set up your own MQTT server (broker) for you to connect to as per the specifications
below. The Mosquitto broker is perhaps the best choice to run on your own computer, it has binaries
and/or packages for most operating systems, but if you find a better one you can use that. It must be at
least MQTT v3.1.1 compliant (i.e. MQTT v5 is not necessary).
A key consideration is that you will need to allow your assignment partner to connect to it over the Internet
for part of the assignment. If you have a home modem/router that does NAT you will need to work out how
to configure it to allow remote connections (think about the port(s) you need to forward, and how to
manage any changing IP addresses). There are a few other ways to solve this, e.g. a VPN service on your
modem or a local computer. If it proves too difficult you might consider setting up a cloud server with a
public IP address on e.g. Amazon, Azure, Alibaba, etc. and installing a broker there. Yet another option is to
set up a (free) fully-hosted broker through a provider such as HiveMQ.com.
Your broker needs to be configured for some basic authentication and access control:
• username student and password 33102021
• require the client-id to start with 3310-
You can test the broker works by subscribing to the $SYS topics, which describe the server, and help get you
familiar with the information presented there – you will be using them for your analysis later.
Assignment requirements and questions
You need to write three small programs, the first two of which could be combined into one:
• A Publisher: It will send a simple message to the broker, an incrementing counter (e.g. 0, 1, 2, 3, …).
It will send those messages at a specific QoS level (0, 1 or 2), and with a specific delay between
messages (0ms, 10ms, 20ms, 50ms, 100ms, 500ms). It needs to publish to the topic
‘counter/<qos>/<delay>’, so e.g. ‘counter/1/100’ implies qos=1 and delay=100. It should only
publish one stream at any given time, based on input from the Controller.
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: email@example.com 微信号:vipnxx