<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Scalable and reliable MQT T messaging: Evaluating TBMQ for P2P scenarios</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Dmytro I. Shvaika</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff5">5</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrii I. Shvaika</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff5">5</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Dmytro I. Landiak</string-name>
          <email>dlandiak2110@gmail.com</email>
          <xref ref-type="aff" rid="aff4">4</xref>
          <xref ref-type="aff" rid="aff5">5</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Volodymyr O. Artemchuk</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="editor">
          <string-name>PCWrEooUrckResehdoinpgs ISSNc1e6u1r-3w-0s0.o7r3g</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Center for Information-analytical and Technical Support of Nuclear Power Facilities Monitoring of the NAS of Ukraine</institution>
          ,
          <addr-line>34a Palladin Ave., Kyiv, 03142</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>G.E. Pukhov Institute for Modelling in Energy Engineering of the NAS of Ukraine</institution>
          ,
          <addr-line>15 Oleg Mudrak Str., Kyiv, 02000</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Kyiv National Economic University named after Vadym Hetman</institution>
          ,
          <addr-line>54/1 Peremohy Ave., Kyiv, 03057</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>State Non-Profit Enterprise “State University “Kyiv Aviation Institute”</institution>
          ,
          <addr-line>1 Liubomyra Huzara Ave., Kyiv, 03058</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff4">
          <label>4</label>
          <institution>Ternopil Ivan Pului National Technical University</institution>
          ,
          <addr-line>56 Ruska Str., Ternopil, 46001</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff5">
          <label>5</label>
          <institution>ThingsBoard, Inc.</institution>
          ,
          <addr-line>110 Duane Str., Suite 1C, New York, 10007</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <fpage>58</fpage>
      <lpage>66</lpage>
      <abstract>
        <p>Point-to-point (P2P) communication represents a critical messaging pattern in MQTT, enabling precise, reliable one-to-one exchanges essential for IoT applications like real-time monitoring, command control, and secure data transfer. As edge computing continues to expand, resource-constrained edge nodes demand high connection density and low-latency messaging to support real-time data exchange and responsive operations. This paper evaluates the performance of TBMQ, a scalable and fault-tolerant MQTT broker designed to meet the demands of modern IoT ecosystems. By leveraging a distributed architecture built on Kafka and Redis, TBMQ eficiently supports high-throughput P2P messaging while maintaining low latency and reliability. A series of performance tests were conducted, scaling workloads from 200,000 to 1,000,000 messages per second. These tests revealed TBMQ's linear scalability, eficient resource utilization, and robust reliability under high trafic loads. The findings position TBMQ as a powerful solution for IoT and edge computing environments requiring dependable P2P communication. Future enhancements, including Redis optimizations and expanded edge computing integration, are proposed to further improve performance and adaptability.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;MQTT</kwd>
        <kwd>TBMQ</kwd>
        <kwd>point-to-point messaging</kwd>
        <kwd>performance testing</kwd>
        <kwd>Redis</kwd>
        <kwd>Kafka</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Message Queuing Telemetry Transport (MQTT) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] is a lightweight protocol widely used in the Internet
of Things (IoT) ecosystem for connecting edge devices. Its point-to-point (P2P) communication pattern
facilitates direct and reliable one-to-one message exchanges, which are crucial for IoT applications like
private messaging, command delivery, and other direct interaction use cases.
      </p>
      <p>Scaling and ensuring reliability in edge-based P2P messaging becomes increasingly challenging as
message loads grow to hundreds and millions of messages per second. Existing solutions often face
synchronous communication bottlenecks and the complexity of managing distributed architectures,
limiting their performance in high-demand IoT environments.</p>
      <p>
        Recent research [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] highlights ThingsBoard as a leading open-source IoT platform widely adopted in
academia and industry. Building on insights from its extensive use, the platform’s developers created
TBMQ – a high-performance MQTT broker tailored to IoT needs [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Launched in 2020 and
opensourced in 2023, TBMQ ensures reliability and scalability, handling 100 million connections and over 3
million messages per second, leveraging Kafka for eficient messaging.
      </p>
      <p>While modern brokers, like TBMQ, excel in handling massive connections and high throughput, P2P
messaging introduces unique challenges. These include direct message routing, increased connection
tracking, and ensuring low latency, and reliable delivery. Such scenarios demand eficient mechanisms
for managing dynamic client interactions and maintaining scalability under heavy loads.</p>
      <p>The key objectives and contributions of this study are:
• Evaluating TBMQ’s ability to handle increasing P2P messaging loads for persistent DEVICE
clients, which use shared Kafka topics to optimize resource usage and Redis for reliable delivery.
Benchmark tests progressively scaled the system while increasing the message load from 200,000
to 1,000,000 messages per second.
• Providing a detailed performance analysis, including CPU utilization, latency, and resource
scaling, to validate TBMQ’s eficiency.</p>
      <p>The results demonstrate that TBMQ provides reliable, scalable, and high-performance messaging,
making it an optimal solution for edge-based IoT ecosystems.</p>
    </sec>
    <sec id="sec-2">
      <title>2. The P2P problem in the scalable broker context</title>
      <sec id="sec-2-1">
        <title>2.1. Challenges of P2P messaging for brokers</title>
        <p>
          The survey presented in [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] ofers an extensive evaluation of MQTT brokers, covering aspects such as
protocol-specific features, security mechanisms, cloud deployment capabilities, and data visualization
tools, alongside a comparison of MQTT client libraries. However, the study does not delve into the
brokers’ performance or suitability in P2P messaging scenarios, leaving room for further exploration in
this area.
        </p>
        <p>
          Efective resource management in P2P messaging systems, such as handling dynamic server
availability and message bufering, remains a challenge. As demonstrated by Ma et al. [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], the modeling of P2P
networks using queueing theory reveals how server availability fluctuations and preemptive priority
policies influence system performance and energy eficiency. The ‘free-riding’ behavior and energy
ineficiency represent significant obstacles for P2P messaging systems, especially in IoT environments.
Studies such as [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] demonstrate how these issues can undermine system performance, necessitating
advanced strategies like repairable breakdown models and diferentiated service levels to optimize
overall network behavior.
        </p>
        <p>P2P messaging introduces distinct challenges for brokers due to several key aspects:
1. Direct Message Routing: In P2P interactions, messages are sent directly from a specific publisher
to a specific subscriber, bypassing shared topics or group routing. This requires brokers to
accurately track which clients are interacting and ensure low-latency delivery.
2. Increased Broker Load: In P2P scenarios, each message may be unique to a specific recipient,
significantly increasing the number of routed connections. This adds extra load on brokers to
manage sessions, connections, and queues eficiently.
3. Scalability: With potentially hundreds of thousands or even millions of simultaneous P2P
connections, brokers must handle each connection quickly and reliably. This necessitates eficient
mechanisms for state management, load balancing, and latency handling.
4. Reliability assurance: For many IoT applications, message loss is unacceptable, particularly in
P2P scenarios where there is no group duplication. Brokers must ensure reliable delivery with
minimal delay, even under high trafic conditions.
5. Decentralization requirements: In certain P2P scenarios (e.g., ensuring privacy or fault tolerance),
brokers need to operate efectively without relying on a centralized node. This complicates the
implementation of traditional MQTT mechanisms.</p>
        <p>Thus, the core challenge of P2P messaging for brokers lies in enabling scalable, reliable, and
lowlatency message routing across numerous real-time connections.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Limitations of existing solutions</title>
        <p>
          The scalability of existing communication protocols remains a challenge, particularly in large-scale
IoT deployments. As noted in [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ], cloud and fog computing solutions require eficient protocols, yet
many—including MQTT—were not originally designed for decentralized P2P environments. This leads
to scalability constraints and ineficiencies in handling massive direct connections. Although MQTT is
widely used, its efectiveness in distributed deployments remains an active research topic.
        </p>
        <p>
          While innovative queuing-based approaches [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] contribute to energy eficiency and help address
free-riding behavior, their dependence on intricate mathematical models and parameter tuning might
pose challenges to scalability in real-world MQTT broker environments.
        </p>
        <p>
          To address the limitations of static routing technologies in P2P-based edge clouds, adaptive routing
approaches like ARPEC have been proposed [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. By combining message activity analysis, network
topology, and minimum cost maximum flow (MCMF) graph mapping, ARPEC improves performance
metrics such as user latency and node resource utilization in edge IoT systems. Although adaptive
routing approaches such as ARPEC [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] improve Edge Cloud performance, their reliance on complex
algorithms like MCMF and predictive models may hinder real-time scalability and adoption in
resourceconstrained IoT environments.
        </p>
        <p>
          Standard encryption methods may impose a significant overhead on MQTT brokers in P2P
environments. Alternative approaches, such as Value-to-HMAC, could be more eficient in resource-constrained
conditions [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
        <p>Despite advancements, existing brokers face significant limitations in supporting P2P messaging for
edge environments:
• Synchronous Persistence Bottlenecks: Many brokers rely on synchronous mechanisms (e.g.,
diskbased storage or synchronous Redis clients), causing delays in high-throughput P2P scenarios.
• Scalability Constraints: Distributed architectures often introduce complexities in cluster
management, limiting seamless scaling for P2P messaging.
• Edge Environment Challenges: Resource limitations at the edge constrain brokers’ ability to
maintain high-throughput, low-latency communication.
• Latency Sensitivity: Real-time P2P communication requires ultra-low latency, which existing
brokers struggle to achieve consistently under heavy message loads.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology for scalability and eficiency testing of TBMQ in P2P scenarios</title>
      <p>
        The methodology for testing the scalability and eficiency of TBMQ builds upon the approaches used
in prior evaluations of MQTT brokers under stress testing, as outlined in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. This study examined
brokers like Mosquitto, ActiveMQ, HiveMQ, and others, focusing on metrics such as CPU usage, latency,
and message rate, which are critical for analyzing broker performance in resource-constrained and
highthroughput environments. Incorporating these methods ensures a robust and comparative assessment
of TBMQ in P2P messaging scenarios.
      </p>
      <p>To assess the TBMQ’s ability to handle point-to-point communication at scale, five performance
tests measuring throughput, eficiency, and latency under progressively increasing workloads were
performed. The test environment, illustrated in Figure 1, supported a maximum throughput of 1 million
messages per second. Throughput refers to the total number of messages per second, including both
incoming and outgoing messages.</p>
      <p>
        The performance environment was deployed on an Amazon Web Services Elastic Kubernetes Service
(AWS EKS) cluster with horizontal scaling to accommodate growing demands. The TBMQ cluster
included 5 nodes (16 virtual central processing units (vCPU), 32 GiB random-access memory (RAM)
each), supported by 5 Kafka instances (2 vCPU, 4 GiB RAM each) [
        <xref ref-type="bibr" rid="ref11 ref12 ref13">11, 12, 13</xref>
        ] and 11 Redis instances
(2 vCPU, 4 GiB RAM each) [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. Drawing on the comparison between Redis and MS SQL presented
in the work [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], Redis is incorporated into the methodology for eficient state and message tracking,
enabling high-throughput communication scenarios with minimal latency and resource overhead.
      </p>
      <p>The tests simulated 500,000 publishers and subscribers, with each client pair operating at 1 message
per second using Quality of Service (QoS) 1 for reliable delivery. Subscribers were configured with
clean_session=false, ensuring that messages were retained and delivered even during ofline periods.
Published messages were 62 bytes in size, assigned to unique topics such as "europe/ua/kyiv/$number",
with corresponding subscriptions to "europe/ua/kyiv/$number+", where $number identified each
publishersubscriber pair.</p>
      <sec id="sec-3-1">
        <title>3.1. Test agent design for simulating TBMQ performance</title>
        <p>
          To evaluate TBMQ’s performance under increasing message trafic, a test agent architecture was
designed to simulate large-scale publisher and subscriber activity. The test agent consisted of two main
components: runner pods and an orchestrator pod. Each component was deployed on Amazon
Elastic Compute Cloud (EC2) instances, a scalable virtual computing service provided by AWS [
          <xref ref-type="bibr" rid="ref16 ref17">16, 17</xref>
          ].
EC2 enables users to provision virtual machines with configurable CPU, memory, and network capacity,
ofering flexibility to handle varying workloads.
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>Runner pods</title>
        <p>Runner pods were specialized for either publishing or subscribing. The number of publisher pods always
matched the number of subscriber pods, ensuring symmetry in message flow. Pods were deployed
on EC2 instances, with the number of instances and pods per instance adjusted based on the desired
throughput.</p>
        <p>As shown in table 1, throughput increases were managed by scaling the number of EC2 instances or
pods per instance. For example, a throughput of 1 million messages per second required 4 instances,
each hosting 5 pods.</p>
      </sec>
      <sec id="sec-3-3">
        <title>Orchestrator pod</title>
        <p>The orchestrator pod managed the execution and coordination of runner pods and was hosted on a
dedicated EC2 instance. This instance also supported auxiliary monitoring tools, including:
• Kafka Redpanda Console: For real-time broker monitoring.</p>
        <p>• Redis Insight: For analyzing database performance.</p>
        <p>This modular architecture allowed the test agent to adapt dynamically to increasing trafic demands.
By efectively distributing workloads across EC2 instances, it maintained consistent performance and
reliable message delivery, even at high throughput levels.</p>
      </sec>
      <sec id="sec-3-4">
        <title>3.2. Infrastructure overview</title>
        <p>
          This section provides an overview of the test environment, highlighting the hardware specifications
of the services utilized and the distribution of EKS cluster pods across AWS EC2 instances. EKS is a
managed platform that simplifies the deployment and management of containers using the popular
Kubernetes system [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ]. It automates the orchestration of containerized applications, allowing them
to run eficiently on scalable infrastructure. Kubernetes has become a cornerstone for deploying and
managing large-scale distributed systems, ofering advanced features such as horizontal pod autoscaling,
rolling updates, and resource quotas. In our test environment, services such as TBMQ, Kafka, and Redis
were deployed in containers within an EKS cluster and distributed across AWS EC2 virtual machines.
This setup ensures optimal resource allocation, scalability, and performance during the testing process.
        </p>
        <p>AWS RDS (Amazon Web Services Relational Database Service) is used for managing our PostgreSQL
database. RDS is a managed service that simplifies the setup, operation, and scaling of relational
databases in the cloud.</p>
        <p>Table 2 below presents the hardware specifications for the services used in our tests:</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Results</title>
      <p>TBMQ’s performance was tested in phases, starting at 200k msg/sec and increasing by 200k each time,
up to 1M msg/sec. In each phase, the number of TBMQ brokers and Redis nodes was scaled. For the 1M
msg/sec test, the number of Kafka nodes was also scaled to handle the corresponding workload. The
test configurations are summarized in table 3.</p>
      <p>Key takeaways from the tests include:
• Scalability: TBMQ demonstrated linear scalability. Reliable performance was maintained as the
message throughput increased from 200k to 1M msg/sec by incrementally adding TBMQ nodes,
Redis nodes, and Kafka nodes at higher workloads.
• Eficient Resource Utilization: CPU utilization on TBMQ nodes remained consistently around
90% across all test phases, indicating that the system efectively used available resources without
overconsumption.
• Latency Management: The observed latency across all tests remained within two-digit bounds.</p>
      <p>This was predictable given the QoS 1 level chosen for our test, applied to both publishers and
persistent subscribers. We also tracked the average acknowledgment latency for publishers,
which stayed within single-digit bounds across all test phases.
• High Performance: TBMQ’s one-to-one communication pattern showed excellent eficiency,
processing about 8900 msg/s per CPU core. We calculated this by dividing the total throughput
by the total number of CPU cores used in the setup.</p>
      <p>Additionally, the following table and screenshots provide a comprehensive summary of the key
elements and results of the final 1M msg/sec test.
• TBMQ CPU Avg: The average CPU utilization across all TBMQ nodes.
• Msg Latency Avg: The average duration from when a message is transmitted by the publisher to
when it is received by the subscriber.
• Pub Ack Avg: The average time elapsed between the message transmission by the publisher and
the reception of the PUBACK acknowledgment.</p>
      <p>
        For detailed results of the performance evaluation, including insights into CPU utilization, Java
Management Extensions (JMX) monitoring, and Redis instance metrics, please refer to the oficial
documentation [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ].
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Discussion</title>
      <p>Performance testing of TBMQ under extreme-scale P2P messaging revealed critical limitations in the
existing broker architecture. A key issue encountered was the ineficiency of the Redis client library
Jedis, which created a bottleneck due to its synchronous nature. Addressing this challenge required a
migration to Lettuce, an asynchronous Redis client designed for high-concurrency scenarios.</p>
      <p>The following sections describe this migration process, its technical challenges, and its impact on
system performance.</p>
      <sec id="sec-5-1">
        <title>5.1. Migrating from Jedis to Lettuce: overcoming a key testing challenge</title>
        <p>
          One of the most significant challenges during performance testing was overcoming the limitations of
the Jedis library, whose synchronous nature became a bottleneck in high-throughput scenarios. The
Jedis library is a popular Java client for Redis, which is an in-memory data structure store often used as
a database, cache, or message broker. Jedis provides a straightforward API for interacting with Redis,
allowing developers to perform operations like reading and writing data, managing keys, and executing
Redis commands within Java applications. With Jedis, each Redis command is sent and processed
sequentially, meaning the system has to wait for each command to complete before issuing the next
one. This approach significantly limited Redis’s potential to handle concurrent operations and fully
utilize available system resources [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ].
        </p>
      </sec>
      <sec id="sec-5-2">
        <title>Solution: migrating to Lettuce</title>
        <p>
          Lettuce is a scalable thread-safe Redis client for synchronous, asynchronous and reactive usage. Multiple
threads may share one connection if they avoid blocking and transactional operations. To address
the Jedis issue, migration was made to the Lettuce client, which leverages Netty under the hood for
eficient asynchronous communication [
          <xref ref-type="bibr" rid="ref21 ref22">21, 22</xref>
          ]. Unlike Jedis, Lettuce allows multiple commands to
be sent in parallel without waiting for their completion, enabling non-blocking operations and better
resource utilization. This architecture made it possible to fully exploit Redis’s performance capabilities,
especially under high message loads.
        </p>
      </sec>
      <sec id="sec-5-3">
        <title>Challenges during migration</title>
        <p>The migration, however, was not trivial. It required:
• Rewriting a substantial portion of the codebase to transition from synchronous to
asynchronous workflows.</p>
        <p>• Restructuring how Redis commands were issued and handled.</p>
        <p>Careful planning and rigorous testing ensured that these changes maintained system reliability and
correctness.</p>
        <p>By migrating to Lettuce, the bottleneck caused by Jedis was resolved, enabling the full utilization of
Redis’s potential in high-load scenarios. Although the migration process was challenging and required
significant efort, it delivered substantial improvements in system performance.</p>
      </sec>
      <sec id="sec-5-4">
        <title>5.2. Planned optimizations for Redis performance</title>
        <p>
          Current State: Currently, Lua scripts are used in Redis to process messages, ensuring the atomicity of
operations such as saving, updating, and deleting messages. This approach is critical for maintaining
data consistency. However, due to the limitations of the Redis Cluster architecture, each script operates
on a single client. This restriction arises because all keys accessed within a script must reside in the
same hash slot [
          <xref ref-type="bibr" rid="ref23">23</xref>
          ].
        </p>
        <p>Planned optimizations: Future plans include modifying the hashing mechanism for client identifiers
(client IDs) to group more clients into the same Redis hash slot. This adjustment would allow a single
Lua script to process multiple clients within the same hash slot. Such an approach is expected to reduce
overhead and improve the eficiency of Redis operations while adhering to the cluster’s constraints.</p>
        <p>
          Future work in enhancing MQTT brokers for edge computing could benefit from incorporating
dynamic data serialization methods [
          <xref ref-type="bibr" rid="ref24 ref25">24, 25</xref>
          ] and leveraging advanced state synchronization techniques
like CRDTs [
          <xref ref-type="bibr" rid="ref26">26</xref>
          ]. These approaches could further address challenges in IoT scalability, interoperability,
and real-time data consistency in distributed environments.
        </p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusion</title>
      <p>The evaluation of TBMQ in point-to-point (P2P) messaging scenarios has demonstrated its capability to
meet the demands of scalable, reliable, and low-latency communication in IoT applications. By leveraging
a robust architecture built on Kafka and Redis, TBMQ has shown linear scalability and eficient resource
utilization, maintaining performance across a wide range of throughput conditions—from 200,000 to 1
million messages per second.</p>
      <p>Key performance insights include consistent CPU utilization at 90% under high loads, eficient
memory management, and low message latency even during peak operations. The migration from Jedis
to Lettuce was instrumental in overcoming bottlenecks in Redis communication, enabling asynchronous
workflows and higher concurrency. Additionally, planned optimizations for Redis, such as refining Lua
scripting mechanisms, are expected to further enhance TBMQ’s operational eficiency.</p>
      <p>The results position TBMQ as a powerful solution for edge-based IoT ecosystems, addressing the
unique challenges of P2P messaging, including direct message routing, dynamic client management,
and reliability. Future developments, focusing on Redis optimizations and enhanced integration with
edge computing frameworks, will strengthen TBMQ’s adaptability to evolving IoT requirements.</p>
      <p>In conclusion, TBMQ emerges as a scalable and dependable MQTT broker, setting a new benchmark
for P2P communication in distributed IoT environments.</p>
      <p>Author Contributions: Dmytro I. Shvaika and Andriy I. Shvaika contributed to the main text of the manuscript;
methodology, Volodymyr O. Artemchuk; Dmytro I. Shvaika and Dmytro I. Landyak contributed to the software development
and were responsible for the development and execution of performance test; Review writing and editing: all authors
contributed. All authors have read and agreed with the published version of the manuscript.</p>
      <p>Funding: This research was supported by ThingsBoard, Inc., which provided the cloud infrastructure necessary for
conducting the performance tests. The authors gratefully acknowledge their contribution to this research.
Data Availability Statement: The TBMQ source code is publicly available at https://github.com/thingsboard/tbmq.
Additionally, the source code of the performance test tool used in this study can be accessed at https://github.com/thingsboard/
tb-mqtt-perf-tests.</p>
      <p>Conflicts of Interest: The authors declare no conflict of interest.</p>
      <p>Acknowledgments: The authors express their sincere gratitude to the entire ThingsBoard, Inc. team for their contributions
and collaborative eforts in the development and evaluation of the system.</p>
      <p>Declaration on Generative AI: During the preparation of this work, the authors used ChatGPT-4 and Grammarly for:
abstract drafting, content enhancement, grammar and spelling check, sentence polishing, and rephrasing to improve clarity
and conciseness. After using these tools, the authors reviewed and edited the content as needed and took full responsibility
for the publication’s content. No AI-generated text was used to create new content or sections of this work.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>[1] MQTT, MQTT: The standard for IoT messaging</article-title>
          ,
          <year>2022</year>
          . URL: https://mqtt.org/, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Di Felice</surname>
          </string-name>
          , G. Paolone,
          <article-title>Papers mentioning things board: A systematic mapping study</article-title>
          ,
          <source>Journal of Computer Science</source>
          <volume>20</volume>
          (
          <year>2024</year>
          )
          <fpage>574</fpage>
          -
          <lpage>584</lpage>
          . doi:
          <volume>10</volume>
          .3844/jcssp.
          <year>2024</year>
          .
          <volume>574</volume>
          .584.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3] ThingsBoard, TBMQ,
          <year>2023</year>
          . URL: https://thingsboard.io, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>B.</given-names>
            <surname>Mishra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kertesz</surname>
          </string-name>
          ,
          <article-title>The use of MQTT in M2M and IoT systems: A survey</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>201071</fpage>
          -
          <lpage>201086</lpage>
          . doi:
          <volume>10</volume>
          .1109/ACCESS.
          <year>2020</year>
          .
          <volume>3035849</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Ma</surname>
          </string-name>
          , M. Yan,
          <string-name>
            <given-names>R.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Performance analysis of P2P network content delivery based on queueing model</article-title>
          ,
          <source>Cluster Computing</source>
          <volume>27</volume>
          (
          <year>2023</year>
          ). doi:
          <volume>10</volume>
          .1007/s10586-023-04111-w.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Shen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Ma</surname>
          </string-name>
          ,
          <article-title>The analysis of P2P networks with malicious peers and repairable breakdown based on Geo/Geo/1+1 queue</article-title>
          ,
          <source>Journal of Parallel and Distributed Computing</source>
          <volume>195</volume>
          (
          <year>2025</year>
          )
          <article-title>104979</article-title>
          . URL: https://www.sciencedirect.com/science/article/pii/S0743731524001436. doi:https://doi. org/10.1016/j.jpdc.
          <year>2024</year>
          .
          <volume>104979</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>J.</given-names>
            <surname>Dizdarevic</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Carpio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jukan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Masip</surname>
          </string-name>
          ,
          <article-title>A survey of communication protocols for IoT and related challenges of fog and cloud computing integration</article-title>
          ,
          <source>ACM Computing Surveys</source>
          <volume>51</volume>
          (
          <year>2018</year>
          ). doi:
          <volume>10</volume>
          .1145/3292674.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>B.</given-names>
            <surname>Dong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <article-title>An adaptive routing strategy in P2P-based Edge Cloud</article-title>
          ,
          <source>Journal of Cloud Computing</source>
          <volume>13</volume>
          (
          <year>2024</year>
          ). doi:
          <volume>10</volume>
          .1186/s13677-023-00581-w.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>D.</given-names>
            <surname>Dinculeană</surname>
          </string-name>
          , X. Cheng,
          <article-title>Vulnerabilities and limitations of MQTT protocol used between IoT devices</article-title>
          ,
          <source>Applied Sciences</source>
          <volume>9</volume>
          (
          <year>2019</year>
          ). URL: https://www.mdpi.com/2076-3417/9/5/848. doi:
          <volume>10</volume>
          .3390/ app9050848.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>B.</given-names>
            <surname>Mishra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Mishra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kertész</surname>
          </string-name>
          ,
          <article-title>Stress-testing MQTT brokers: A comparative analysis of performance measurements</article-title>
          ,
          <source>Energies</source>
          <volume>14</volume>
          (
          <year>2021</year>
          )
          <article-title>5817</article-title>
          . doi:
          <volume>10</volume>
          .3390/en14185817.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Kafka</surname>
            ,
            <given-names>Apache</given-names>
          </string-name>
          <string-name>
            <surname>Kafka</surname>
          </string-name>
          .,
          <year>2024</year>
          . URL: https://kafka.apache.org/, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>S.</given-names>
            <surname>Vyas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. K.</given-names>
            <surname>Tyagi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Jain</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sahu</surname>
          </string-name>
          ,
          <article-title>Performance evaluation of apache kafka - a modern platform for real time data streaming</article-title>
          ,
          <source>in: 2022 2nd International Conference on Innovative Practices in Technology and Management (ICIPTM)</source>
          , volume
          <volume>2</volume>
          ,
          <year>2022</year>
          , pp.
          <fpage>465</fpage>
          -
          <lpage>470</lpage>
          . doi:
          <volume>10</volume>
          .1109/ ICIPTM54933.
          <year>2022</year>
          .
          <volume>9754154</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>S.</given-names>
            <surname>Park</surname>
          </string-name>
          , J.
          <string-name>
            <surname>-H. Huh</surname>
          </string-name>
          ,
          <article-title>A study on big data collecting and utilizing smart factory based grid networking big data using apache kafka</article-title>
          ,
          <source>IEEE Access 11</source>
          (
          <year>2023</year>
          )
          <fpage>96131</fpage>
          -
          <lpage>96142</lpage>
          . doi:
          <volume>10</volume>
          .1109/ACCESS.
          <year>2023</year>
          .
          <volume>3305586</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Redis</surname>
          </string-name>
          , Redis Pub/Sub,
          <year>2024</year>
          . URL: https://redis.io/docs/latest/develop/interact/pubsub/, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>G.</given-names>
            <surname>Muradova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Hematyar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Jamalova</surname>
          </string-name>
          ,
          <article-title>Advantages of redis in-memory database to eficiently search for healthcare medical supplies using geospatial data</article-title>
          ,
          <source>in: 2022 IEEE 16th International Conference on Application of Information and Communication Technologies (AICT)</source>
          ,
          <year>2022</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>5</lpage>
          . doi:
          <volume>10</volume>
          .1109/AICT55583.
          <year>2022</year>
          .
          <volume>10013544</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>AWS</surname>
            ,
            <given-names>AWS</given-names>
          </string-name>
          ,
          <year>2023</year>
          . URL: https://aws.amazon.com/, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>A.</given-names>
            <surname>Wittig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wittig</surname>
          </string-name>
          ,
          <string-name>
            <surname>Amazon Web</surname>
          </string-name>
          <article-title>Services in Action: An in-depth guide to AWS, Simon</article-title>
          and Schuster,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Kubernetes</surname>
          </string-name>
          , Kubernetes documentation,
          <year>2023</year>
          . URL: https://kubernetes.io/, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <article-title>ThingsBoard, 1M Throughput P2P Performance Test</article-title>
          , https://thingsboard.io/docs/mqtt-broker/ reference/1m
          <article-title>-throughput-p2p-performance-test/#performance-</article-title>
          <string-name>
            <surname>tests</surname>
          </string-name>
          ,
          <year>2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <surname>Baeldung</surname>
          </string-name>
          , Intro to Jedis - the
          <source>Java Redis Client library</source>
          ,
          <year>2024</year>
          . URL: https://www.baeldung.
          <article-title>com/ jedis-java-redis-client-library.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <surname>Netty</surname>
          </string-name>
          , The netty project,
          <year>2024</year>
          . URL: https://netty.io/, Accessed:
          <year>January 2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>M.</given-names>
            <surname>Norman</surname>
          </string-name>
          , W. Marvin, Netty in action, Manning,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <article-title>BoynerTechnology, Limitations of scripting with Lua in RedisApache, 2023</article-title>
          . URL: https:// boynergroup.medium.
          <article-title>com/limitations-of-scripting-with-lua-in-redis-</article-title>
          <string-name>
            <surname>b4381bd9629f</surname>
          </string-name>
          ,
          <source>Accessed: January</source>
          <year>2025</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>D. I.</given-names>
            <surname>Shvaika</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. I.</given-names>
            <surname>Shvaika</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. O.</given-names>
            <surname>Artemchuk</surname>
          </string-name>
          ,
          <article-title>Advancing IoT interoperability: dynamic data serialization using ThingsBoard</article-title>
          ,
          <source>Journal of Edge Computing</source>
          <volume>3</volume>
          (
          <year>2024</year>
          )
          <fpage>126</fpage>
          -
          <lpage>135</lpage>
          . doi:
          <volume>10</volume>
          .55056/ jec.745.
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [25]
          <string-name>
            <given-names>D. I.</given-names>
            <surname>Shvaika</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. I.</given-names>
            <surname>Shvaika</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. O.</given-names>
            <surname>Artemchuk</surname>
          </string-name>
          ,
          <article-title>Data serialization protocols in IoT: problems and solutions using the ThingsBoard platform as an example</article-title>
          , in: T. A.
          <string-name>
            <surname>Vakaliuk</surname>
            ,
            <given-names>S. O.</given-names>
          </string-name>
          <string-name>
            <surname>Semerikov</surname>
          </string-name>
          (Eds.),
          <source>Proceedings of the 4th Edge Computing Workshop</source>
          (doors
          <year>2024</year>
          ), Zhytomyr, Ukraine, April 5,
          <year>2024</year>
          , volume
          <volume>3666</volume>
          <source>of CEUR Workshop Proceedings, CEUR-WS.org</source>
          ,
          <year>2024</year>
          , pp.
          <fpage>70</fpage>
          -
          <lpage>75</lpage>
          . URL: https: //ceur-ws.
          <source>org/</source>
          Vol-
          <volume>3666</volume>
          /paper11.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          [26]
          <string-name>
            <given-names>A.</given-names>
            <surname>Prymushko</surname>
          </string-name>
          , I. Puchko,
          <string-name>
            <given-names>M.</given-names>
            <surname>Yaroshynskyi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Sinko</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Kravtsov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Artemchuk</surname>
          </string-name>
          ,
          <article-title>Eficient State Synchronization in Distributed Electrical Grid Systems Using Conflict-Free Replicated Data Types</article-title>
          , IoT
          <volume>6</volume>
          (
          <year>2025</year>
          )
          <article-title>6</article-title>
          . doi:
          <volume>10</volume>
          .3390/iot6010006.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>