by Paolo Patierno
The Internet of Things ... Babel
LinuxDay Napoli 2016
Senior Software Engineer at Red Hat
Messaging & IoT team
@ppatierno
Perché sono cosi forti:
● Proprietary vs Open protocols
● Standard protocol comparison
– Architecture
– Implementation & Weight
– Data transport & Manipulation
– IoT communication patterns
– Security
AgendaAgenda
Perché sono cosi forti:
● Difficult to port applications
– Requires re-coding all applications
● Difficult to integrate
– Application level bridge for translating formats
● Restricted platform support
– Limited to whatever vendor provides
Proprietary protocolsProprietary protocols
Perché sono cosi forti:
● Simple application porting
– Re-coding is no needed
● Simple integration
– Well known messages format
● Broader platform support
– Everyone can implement for a platform
Open (standard) protocolsOpen (standard) protocols
Perché sono cosi forti:IoT “languages” on Babel towerIoT “languages” on Babel tower
CoAP
STOMP
XMPP
MQTT
AMQP
Perché sono cosi forti:StandardizationStandardization
● HTTP
– IETF standard (RFC 2616 is HTTP/1.1)
● CoAP
– IETF standard (RFC 7252)
● MQTT
– 3.1.1 version OASIS and ISO/IEC 20922
● AMQP
– 1.0 version OASIS and ISO/IEC 19464
Perché sono cosi forti:Architecture : HTTP & CoAPArchitecture : HTTP & CoAP
● Client/Server
– Request/response
● HTTP : synchronous
● CoAP : (also) asynchronous
● HTTP is ASCII based
● CoAP is binary based
Client Server
Perché sono cosi forti:Architecture : MQTTArchitecture : MQTT
● Broker centric
– Broker receives subscriptions from clients on topics
– Broker receives messages and forward them
– Clients subscribe/publish on topics
– No flow control
Publisher
Broker
Publisher
Subscriber
Subscriber
Topic
Topic
Subscriber
Perché sono cosi forti:Architecture : AMQP 1.0Architecture : AMQP 1.0
● “Peer to peer” nature
– Generic concepts of containers and nodes
● Containers : clients and brokers
● Nodes : queues, topics/subscriptions or just ... endpoints
– Multiplexing on connection
– Flow control
client
producer
(consumer)
broker
queue
Perché sono cosi forti:Implementation & WeightImplementation & Weight
● HTTP
– Client more complex (ASCII parser)
– More bytes to pay on data transfer
– Connection oriented via TCP
● CoAP
– HTTP-like but binary
– Connection less via UDP
– Client more simple than HTTP
Perché sono cosi forti:Implementation & WeightImplementation & Weight
● MQTT
– Client simple to develop (spec about 70 pages)
– Constrained devices (smallest packet 2 bytes)
– Connection oriented via TCP
● AMQP
– Client more complex
– Full featured
– Connection oriented via TCP + multiplexing
Perché sono cosi forti:Data transport & ManipulationData transport & Manipulation
● HTTP & CoAP
– Content-Type based on MIME
● MQTT
– Payload agnostic
● No data types
● No metadata
● Any data format (text, binary, JSON, XML, ...)
– Peers must agree on serialization/deserialization
Perché sono cosi forti:Data transport & ManipulationData transport & Manipulation
● AMQP
– Message
● Header : system and custom/user properties
● Body : opaque
– Metadata
– Data Type System
– Peers can use Content-Type and Content-Encoding
– Filter on properties
Perché sono cosi forti:IoT Communication PatternsIoT Communication Patterns
Telemetry
Information flows
from device to other
systems for
conveying status
changes in the
device
Inquiries
Requests from
devices looking to
gather required
information or
asking to initiate
activities
Commands
Commands from
other systems to a
device or a group of
devices to perform
specific activities
Notifications
Information flows
from other systems to
a device or a group
for conveying status
changes in the world
1:N 1:N
Perché sono cosi forti:IoT Communication PatternsIoT Communication Patterns
● Publish/Subscribe
– Telemetry
– Notification
● Request/Reply
– Command
– Inquiry
Perché sono cosi forti:IoT patterns : resourcesIoT patterns : resources
● HTTP & CoAP
– REST architecture for CRUD operations on
resources
– URIs + POST, GET, PUT & DELETE method
● CoAP : a device act as “server”
Perché sono cosi forti:IoT patterns : resourcesIoT patterns : resources
● MQTT
– Topic based
– Publish/Subscribe “for free”
– Request/Response needs additional effort (on topic
semantic)
building1
room1
floor1 floor2
room1room2
temp humidity temp humidity
Perché sono cosi forti:IoT patterns : resourcesIoT patterns : resources
● AMQP
– Address based
– Publish/Subscribe & Request/Response “for free”
– Brokered (with “store and forward”)
● Queues : for point to point and request/response
● Topics/Subscriptions : for publish/subscribe
– Routed
● Routing messages between peers
● No “store and forward”
Perché sono cosi forti:SecuritySecurity
● SSL/TLS
– For authentication and encryption
● Payload encryption
● HTTP : basic & digest authentication
● CoAP : Datagram TLS (DTLS)
● AMQP : SASL for authentication
● MQTT : username/password on connection
Perché sono cosi forti:ConclusionsConclusions
● Devices
– How much they are constrained ?
● Network
– How much it is reliable ?
● Message rate
– How many messages per second ? QoS ?
● Processing data
– Do the system need more info on processing ?
Perché sono cosi forti:ConclusionsConclusions
Perché sono cosi forti:ResourcesResources
● MQTT
– Eclipse Paho (clients) : https://www.eclipse.org/paho/
– Eclipse Mosquitto (servers) : https://mosquitto.org/
– Apache ActiveMQ Artemis (brokers) : https://activemq.apache.org/artemis/
● AMQP
– Apache Qpid (clients/brokers) : https://qpid.apache.org/
– Apache ActiveMQ Artemis (brokers) : https://activemq.apache.org/artemis/
● CoAP
– Eclipse Californium : https://eclipse.org/californium/

The Internet of Things ... Babel

  • 1.
    by Paolo Patierno TheInternet of Things ... Babel LinuxDay Napoli 2016 Senior Software Engineer at Red Hat Messaging & IoT team @ppatierno
  • 2.
    Perché sono cosiforti: ● Proprietary vs Open protocols ● Standard protocol comparison – Architecture – Implementation & Weight – Data transport & Manipulation – IoT communication patterns – Security AgendaAgenda
  • 3.
    Perché sono cosiforti: ● Difficult to port applications – Requires re-coding all applications ● Difficult to integrate – Application level bridge for translating formats ● Restricted platform support – Limited to whatever vendor provides Proprietary protocolsProprietary protocols
  • 4.
    Perché sono cosiforti: ● Simple application porting – Re-coding is no needed ● Simple integration – Well known messages format ● Broader platform support – Everyone can implement for a platform Open (standard) protocolsOpen (standard) protocols
  • 5.
    Perché sono cosiforti:IoT “languages” on Babel towerIoT “languages” on Babel tower CoAP STOMP XMPP MQTT AMQP
  • 6.
    Perché sono cosiforti:StandardizationStandardization ● HTTP – IETF standard (RFC 2616 is HTTP/1.1) ● CoAP – IETF standard (RFC 7252) ● MQTT – 3.1.1 version OASIS and ISO/IEC 20922 ● AMQP – 1.0 version OASIS and ISO/IEC 19464
  • 7.
    Perché sono cosiforti:Architecture : HTTP & CoAPArchitecture : HTTP & CoAP ● Client/Server – Request/response ● HTTP : synchronous ● CoAP : (also) asynchronous ● HTTP is ASCII based ● CoAP is binary based Client Server
  • 8.
    Perché sono cosiforti:Architecture : MQTTArchitecture : MQTT ● Broker centric – Broker receives subscriptions from clients on topics – Broker receives messages and forward them – Clients subscribe/publish on topics – No flow control Publisher Broker Publisher Subscriber Subscriber Topic Topic Subscriber
  • 9.
    Perché sono cosiforti:Architecture : AMQP 1.0Architecture : AMQP 1.0 ● “Peer to peer” nature – Generic concepts of containers and nodes ● Containers : clients and brokers ● Nodes : queues, topics/subscriptions or just ... endpoints – Multiplexing on connection – Flow control client producer (consumer) broker queue
  • 10.
    Perché sono cosiforti:Implementation & WeightImplementation & Weight ● HTTP – Client more complex (ASCII parser) – More bytes to pay on data transfer – Connection oriented via TCP ● CoAP – HTTP-like but binary – Connection less via UDP – Client more simple than HTTP
  • 11.
    Perché sono cosiforti:Implementation & WeightImplementation & Weight ● MQTT – Client simple to develop (spec about 70 pages) – Constrained devices (smallest packet 2 bytes) – Connection oriented via TCP ● AMQP – Client more complex – Full featured – Connection oriented via TCP + multiplexing
  • 12.
    Perché sono cosiforti:Data transport & ManipulationData transport & Manipulation ● HTTP & CoAP – Content-Type based on MIME ● MQTT – Payload agnostic ● No data types ● No metadata ● Any data format (text, binary, JSON, XML, ...) – Peers must agree on serialization/deserialization
  • 13.
    Perché sono cosiforti:Data transport & ManipulationData transport & Manipulation ● AMQP – Message ● Header : system and custom/user properties ● Body : opaque – Metadata – Data Type System – Peers can use Content-Type and Content-Encoding – Filter on properties
  • 14.
    Perché sono cosiforti:IoT Communication PatternsIoT Communication Patterns Telemetry Information flows from device to other systems for conveying status changes in the device Inquiries Requests from devices looking to gather required information or asking to initiate activities Commands Commands from other systems to a device or a group of devices to perform specific activities Notifications Information flows from other systems to a device or a group for conveying status changes in the world 1:N 1:N
  • 15.
    Perché sono cosiforti:IoT Communication PatternsIoT Communication Patterns ● Publish/Subscribe – Telemetry – Notification ● Request/Reply – Command – Inquiry
  • 16.
    Perché sono cosiforti:IoT patterns : resourcesIoT patterns : resources ● HTTP & CoAP – REST architecture for CRUD operations on resources – URIs + POST, GET, PUT & DELETE method ● CoAP : a device act as “server”
  • 17.
    Perché sono cosiforti:IoT patterns : resourcesIoT patterns : resources ● MQTT – Topic based – Publish/Subscribe “for free” – Request/Response needs additional effort (on topic semantic) building1 room1 floor1 floor2 room1room2 temp humidity temp humidity
  • 18.
    Perché sono cosiforti:IoT patterns : resourcesIoT patterns : resources ● AMQP – Address based – Publish/Subscribe & Request/Response “for free” – Brokered (with “store and forward”) ● Queues : for point to point and request/response ● Topics/Subscriptions : for publish/subscribe – Routed ● Routing messages between peers ● No “store and forward”
  • 19.
    Perché sono cosiforti:SecuritySecurity ● SSL/TLS – For authentication and encryption ● Payload encryption ● HTTP : basic & digest authentication ● CoAP : Datagram TLS (DTLS) ● AMQP : SASL for authentication ● MQTT : username/password on connection
  • 20.
    Perché sono cosiforti:ConclusionsConclusions ● Devices – How much they are constrained ? ● Network – How much it is reliable ? ● Message rate – How many messages per second ? QoS ? ● Processing data – Do the system need more info on processing ?
  • 21.
    Perché sono cosiforti:ConclusionsConclusions
  • 22.
    Perché sono cosiforti:ResourcesResources ● MQTT – Eclipse Paho (clients) : https://www.eclipse.org/paho/ – Eclipse Mosquitto (servers) : https://mosquitto.org/ – Apache ActiveMQ Artemis (brokers) : https://activemq.apache.org/artemis/ ● AMQP – Apache Qpid (clients/brokers) : https://qpid.apache.org/ – Apache ActiveMQ Artemis (brokers) : https://activemq.apache.org/artemis/ ● CoAP – Eclipse Californium : https://eclipse.org/californium/