MQTT v/s CoAP
Message Queuing Telemetry Transport
&
Constrained Application Protocol
Presented By: Group N
Asad Javed
Narges Yousefnezhad
Tapio Särkkä
Mcha Khamis
Sunny Vijay
Contents
● Background
● Design Principles of MQTT and CoAP
● Parameters for Performance Measuring
● MQTT experimental results
● CoAP experimental results
● MQTT and CoAP Experimental Comparison
● Conclusion
Background
➢ We understand what is MQTT and CoAP protocol are.
➢ We studied and analyzed the 5 elements of both the protocols:
● Service
● Assumption
● Vocabulary
● Encoding
● Procedure
➢ Hands on Practice to test and analysis the services of each protocol with the help of
Wireshark simulation.
➢ Comparison between MQTT and CoAP (Continue….)
Background
➢ Comparison between MQTT and CoAP:
MQTT CoAP
Highly decoupled publisher and subscriber Model Asynchronous Communication Model
Ensures reliable message delivery irrespective of source Smaller packet size and faster transmit cycles
node through a guaranteed message delivery model
Header is of 2 bytes Header is of 4 bytes
Allows 16 different types of messages Allows only 4 types of messages
MQTT uses TCP and therefore much better for scenarios CoAP uses UDP for transport layer, here connectionless
where connectivity is needed for most of the time models ensures that battery consumption is better
It is unencrypted, but can use TLS/SSL for security and Works with DTLS (Data transport Layer security)
encryption
Works on Flexible Topic Subscription It has Stable Resource discovery mechanism
Design Principles for MQTT and CoAP
MQTT is designed for high latency and low-bandwidth networks and CoAP for constraint
and low-bandwidth networks.During the design of the protocols following principles
helps to make the protocol structure easy ,gives key choices during decision which
determine the way as how it would look and works.
● Simplicity
● Minimum data Overhead
● Able to cater to frequent network disruption
● Continuous session awareness
● Minimum resource
● Quality of Services
● Take into account the Trade-offs
● Able to provide flexibility, reliability, energy efficiency, adaptability(to application
requirement changes)
Parameters for Performance Measurement
Performance Metrics:
● latency
● Throughput
● Qos
Parameters for Performance Measurement
Local
● From wireless network to a fixed server
latency
● Long latency: bw=10, delay='400ms'
slow
● Basic Slow topology small buffers:max_queue_size=5, bw=0.1, delay='200ms'
buffered
● Slow overbuffered bottleneck: max_queue_size=200, bw=0.1, delay='200ms'
lossy
● 10% packet loss rate: loss=10, bw=10, delay='20ms'
MQTT Performance results
Scenario 1 results:
QoS =0 QoS =1 QoS =2
Message
Latency Throughput Latency Throughput Latency Throughput
size
10 2.2978 2384 2.7167 2440 1.9844 2684
100 2.4233 2855 2.3359 3455 2.1929 2757
500 2.1938 6078 2.7169 5331 2.4016 3854
1000 2.5533 8356 2.6042 8420 2.4349 5445
MQTT Performance results
● Throughput
● Latency
MQTT Scalability
• capability of the system, network, or process to handle a growing amount
of work.
– Scaling out: Adding more nodes
– Scaling up: Adding more resources per node
• In our testing, scalability is evaluated based on:
– Number of connections
– Latency measurements
– Multiple brokers
– CPU usage
MQTT Scalability
Scenario 1: Single Mosquito broker (on lh1)
• Message size: 8 bytes
• 2 messages per publisher
MQTT Scalability
Scenario 2:
● HAProxy Load Balancer (local machine)
● Broker 1: Mosquito broker on iot.eclipse.org
● Broker 2: Another local machine with the same subnet as HAProxy.
MQTT Scalability
• Scenario 2 (Multi broker setup)
MQTT Scalability
• Scenario 3: One broker with multiple connections to evaluate cpu usage.
CoAP performance measurement
● Latency and throughput, no QoS
● Local, latency, slow, buffered, and lossy
● Message sizes: 10, 100, 500, and 1000 bytes.
CoAP performance results
● Latency:
● Throughput:
CoAP Scalability
● Measuring scalability we would test making all clients requests at the same server
then we added many request per clients and repeat in different environment
scenarios.
● Unfortunately we had no results as we had problem with coap library and problems
with coap servers implementation.
MQTT and CoAP Experimental Comparison
Conclusion
- MQTT and CoAP Performance
- Latency doesn’t scale with packet size, buffer size, or slow bandwidth, and
QoS levels
- Throughput scales
- negatively with latency
- positively with packet size and QoS levels
- Packet loss affects greatly
- MQTT vs CoAP Performance
- Latency: CoAP
- Throughput: MQTT
- MQTT Scalability
- Based on current testing, it seems that MQTT is scalable. However, the
latency and CPU usage increases if more clients are connected.
- But, it has to be tested on a larger scale and with different brokers as well.
- More scalable if connected using load balancer.
Thank you!