SUGISAKAMASANORI

Journal of Robotics, Networking and Artificial Life
Vol. 9(2); September (2022), pp. 136–142
ISSN (Online):2352-6386; ISSN (Print):2405-9021
https://alife-robotics.org/jrnal.html

Research Article

Proposal of Gamma Which Is a Messaging Platform for Spatial
Data
Takahiro Ueda1, Tetsuro Katayama1, Yoshihiro Kita2, Hisaaki Yamaba1, Kentaro Aburada1, Naonobu Okazaki1

1
Department of Computer Science and Systems Engineering, Faculty of Engineering, University of Miyazaki, 1-1 Gakuen-kibanadai nishi, Miyazaki,
889-2192 Japan2
Department of Information Security, Faculty of Information Systems, Siebold Campus, University of Nagasaki, 1-1-1 Manabino, Nagayo-cho, NishiSonogi-gun, Nagasaki, 851-2195 Japan

ARTIC LE INFO
Article History
Received 25 November 2021
Accepted 03 July 2022

Keywords
MQTT
Spatial data
Load management
Information management

ABSTRACTThis paper proposes Gamma, which is a messaging platform for spatial data. Gamma uses
distributed MQTT system for spatial data sharing, and this paper aims to improve the usefulnessof distributed MQTT system. In the experiment, it has been found that Gamma can process moremessages than a single MQTT broker. It is confirmed that Gamma achieves scalability byincreasing the number of Gateways and distributed MQTT brokers. Furthermore, it is confirmedthat the efficiency of the distributed MQTT system can be improved by setting the responsibility
area of Gateways.

© 2022 The Author. Published by Sugisaka Masanori at ALife Robotics Corporation Ltd
This is an open access article distributed under the CC BY-NC 4.0 license(http://creativecommons.org/licenses/by-nc/4.0/).

from a smartphone camera. By sharing these spatial data
among applications in real time, all obstacles, even if
they appear from blind spots, can be known in advance.
We believe that two features are necessary for themessaging platform used in such an application. First, thesystem must be able to scale without stopping, even if thesystem load changes. Second, the client should be able toobtain only the necessary range of spatial data in real time.
Therefore, this paper proposes Gamma, a messaging
platform for spatial data with these features, which is
implemented using MQTT.
MQTT (Message Queuing Telemetry Transport)3 is awell-known application layer communication protocol
for the IoT (Internet of Things). Because the header sizeof MQTT is smaller than that of HTTP and otherprotocols, MQTT is suitable for systems that frequently
send and receive small data. However, the basic MQTT
defines one system with one broker to mediate messages,
the traffic of Publishers to send messages and Subscribers

S2 geometry

1. Introduction
Spatial data is "data that has as its elements both location
information and semantic information (state, shape, size,etc.) of objects". For example, data such as "a bicycle istraveling at 30 km/h at point A."1 In recent years, withimprovements in the processing power of smartphones,
the performance of cameras and other sensors, andimprovements in image processing technology, it has
become possible to acquire spatial data such as the typeand location of objects captured by smartphone cameras
in real time2.
To make better use of spatial data, it is necessary toshare only necessary spatial data among many
applications in real time. As a specific use case, consider
a drive recorder application. This application acquires
spatial data of obstacles such as cars, people, and bicycles

Corresponding author’s E-mail: uedat@earth.cs.miyazaki-u.ac.jp, kat@cs.miyazaki-u.ac.jp, kita@sun.ac.jp, yamaba@cs.miyazaki-u.ac.jp,
aburada@cs.miyazaki-u.ac.jp, oka@cs.miyazaki-u.ac.jp

136

is possible to change the system configuration without
stopping the system. To streamline communication
between the distributed MQTT broker and the Gateway,
it is also possible to inform the clients of the Gateway's
area of responsibility and a list of connection information.
Gamma implements a client library made by Go6 that has
the ability to select a Gateway to connect to for more
efficient message sharing based on the location
information of the spatial data to be acquired, and also
publish/subscribe based on the location information of
the spatial data.
Note that Gamma focuses on real time spatial data
sharing among clients and does not store spatial data.

to receive messages is limited by the broker's hardware
ability. Therefore, there are distributed MQTT systems
that work together among multiple brokers and perform
load balancing.
2. Related WorkA previous work on distributed MQTT system forsharing spatial data is the work of Ryo Kawaguchi et al4.
They introduced a topic structure that is suitable forhandling spatial data. They also introduced a distributed
MQTT broker and Gateway to reduce the load on thebroker and to support different types of brokers. By
numerical calculations, they confirmed that each broker
received fewer messages per unit time than the existing
distributed MQTT system, especially when the numberof Subscribers was large or when Subscriber’s topic waschanged frequently.
However, there are two problems in actually using
their proposed distributed MQTT system, as follows.
• The configuration of the distributed MQTT broker
cannot be changed while the system is runningbecause IP address and port number of the
distributed MQTT broker must be registered with the
Gateway in advance.
• Messages cannot be shared efficiently between the
distributed MQTT broker and the Gateway because
the Gateway is not configured with information on
the topic it is responsible for.
Another previous work of distributed MQTT system
for sharing spatial data is the work of Ryo Kawaguchi etal5. They introduced topic structure that is suitable forhandling spatial data and topic table, edge-based brokers,
and broker clusters. In their work, the efficiency of thesystem is reduced when there is a high probability thatthe areas of spatial data publish/subscribe by clients aredifferent from the responsible areas by the connecting
brokers. However, in their system, clients connect tobrokers in close network proximity. This may make thesystem less efficient.
In addition, the prototype implementation of bothprevious works did not mention a client library to
publish/subscribe to spatial data based on location
information such as latitude and longitude.
Therefore, this paper proposes a new messaging
platform for spatial data, Gamma, to solve the above
problems. Specifically, to solve the problems, this paper
adds Manager to the previous work4 and implements fivefunctions. By adding a Manager to manage the system, it

3. Gamma functions
In this chapter, we describe the functionality of Gamma
and its client library. The Gamma implemented in thisresearch can add a distributed MQTT broker and
Gateway when the load on the system becomes large.
This makes it possible to handle a larger number ofmessages. Note that Mosquitto7 is used for the MQTT
broker, Go6 is used for the program implementation, andpaho8 is used for the MQTT client library. Specifically,
the distributed MQTT broker consists of MQTT broker
only, the Manager consists of MQTT broker and theManager process using paho8, and the Gateway consistsof MQTT broker and the Gateway process using paho8.
The followings describe the five functions implemented
in this paper.
• Function to add a distributed MQTT broker while
the system is running:This function allows system administrators to add
distributed MQTT brokers while the system isrunning. This function is mainly performed by theManager which is newly added in Gamma. The
Manager also performs the process of updating theconnection information of the distributed MQTT
broker held by Gateway when a distributed MQTT
broker is newly added.
• Function to add a Gateway while the system isrunning:
This function allows the system administrator to add
a Gateway while the system is running. The Manager
receives the connection information of the newly
added Gateway from it Gateway after the systemstarts and manages it. It is also responsible for
notifying the newly added Gateway of the

137

•

for subscribing to spatial data in that range from thegiven latitude, longitude, and radius, and subscribe
to it. This function uses S2 Geometry9 for theseconnection information of the distributed MQTT
broker.
Function to set the Gateway’s assigned topic:

Fig. 2. System structure example (with Gateway’s topic
setting)

Fig. 1. System structure example (without Gateway’s topic
setting)••

calculation. Note that it is not assumed that a single
client will subscribe to spatial data over a larger area
than the each distributed MQTT broker's responsiblearea.

This function allows the system administrator to set
the topic for which the Gateway is responsible (topic
is synonymous with area). This function is mainly
performed by the Manager newly added in Gamma,
which accepts the request from the systemadministrator to set the topic for which the Gateway
is responsible and sets it. It is possible to set multiple
topics for one Gateway.
Function to select Gateway to connect based on
location information:
This function selects the Gateway to be connectedbased on the location information of the spatial data
published/subscribed by the client. The client
connects to the Manager before connecting to the
Gateway and obtains the information about theconnection to the Gateway and the topic that each
Gateway is in charge of. Therefore, the client only
needs to know the connection information to theManager. In addition, the client can select andconnect to the most suitable Gateway by comparing
the topic of responsibility of each Gateway obtained
from the Manager and the topic to be
published/subscribed by the client itself.
Function to publish/subscribe to spatial data basedon location information:
This function allows the client to publish/subscribe
to spatial data based on location information. The
client calculates a topic to publish based on thelatitude and longitude of the spatial data, and canpublish the spatial data. It can also calculate topics

4. Evaluation of Gamma
We evaluate the usefulness of Gamma implemented inthis paper.
Firstly, we compare it with the single MQTT broker.
As a result, we confirmed that Gamma is capable ofprocessing more messages than the single MQTT broker.
Next, we will conduct an experiment to evaluate thescalability that can be obtained by increasing the numberof Gateways. Fig. 1 shows the configuration of thesystem when no topic is assigned to the Gateway, and Fig.
2 shows the configuration of the system when a topic is
assigned to the Gateway. The red lines in these figuresindicate that publish/subscribe is taking place, and there
are fewer lines when the gateway has an assigned topic
set than when there is no assigned topic set. Note that theevaluation tool is shown into four publisher/subscribergroups for each area of spatial data to be
publish/subscribe in these figures.
The experiments shown below were conducted under
the following conditions: the length of the transmitted
message was 150 characters, the number of Publishers
was 100, the number of Subscribers was 100, the publish
interval for each Publisher was 100 milliseconds, and the138Table 1. Checking the scalability gained by increasing the number of distributed MQTT brokers

Without responsibility area
With responsibility area

Number of distributed MQTT brokers

1

Average delay time [ms]Average delay time [ms]14925.22 1163.05
294.35127.052

3118.9246.75

measurement time was 100 seconds. In addition,
Publishers and Subscribers were equally placed in fourareas. The distributed MQTT broker and Gateway wererun on a Raspberry Pi10, and all clients such as Publisher
and Subscriber were run on the same PC. During theexperiment, the network bandwidth and CPU utilization
were checked from the task manager of the PC runningthe clients to confirm that the PC used for the evaluation
was not a bottleneck.
4.1. Experiments and Discussion on Scalability
Gained by Increasing the Number ofDistributed MQTT Brokers
We check the scalability by varying the number of
distributed MQTT brokers; the number of Gateways isfixed to four.
Here, when the upper limit of the CPU utilization of
the distributed MQTT broker is viewed in the entire
command line tool called cputool11 during theexperiment, the percentage of the load occupied by the
Gateway is higher than that of the distributed MQTT
broker. In addition, there were only four Gateways that
could be prepared in this paper. However, even when
there are four Gateways for only one distributed MQTT
broker, the problem happens that the processing capacityof the Gateway became insufficient before that of the
distributed MQTT broker. Therefore, in this experiment,
we will intentionally reduce the processing capacity ofthe distributed MQTT broker using cputool and confirm
the scalability obtained by increasing the number of
distributed MQTT brokers.
From the experimental results in Table 1, we can seethat the average delay time decreases with the number of
distributed MQTT brokers. Because of this, we can seethat increasing the number of distributed MQTT brokers
improves the processing capacity of the entire system.
Therefore, we were able to confirm that scalability isensured by increasing the number of distributed MQTT
brokers.
In addition, Table 1 shows that the average delay timeis smaller in the case of "With responsibility area" thanin the case of "Without responsibility area" regardless ofFig. 3. Example of Gateway's topic settings andresponsible area.

the number of distributed MQTT brokers. From this, it
can be said that the setting of the topic to the Gateway,
which is one of the functions of Gamma implemented inthis paper, has improved the efficiency of the entire
system.

139

Table 2. Checking the scalability gained by increasing the number of Gateways

Without responsibility area
With responsibility area

Number of Gateways

1

Average delay time [ms]Average delay time [ms]11423.46 233.15
11423.46 116.14

2

3

4

118.73
57.30

42.65
15.96

The experiment also showed that Gamma canprocess more messages than a stand-alone MQTT broker,
and it has been confirmed that scalability can be ensured
by increasing the number of Gateways and distributed
MQTT brokers. Furthermore, it has been confirmed thatthe efficiency of the entire system can be improved by
setting the topic of responsibility of the Gateway so thatthe load is not unevenly distributed to a specific Gateway.
From this, it has been confirmed that the problem of not
being able to efficiently share messages between the
distributed MQTT broker and the Gateway because theinformation on the topic of responsibility is not set in the
Gateway could be solved.
From the above, Gamma realized the following two
points and solved the two problems of the previous
studies.
• The ability to add a distributed MQTT broker while
the system is running• The ability to notify the client of the information ofmultiple Gateways and the topics for which the
Gateway is responsible.
In summary, we have confirmed that Gamma
proposed and implemented in this paper is useful.
Future issues are as follows.
• Support for automatic addition of Gateways anddistributed MQTT brokers based on load.
Currently, to add a node such as a Gateway or
distributed MQTT broker, the administrator must
perform the addition manually. This can lead tooperational errors and makes it difficult to flexibly
change the configuration according to the load.
Therefore, it is necessary to implement a functionthat allows nodes to be added or removed
automatically according to the load. Indicators forunderstanding the load include CPU utilization,
memory utilization, and the amount of data sent andreceived per unit time.
• Add the ability to monitor the activity and death of
Gateway and distributed MQTT brokers
Currently, there is no node monitoring function suchas a Gateway or distributed MQTT broker.
Therefore, if some nodes become unavailable due tohardware failure, etc., spatial data will be lost. To

4.2. Experiments and Discussion on Scalability
Obtained by Increasing the Number ofGateways
We divide the area according to the number of Gateways
to check the scalability. The number of distributed
MQTT brokers is fixed to one. Fig. 3 shows example of
Gateway’s topic settings and responsible area.
Table 2 shows the results of the experiment when thenumber of Gateways is varied, and it can be confirmed
from Table 2 that the average delay time decreases with
the number of Gateways regardless of whether the topic
for which the Gateway is responsible is set or not. In
other words, by increasing the number of Gateways, theprocessing capacity of the entire system can be improved.
It can be confirmed that Gamma implemented in thispaper ensures scalability by increasing the number ofGateways.
From Table 2, we can see that the average delay timeis smaller in the case of "With responsibility area" asshown in Fig. 2 than in the case of "Without
responsibility" as shown in Fig. 1. Therefore, it can besaid that the setting of the assigned topic in the Gateway,
one of the functions of Gamma implemented in this paper,
has improved the efficiency of the entire system.
5. Conclusion
This paper has proposed Gamma which is a messaging
platform for spatial data. Gamma uses distributed MQTT
system to share spatial data.
A previous work of distributed MQTT system forsharing spatial data is the work of Ryo Kawaguchi et al4.
This previous research has two problems, which aredescribed in Chapter 2.
In order to solve these problems, Gamma adds
Manager to the previous work4, and is implemented fivefunctions(including a client library). We have confirmedthat the five functions of Gamma properly are run. Thisconfirms that Gamma solves the problem of not being
able to change the configuration of the distributed MQTT
broker while the system is running.

140

•

•

solve this problem, it is first necessary for the
manager to monitor each node. One possible methodof monitoring dead nodes is to periodically send
survival report messages from each node to the
manager, and to determine that a node whose
survival report message has not been updated for acertain period of time has failed.
Support for single-level wildcards
There are two types of wildcards for MQTT topics:
multi-level wildcards and single-level wildcards.
Currently, Gamma supports only multi-levelwildcards and does not support single-levelwildcards. Therefore, we believe that Gamma's
usefulness will be improved by supporting singlelevel wildcards as well.
Manager Redundancy
Currently, there is only one manager per system, andif a manager stops due to hardware failure or otherreasons, the system becomes unavailable. Therefore,
in order to keep the system running, it is necessary
to have multiple managers and make them redundant.

Authors Introduction
Takahiro Ueda
Takahiro Ueda received the Bachelor's
degree in engineering(computerscience and systems engineering) fromthe University of Miyazaki, Japan in
2021. He is currently a Master's student
in Graduate School of Engineering at
the University of Miyazaki, Japan. His
research interests software development
support method and networking.

Tetsuro Katayama
Tetsuro Katayama received a Ph.D.
degree in engineering from Kyushu
University, Fukuoka, Japan, in 1996.
From 1996 to 2000, he has been a
Research Associate at the Graduate
School of Information Science, Nara
Institute of Science and Technology,
Japan. Since 2000 he has been an
Associate Professor at the Faculty of Engineering, Miyazaki
University, Japan. He is currently a Professor with theFaculty of Engineering, University of Miyazaki, Japan. His
research interests include software testing and quality. He isa member of the IPSJ, IEICE, and JSSST.

References
1. “Utilizing Spatial Data: The Future Visible throughObjects and Locations” (in Japanese),https://www.nttdata.com/jp/ja/data-insight/2020/033001/(Accessed 2021-12-14)
2. “DRiVR”,
https://drivr.app/ (Accessed 2021-12-14)
3. “MQTT Version 3.1.1”,
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqttv3.1.1-os.html (Accessed 2021-12-14)
4. R. Kawaguchi and M. Bandai, “A Distributed
MQTT Broker System for Location-based IoTApplications” , 2019 IEEE International Conference on
Consumer Electronics (ICCE), pp.1-4, 2019
5. R. Kawaguchi and M. Bandai, "Edge Based MQTT
Broker Architecture for Geographical IoT Applications",
2020 International Conference on Information
Networking (ICOIN), pp. 232-235, 2020
6. “The Go Programming Language”,
https://go.dev/, (Accessed: 2022-06-02)
7. “Mosquitto”,
https://mosquitto.org/ (Accessed: 2022-06-02)
8. “paho”
https://www.eclipse.org/paho/ (Accessed 2022-06-02)
9. “S2 Geometry”,
https://s2geometry.io/ (Accessed 2021-12-14)
10. “Raspberry Pi”,
https://www.raspberrypi.com/ (Accessed 2022-04-24)
11. “cputool”,
http://manpages.ubuntu.com/manpages/bionic/man8/cput
ool.8.html (Accessed 2021-12-14)

Yoshihiro Kita

Hisaaki Yamaba

Yoshihiro Kita received a Ph.D. degree
in systems engineering from the
University of Miyazaki, Japan, in 2011.
He is currently an Associate Professor
with the Faculty of Information
Systems, University of Nagasaki, Japan.
His research interests include software
testing and biometrics authentication.

Hisaaki Yamaba received the B.S. and
M.S. degrees in chemical engineeringfrom the Tokyo Institute ofTechnology, Japan, in 1988 and 1990,
respectively, and the Ph D. degree insystems engineering from the
University of Miyazaki, Japan in 2011.
He is currently an Assistant Professor
with the Faculty of Engineering,
University of Miyazaki, Japan. His research interests include
network security and user authentication. He is a member of
SICE and SCEJ.

141

Kentaro Aburada

Kentaro Aburada received the B.S.,
M.S, and Ph.D. degrees in computerscience and system engineering fromthe University of Miyazaki, Japan, in
2003, 2005, and 2009, respectively. He
is currently an Associate Professor with
the Faculty of Engineering, Universityof Miyazaki, Japan. His researchinterests include computer networks
and security. He is a member of IPSJ and IEICE.
Naonobu Okazaki

Naonobu Okazaki received his B.S,
M.S., and Ph.D. degrees in electricaland communication engineering fromTohoku University, Japan, in 1986,
1988 and 1992, respectively. He joined
the Information Technology Researchand Development Center, Mitsubishi
Electric Corporation in 1991. He iscurrently a Professor with the Faculty ofEngineering, University of Miyazaki since 2002. His
research interests include mobile network and network
security. He is a member of IPSJ, IEICE and IEEE.

142