SSRN Id3791124
SSRN Id3791124
SSRN Id3791124
Applications: A Comparison
Sreelakshmi A and Sajesh kumar U
Abstract—The Internet of Things is one of the fast-growing protocols. The transport layer protocol TCP (Transmission
trends in information technology applications. As with the growth Control Protocol) is used for connection-oriented transmission
of IoT devices, the volume and pace of the data also increased for messages whereas the user datagram protocol (UDP)
to a greater extend. The data transfer is possible with the
help of a message transmission system. The protocol has a is used for connectionless service in IoT systems [2]. The
major role in effective communication with the devices and abstraction layer, which identifies varieties of protocols and
connects them using various applications on the internet of things. interfacing methods is called the application layer [3]. It is the
The application layer is responsible for the data formatting, highest layer extending from the client-side. The application
presentation, providing assistance, and also it determines the layer has a wide variety of application requirements and also it
protocols for the message transfer at the application level. The
selection of an efficient protocol is the foundation for the intact is responsible for data formatting, presentation, and creation of
IoT system. The performance aspects of the IoT protocols are a protocol for message passing. The messaging protocol within
important to its widespread utilization in various fields. However, an application plays a vital role in providing effectiveness to
the protocol feature set aspect is essential for its adoption in the M2M communication. The selection of suitable and effective
real world. The IoT devices are generally limited to computa- protocol for a messaging system is a challenging task [4]. The
tional resources and processing power, selecting a lightweight,
reliable, and secure messaging protocol becomes a daunting selection of a suitable messaging protocol for an application
challenge. This paper discusses four important application layer is done by understanding the requirements of a specific IoT
protocols that are being used to ensure a reliable bond among system. In a resource-constrained environment like IoT, it is
devices, which are connected in an IoT system. In this paper, difficult to choose a heavyweight protocol like HTTP, which
we present a comparison and an evaluation of four application also uses a single standard protocol for messaging that IoT
layer messaging protocol for IoT such as MQTT (Message Queu-
ing Telemetry Protocol), AMQP (Advanced Message Queuing cannot depend on for all its needs [5]. Some application layer
Protocol), CoAP (Constrained Application Protocol), and XMPP protocols are specifically designed for IoT environments. They
(Extensible Messaging Presence Protocol). The protocols and are designed for data collection applications in constrained en-
their characteristics are explained in this work followed by a vironments such as MQTT and CoAP [6]. For reliable and fast
comparison to understand the strengths and limitations of these business transactions, the application layer protocol such as
protocols.
Index Terms—IoT, MQTT, AMQP, CoAP, XMPP AMQP is used [7]. The XMPP protocol is designed for instant
messaging and online presence detection. The extension of the
I. I NTRODUCTION baseline XMPP to the publish-subscribe model is suitable for
IoT environments [8]. The comparison of various application-
193
Electronic copy available at: https://ssrn.com/abstract=3791124
Government College of Engineering Kannur (GCEK)
comparison of the four messaging protocols Message Queuing
Telemetry Transport (MQTT), Extensible Messaging and Pres-
ence Protocol (XMPP), Advanced Message Queuing Protocol
(AMQP), and Constrained Application Protocol (CoAP) that
are used in embedded applications. In this work, section II
presents a general evaluation of these protocols to introduce
their characteristics. In section III, comparative analysis based
on security, power consumption, payload support, quality of
service, transmission delay and protocol implementation is
described to understand the strengths and limitations of these
Fig. 1. MQTT Publish-Subscribe Model.[10]
protocols and finally concluded in section IV
194
Electronic copy available at: https://ssrn.com/abstract=3791124
Government College of Engineering Kannur (GCEK)
TABLE I
COMPARISON OF PROTOCOLS : MQTT, AMQP, C OAP & XMPP. [2][11][16]
Quality of Service (QoS)/ Reliability QoS 0, Settle Format,Unsettle Format Confirmable Message Fire- and- forget
QoS 1, QoS 2 Non- confirmable Message
Maximum payload per packet 256 MB Negotiable & undefined 64 KB 10000 bytes
(depends on broker/server) (for block-wise UDP transfer) (Max.stanza size depends )
(on server)
model supports topic-based messaging. The protocol supports C. Constrained Application Protocol (CoAP)
2 messaging modes, browse mode, and consume mode. The
client looks up for the stored message in a queue specified for The IEFT CORE working group published CoAP as
the client in the browse mode whereas in the consume mode, RFC752[15]. This protocol is mainly designed for resource-
the message is deleted from the queue after the consumption constrained networks and devices as a web transfer proto-
of the message by the client. The message distribution model col[2]. The application of CoAP is there in e-Health systems,
of AMQP is shown in Fig 2. The model comprises of three smart lighting systems and smart home environments etc,. In
components that are exchange, binding, and queues. AMQP 2017 Markel Iglesias- Urkia and et al. implemented CoAP for
provides the exchange and delivery of a message on multiple the industrial internet of things [14]. CoAP uses the concept
levels. The routing agent receives the messages and redirected of URI and internet media types of the web for their request-
them internally to the queues together with a routing key. response interaction. The transfer protocol of CoAP is UDP
The routing agent represents exchange and it resides in a and the security is over DTLS. The support for discovering
broker’s server. For the exchange of the message, a definite services and resources are provided by CoAP. The HTTP’s
matching criterion and the corresponding algorithm is needed. request verbs such as GET, POST, PUT, and DELETE are
The message queue is actually a FIFO buffer, which is used to used by CoAP because it works similar to HTTP[2]. The
store the message temporarily for an application. The bindings response code and the content format of HTTP are also used
transfer the message exchange and queue depending on the by CoAP but there is an additional one in the case of CoAP
type of exchange. There are 4 main types of exchange for the when it comes to content format. The port 5683 and 5684 of
message that is direct, topic, fan-out, and header CoAP are used as the default port and secure port respectively.
The format of CoAP URI is coap://host[:port]/[path][?query]
1) Direct exchange type: In direct exchange type, the mes- [14]. The path of this URI is used by the user to access the
sage is redirected to queue, based on the routing key associated resource available for them and also for sending queries to
with that message. If the message routing key matches to the the server. The message structure of the CoAP is shown in
binding key of the queue then transfer occurs. Fig 3. The message has a fixed length header of 4 byte and
2) Topic exchange type: Similar to MQTT, the transfer is a variable sized part. The version of CoAP specification is
based on the topic (routing pattern). The publisher redirected defined in the first 2 header bit and the last 2 bit is received
the message to the queue together with a routing key. But the for the message type. The UDP does not assure the guarantee
successful transfer of message occurs only when the routing of message delivery so, CoAP implements it through two of its
key matches to the routing pattern resides in the queue. message type that is confirmable, non-confirmable in a higher
stack level. The acknowledgments are conveyed through other
3) Fan out exchange type: Fan out exchange broadcasts 2 types of messages that may hold resets and piggybacked
messages to all subscribes unconditionally to the queue, it does data. The length of the token is defined by the rest of the
not need a routing key for binding the message. first byte. The message code and the 2 remaining bytes in the
4) Header exchange type: The message transferred in the next header byte contain message ID. The different sections of
header exchange type is mainly based on the header property variable sized part are a long token of 0-8 byte which contain
matching. It is similar to the HTTP request-response paradigm. variable number of options and a payload. Although DTLS
195
Electronic copy available at: https://ssrn.com/abstract=3791124
Government College of Engineering Kannur (GCEK)
secures the message, the routing information is not secured.
Denial of Service (DoS) attacks, resource consumption and
other similar concerns that are related to TCP/IP stack are out
of the scope of this section.
196
Electronic copy available at: https://ssrn.com/abstract=3791124
Government College of Engineering Kannur (GCEK)
protocol is more secure[11]. The XMPP protocol offers a IV. C ONCLUSION
robust authentication using a token which is also based on The messaging protocols ensure better connectivity between
SASL. When comparing the protocols MQTT, AMQP, CoAP, IoT devices. The robustness and vulnerability of each protocol
and XMPP the XMPP is more secure due to the extension that have an increasingly important part in deciding a desirable
provides called authorization token[2]. The AMQP security protocol for IoT systems. In this paper, we have presented
which comes after the XMPP is moderately secure whereas a comparison of four application layer messaging protocols
the MQTT, CoAP ensure low security[2]. (MQTT, AMQP, CoAP, and XMPP) for IoT applications.
We have compared the protocols based on payload support,
C. Power consumption security, QoS, power consumption, transmission latency, and
protocol implementation to understand its strengths and lim-
Among these protocols, the AMQP consumes more power.
itations. Each protocol has its advantages which make them
It is followed by CoAP then MQTT. MQTT is the protocol
suitable for certain embedded applications. For example, In
that consumes less power and suitable for energy-constrained
a multi-sensor IoT environment, MQTT performs better in
IoT environments[11]. For high payloads and small payloads,
transmission latency, QoS and also consumes less power. So,
MQTT consumes less power than other protocols. The power
for a power-constrained IoT environment, MQTT is a better
consumption of HTTP is 5.3 times more than that of MQTT
solution. This paper will help users and embedded developers
and 2.8 times of CoAP[19]. Some works [19] also reveal that
to pick an acceptable protocol for their embedded applications.
CoAP had 1.9 times more power consumption than MQTT.
ACKNOWLEDGEMENT
D. Payload support This work was supported by Rural Technology Development
Centre (RTDC) GCE Kannur
The human-understandable payload is needed for human-
centric communication. The JSON format is the best choice in R EFERENCES
the case of a machine to machine communication[17]. Among [1] V. Gazis, M. Gortz, M. Huber, A. Leonardi, K. Mathioudakis, A.
these protocols, MQTT can be used when a user or designer Wiesmaier, F. Zeiger, and E. Vasilomanolakis, “A survey of technologies
need to control over their data format. for the internet of things,” in 2015 IEEE International Wireless Commu-
nications and Mobile Computing Conference, 2015, pp. 1090–1095.
[2] E. Al-Masri et al., ”Investigating Messaging Protocols for the Internet
E. Transmission latency of Things (IoT),” in IEEE Access, vol. 8, pp. 94880-94911, 2020, doi:
10.1109/ACCESS.2020.2993363.
The transmission latency mainly depends upon the trans- [3] International Organization for Standardization (ISO), Open Sys-
tems Interconnection (OSI) Standard (35.100). [Online]. Available:
mission protocol. The MQTT, AMQP and XMPP use TCP https://www.iso.org/ics/35.100/x, Accessed on: April 18, 2020
protocol for the data transmission. The TCP has a slow [4] N. Naik, P. Jenkins, P. Davies, and D. Newell, “Native web communi-
start approach because for the first few roundtrips of the cation protocols and their effects on the performance of web services
and systems,” in 16th IEEE International Conference on Computer and
connection and it does not utilize the available bandwidth Information Technology (CIT). IEEE, 2016, pp. 219–225.
requirements[11]. In UDP transmission, it uses 2 UDP data- [5] N. Naik and P. Jenkins, “Web protocols and challenges of web latency in
grams, one for the request and another for the response. This the web of things,” in 2016 Eighth International Conference on Ubiquitous
and Future Networks (ICUFN). IEEE, 2016, pp. 845–850.
helps to improve the latency of CoAP[11]. The latency of [6] N. De Caro, W. Colitti, K. Steenhaut, G. Mangino, and G. Reali,
CoAP is also improved due to its small packet size and “Comparison of two lightweight protocols for smartphone-based sensing,”
absence of a keep-alive message. However, for a multi-sensor in Communications and Vehicular Technology in the Benelux (SCVT),
2013 IEEE 20th Symposium on. IEEE, 2013, pp. 1–6.
IoT system which receives same commands from a broker [7] A. Foster, “Messaging technologies for the industrial internet and the
or server, the MQTT performs better than CoAP because it internet of things whitepaper,” PrismTech, 2015.
forwards messages automatically to all subscribers at the same [8] H. Wang, D. Xiong, P. Wang and Y. Liu, ”A Lightweight XMPP
Publish/Subscribe Scheme for Resource-Constrained IoT Devices,”
time[18]. The AMQP has moderately higher latency due to the in IEEE Access, vol. 5, pp. 16393-16405, 2017, doi: 10.1109/AC-
extra services that providing to an IoT system[11]. CESS.2017.2742020.
[9] J. L. Fernandes, I. C. Lopes, J. J. P. C. Rodrigues and S. Ul-
lah, ”Performance evaluation of RESTful web services and AMQP
F. Protocol implementation protocol,” 2013 Fifth International Conference on Ubiquitous and
Future Networks (ICUFN), Da Nang, 2013, pp. 810-815, doi:
The protocols discussed in this paper share some common 10.1109/ICUFN.2013.6614932.
features which make them apt for various types of communi- [10] N. Q. Uy and V. H. Nam, ”A comparison of AMQP and MQTT protocols
for Internet of Things,” 2019 6th NAFOSTED Conference on Information
cations but they may differ in some functionality they support. and Computer Science (NICS), Hanoi, Vietnam, 2019, pp. 292-297, doi:
Some protocols are still evolving but some are widely used in 10.1109/NICS48868.2019.9023812.
various platforms and organizations. For the implementation [11] N. Naik, ”Choice of effective messaging protocols for IoT systems:
MQTT, CoAP, AMQP and HTTP,” 2017 IEEE International Systems
of the protocols, various languages such as java, javascript, Engineering Symposium (ISSE), Vienna, 2017, pp. 1-7, doi: 10.1109/Sy-
C, python, etc. are used. The implementation size of the sEng.2017.8088251.
protocols mainly depends on the language that is used for [12] Hwang, H.C., Park, J. and Shon, J.G.”Design and Implemen-
tation of a Reliable Message Transmission System Based on
implementation although it depends on the protocol used for MQTT Protocol in IoT”.Wireless Pers Commun 91, 1765–1777
the implementation. (2016).https://doi.org/10.1007/s11277-016-3398-2
197
Electronic copy available at: https://ssrn.com/abstract=3791124
Government College of Engineering Kannur (GCEK)
[13] G. Caiza, E. S. Llamuca, C. A. Garcia, F. Gallardo-Cardenas, D. Lanas
and M. V. Garcia, ”Industrial Shop-Floor Integration Based on AMQP
protocol in an IoT Environment,” 2019 IEEE Fourth Ecuador Technical
Chapters Meeting (ETCM), Guayaquil, Ecuador, 2019, pp. 1-6, doi:
10.1109/ETCM48019.2019.9014858.
[14] Iglesias-Urkia, M., Orive, A., Urbieta, A. et al.”Analysis of CoAP imple-
mentations for industrial Internet of Things: a survey”.J Ambient Intell
Human Comput 10, 2505–2518 (2019). https://doi.org/10.1007/s12652-
018-0729-z
[15] Shelby Z, Hartke K, Bormann C (2014) ”The constrained application
protocol (CoAP)”. https ://tools .ietf.org/html/rfc72 52. Accessed 17 Jan
2018
[16] T. Sultana and K. A. Wahid, ”Choice of Application Layer Protocols
for Next Generation Video Surveillance Using Internet of Video Things,”
in IEEE Access, vol. 7, pp. 41607-41624, 2019, doi: 10.1109/AC-
CESS.2019.2907525.
[17] S. R. U. Kakakhel, T. Westerlund, M. Daneshtalab, Z. Zou, J. Plosila
and H. Tenhunen, ”A Qualitative Comparison Model for Application
Layer IoT Protocols,” 2019 Fourth International Conference on Fog and
Mobile Edge Computing (FMEC), Rome, Italy, 2019, pp. 210-215, doi:
10.1109/FMEC.2019.8795324.
[18] H. W. van der Westhuizen and G. P. Hancke, ”Practical Com-
parison between COAP and MQTT - Sensor to Server level,”
2018 Wireless Advanced (WiAd), London, 2018, pp. 1-6, doi:
10.1109/WIAD.2018.8588443.
[19] J. Joshi, V. Rajapriya, S. Rahul, P. Kumar, S. Polepally, R. Samineni and
D. Tej, ”Performance enhancement and IoT based Monitoring for Smart
Home,” In 2017 International Conference on Information Networking
(ICOIN), pp. 468–473, 2017.
198
Electronic copy available at: https://ssrn.com/abstract=3791124
Government College of Engineering Kannur (GCEK)