SlideShare a Scribd company logo
1 of 40
Lightweight Messaging
for a Connected Planet
                Andy Piper
  WebSphere Messaging Community Lead, IBM
What's this all
   about?
The Internet of Things

Trillions of smart
devices instrument
our world today




                            Interconnecting these
                            smart devices creates
                            a Central Nervous
                            System
Building a Smarter Planet




  +       +       =
The Networked Enterprise
                                             Connectivity for Applications
                                                                                                               Head Offices,
                                             Transport         WebSphere MQ                                     Data centres
                                                               REST/HTTP             Intelligent              Cloud Computing
                                                               WS*


                                                                                                      Mission-Critical Connectivity & Intelligence

                                                                                                      Messages       WebSphere MQ
                      Regional Offices
                       Stores, Outlets                                                                Files          WebSphere MQ File Transfer Edition
                                                                              Interconnected
                                                                                                      Transform,     WebSphere Message Broker
                                                                                                      Enrich,        WebSphere ESB
                                                                                                      Mediate        DataPower
                                                                                                                     WebSphere Sensor Events


                                                                                                      Catalog        WebSphere Service Registry & Repository

                                                                                                      Intelligence   WebSphere Business Events
                                  Instrumented                Remote Systems and Devices                             Cognos. ILOG, SPSS
                                                                                                                     InfoSphere Streams
Connectivity for Smart Devices                                                                                       Other InfoSphere and Tivoli products

Transport   MQ Telemetry
            HTTP
            Multicast                                                                                   Actuators
                      Embedded Controllers                         Sensors
                                                                   Power meters, weather data           Tag printers, status lights, Load
Millions of           Filtering of duplicate read events, Store-
                      based HVAC & lighting controls,              SCADA sensors, pressure, volume,     generation, HVAC and lighting,
                                                                   RFID readers, Motion detectors…      Valves, switches and pumps…
devices               Industrial Network Gateways (SCADA)
MQTT =
MQ Telemetry
 Transport
Design principles
■   Publish/subscribe messaging paradigm
    (useful for the majority of sensor
    applications)
■   Minimise the on-the-wire footprint.
■   Expect and cater for frequent network
    disruption – built for low bandwidth, high
    latency, unreliable, high cost networks
■   Expect that client applications may have
    very limited processing resources available.
■   Provide traditional messaging qualities of
    service where the environment allows.
■   Publish the protocol royalty-free, for ease
    of adoption by device vendors and third-
    party software developers.
Key facts
■   Low complexity and footprint
■   Simple publish/subscribe messaging semantics
        
             Asynchronous (“push”) delivery of messages to applications
        
             Simple verbs: connect, publish, (un)subscribe, disconnect

    Minimised on-the-wire format
        
             Plain byte array message payload
        
             No application message headers
        
             Protocol compressed into bit-wise headers and variable
             length fields
        
             Smallest possible packet size is 2 bytes
■   In-built constructs to support loss of contact between client and
    server
        
             “Last will and testament” to publish a message if the client
             goes offline
        
             Stateful “roll-forward” semantics and “durable” subscriptions
What about
that HTTP thing?
Good point.
Here's a (very) quick
    comparison.
Data-centricity


MQTT is agnostic of data content and transfers
simple byte arrays, making drip-feeds of
updating information trivial.

HTTP is (basically) document-centric.
Simplicity


MQTT has few methods
(publish/subscribe/unsubscribe) and is quick to
learn.

HTTP can be complex (although it is often well-
understood) - there are a multitude of return
codes and methods. 
REST is a great principle but not always the best
for simple data applications
(POST/PUT/GET/DELETE? er what?)
Light on the network


The smallest possible packet size for an MQTT
message is 2 bytes. 
The protocol was optimised from the start for
unreliable, low-bandwidth, expensive, high-
latency networks.

HTTP is relatively verbose - lots of "chatter" in a
POST
Easy distribution of data


MQTT distributes 1-to-none, 1-to-1 or 1-to-n
via the publish/subscribe mechanism
→ very efficient

HTTP is point-to-point (can be
mediated/clustered but no distribution
mechanism). To distribute to multiple receivers a
large number of POSTs may be required.
Lightweight Stack (CPU/Mem)


MQTT has been trivially implemented on tiny to
larger platforms in very small libraries
[IBM ref implementation = ~80Kb for full broker]

HTTP (often with associated XML or JSON
libraries for SOAP and REST etc) can be relatively
large on top of OS network libraries
Plus... even if the client is small, consider
whether it is really necessary to run an HTTP
server on every device
Variable Quality-of-Service


MQTT supports fire-and-forget or fire-and-
confirm (aka QoS 0/1/2)

HTTP has no retry / confirmation / attempt at
once-only delivery. It is basically brittle, i.e. retry
needs to be written in at the application level.
Applications must also handle timeouts.
Sounds like there's a
   place for both!
  Where is MQTT in
        use?
•
  Simple
•
  Lightweight (CPU,Mem,**Net)
•
  Data-centric
•
  Distributes data (pub/sub)
•
  Range of QoS
  → strong developer community
“strong developer
 community” huh...
Ok, to be fair, I have
no knowledge of their
physical strength, but
they are all awesome...
Home automation




              http://chris.yeoh.info/?p=188
Gardening




                                                                 “It all started with the seemingly
                                                                simple question – “How can I water
                                                                  the garden without leaving my
                                                                 laptop/phone/sofa using tech?””
                                                                               - Dan Fish




http://www.ossmedicine.org/home_automation/arduino/12/watering-the-garden-oss-style-a-year-with-some-open-hardware/
TV, Android, burglar “control”




                    http://www.hardill.me.uk/wordpress/?p=204
Mind-controlled Taxis




 b

                       “Kevin already had the headset
                     hooked up to MQTT, so it would be
                       trivial to use my Arduino MQTT
                       library to get them all talking.”
                                 - Nick O'Leary


       http://knolleary.net/2010/04/22/how-i-got-onto-prime-time-bbc-one/
Flashing Arduino-controlled ducks
                                “Now, you may wonder why I
                              would want 20 rubber ducks to
                             flash when my phone goes off....
                             There is no scientific or technical
                             reason in itself. I just had a Mini
                              Cooper’s worth of rubber ducks
                               sitting around, unemployed.”
                                       - Chris Phillips




              http://eightbar.co.uk/2009/03/12/the-amazing-mqtt-enabled-ducks/
This sounds
     moderately
interesting (and fun)
    Lemme at it!
Seriously.
We've been waiting
  for 25 slides
     already.
 CODE, DAMMIT
The IBM way
•
    http://www.alphaworks.ibm.com/tech/rsmb
•
    Download rsmb-1.2.0.zip
•
    Unzip
•
    Run nohup ./broker >> /dev/null &
•
    Play with C client utils, code, and be merry!


•
    Available for Linux IA32, IA64 kernel 2.6.8+; Linux on IBM System z;
      Linux for ARM XScale, kernel 2.0.0+ (Crossbow Stargate or Eurotech
      Viper); Windows XP; Mac OS X Leopard; Unslung (Linksys NSLU2) –
      Binary only, request other platforms from IBM
Alternatively...
•
    http://mosquitto.org
•
    On e.g. Ubuntu:
    sudo add-apt-repository ppa:mosquitto-dev/mosquitto-
      ppa && sudo apt-get update && sudo apt-get install
      mosquitto
    (optional: mosquitto-pub, mosquitto-sub, python-
      mosquitto)
•
    Runs as a daemon; IPv4/IPv6-capable
•
    C++ and Python examples available

•
    Packaged for Ubuntu, Fedora, RHEL, OpenSuSE, CentOS, Debian,
       Mandriva; Windows - binary; OS X – binary (homebrew compile via
       github package); source tarball; dev version in bitbucket
Client APIs
•
    C
•
    C++
•
    Java (your route to Android and Kindle goodness)
•
    .NET (yes, Mono too...)
•
    Delphi
                                     •
                                         Perl

•
    Python
                                     •
                                         PHP
                                     •
                                         Ruby
                                     •
                                         Erlang
                                     •
                                         Arduino
                                     •
                                         mbed
Show us the code!

public void sendAMessage() throws MqttException {
       MqttProperties mqttProps = new MqttProperties();     Create a connection using the
       mqttProps.setCleanStart( true );                     connection factory, this time
       MqttClient client = MqttClientFactory. INSTANCE.     for a clean starting client
               createMqttClient("testClient",
               “tcp://localhost:1883”, mqttProps);
                                                           Register the class as a listener and
       client.registerCallback(this);
                                                           connect to the broker
       client.connect();
       client.publish(“abc/123”, new MqttPayload((“Hello World!”).getBytes(),0),
               (byte) 2, false);
       client.disconnect();                                   Publish a message to the
}                                                             given topic and disconnect

public void publishArrived (String topicName,
                        MqttPayload payload,
                        byte qos, boolean retained, int msgId) {
       System.out.println(“Got it!”);
}                                                          On receipt of a publication,
                                                                   simply print out a message on
                                                                   the console to say we received it
Moar code plz
#!/usr/bin/python
import pynotify
import mosquitto                                 Setup a callback – post a
# define what happens after connection           desktop notification with
                                                 message topic and payload
def on_connect(rc):                              when a publication arrives
        print "Connected"
# On receipt of a message create a pynotification and show it
def on_message(msg):
        n = pynotify.Notification (msg.topic, msg.payload)
        n.show ()
# create a client connection
mqttc = mosquitto.Mosquitto("python_sub")
# define the callbacks
mqttc.on_message = on_message
mqttc.on_connect = on_connect                    Set a client id (“python_sub”),
                                                 connect to localhost, and
# connect                                        subscribe on topic “test”
mqttc.connect("localhost", 1883, 60, True)
# subscribe to topic test
mqttc.subscribe("test", 2)
# keep connected to broker
while mqttc.loop() == 0:
        pass

                            http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/
Community
•
    http://mqtt.org (including wiki)
•
    rsmb forum at IBM alphaWorks
•
    #mqtt on freenode
•
    mosquitto project on launchpad


•
    http://homecamp.org.uk
•
    many bloggers, developers, etc...
More random-but-cool schtuffs
•
    File sync over MQTT?
      http://mquin.livejournal.com/177855.html

•
    Desktop notifications
      http://ceit.uq.edu.au/content/mqtt-and-growl and
      http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/

•
    Web thermometers
      http://chemicaloliver.net/internet/mqtt-and-websocket-thermometer-using-the-html5-meter-tag/

•
    Digital-to-analogue readouts
      http://chemicaloliver.net/arduino/mqtt-and-ammeters/

•
    CEIT @ UQ research projects
      http://ceit.uq.edu.au/content/messaging-protocol-applications

•
    LEGO microscope control
      http://eprints.soton.ac.uk/45432/
Elsewhere in the
world, exciting things
  were occurring...
Integrating to the Enterprise
WebSphere MQ Telemetry
                                                                   Sensors

                                                 DIRECT
                                                 MQTT CLIENT
     WebSphere                                                               Mobile, smart
                                                                             meters
      MQ 7.0.1
                    MQXR                                           Applications



                                          BRIDGE
Rich clients                                                    MQTT
                         BRIDGE
requiring buffering,                                      WebSphere MQ Telemetry
remote management                                           Daemon for Devices   DIRECT
capabilities, or                                                                   MQTT CLIENT
                               Microbroker
advanced data handling       (Lotus Expeditor,
                               WebSphere
                              Sensor Events)
Smarter Healthcare
Medical organization created a remote pace-maker monitoring
solution to provide better patient care

                                       Client Pains
                                        Physicians needed better monitoring
                                         of cardiac patients
                                        Improve efficiency of checkups
                                        Meet healthcare data capture
                                         standards



          Enables higher level of patient care and peace of mind
           Improves administrative efficiency and maintenance
         Helps conform to standards and ease integration of data
Smarter Energy
Utility company developing an Intelligent Utility Network offering for
optimizing load on electricity grids

                                       Business Partner
                                        Needs robust middleware
                                         technology to connect to remote
                                         smart meters
                                        Needs to be able to rapidly scale
                                         solution nationally



               Able to offer daily energy savings of 15-20%
        Enables utilities to reduce peaks and avoid punitive charges
        Helps save electricity through better peak load management
KTHXBAI!
     Andy Piper
     @andypiper
http://andypiper.co.uk
Thanks!!
•
    Roger Light @ralight (mosquitto awesomeness)
•
    Nick O'Leary @knolleary (Arduino/MQTT awesomeness –
      images from Flickr – and general uber-awesomeness)
•
    Chris Yeoh @ckbyeoh (home hacking awesomeness)
•
    Benjamin Hardill @hardillb (TV hacking awesomeness)
•
    Chris Phillips @cminion (Rubber Duck awesomeness)
•
    Oliver Smith @chemicaloliver (lots of webby awesomeness)
•
    Dan Fish @ossmedicine (garden awesomeness)
•
    Donna Benjamin @kattekrab (Inkscape awesomeness)

More Related Content

Viewers also liked

The Internet of Military Things: There Will Be Cyberwar
The Internet of Military Things: There Will Be CyberwarThe Internet of Military Things: There Will Be Cyberwar
The Internet of Military Things: There Will Be CyberwarRichard Stiennon
 
презентация по очередям
презентация по очередямпрезентация по очередям
презентация по очередямCyrill Abramov
 
Анатомия Интернета вещей
Анатомия Интернета вещейАнатомия Интернета вещей
Анатомия Интернета вещейTibbo
 
Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...
Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...
Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...Ontico
 
Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...
Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...
Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...Ontico
 
NoSQL - коротко о главном / Сергей Туленцев (TextMaster)
NoSQL - коротко о главном / Сергей Туленцев (TextMaster)NoSQL - коротко о главном / Сергей Туленцев (TextMaster)
NoSQL - коротко о главном / Сергей Туленцев (TextMaster)Ontico
 
MQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsMQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsBryan Boyd
 
101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...
101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...
101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...Ontico
 
Интернет всех вещей: когда ложки и носки будут в сети и зачем это нужно
Интернет всех вещей: когда ложки и носки будут в сети и зачем это нужноИнтернет всех вещей: когда ложки и носки будут в сети и зачем это нужно
Интернет всех вещей: когда ложки и носки будут в сети и зачем это нужноSergei Silnov
 

Viewers also liked (9)

The Internet of Military Things: There Will Be Cyberwar
The Internet of Military Things: There Will Be CyberwarThe Internet of Military Things: There Will Be Cyberwar
The Internet of Military Things: There Will Be Cyberwar
 
презентация по очередям
презентация по очередямпрезентация по очередям
презентация по очередям
 
Анатомия Интернета вещей
Анатомия Интернета вещейАнатомия Интернета вещей
Анатомия Интернета вещей
 
Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...
Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...
Как мы сделали ровную балансировку нагрузки на фронтенд-кластере / Насретдино...
 
Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...
Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...
Производительность запросов в PostgreSQL - шаг за шагом / Илья Космодемьянски...
 
NoSQL - коротко о главном / Сергей Туленцев (TextMaster)
NoSQL - коротко о главном / Сергей Туленцев (TextMaster)NoSQL - коротко о главном / Сергей Туленцев (TextMaster)
NoSQL - коротко о главном / Сергей Туленцев (TextMaster)
 
MQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsMQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of Things
 
101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...
101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...
101 способ приготовления RabbitMQ и немного о pipeline архитектуре / Филонов ...
 
Интернет всех вещей: когда ложки и носки будут в сети и зачем это нужно
Интернет всех вещей: когда ложки и носки будут в сети и зачем это нужноИнтернет всех вещей: когда ложки и носки будут в сети и зачем это нужно
Интернет всех вещей: когда ложки и носки будут в сети и зачем это нужно
 

More from Andy Piper

Adapt & Survive
Adapt & SurviveAdapt & Survive
Adapt & SurviveAndy Piper
 
Rebooting A Community #DevRelCon
Rebooting A Community #DevRelConRebooting A Community #DevRelCon
Rebooting A Community #DevRelConAndy Piper
 
Twitter APIs for #MediaHackday
Twitter APIs for #MediaHackdayTwitter APIs for #MediaHackday
Twitter APIs for #MediaHackdayAndy Piper
 
Imagining the Future, when the Future is already Now
Imagining the Future, when the Future is already NowImagining the Future, when the Future is already Now
Imagining the Future, when the Future is already NowAndy Piper
 
Connecting to the Pulse of the Planet with the Twitter Platform
Connecting to the Pulse of the Planet with the Twitter PlatformConnecting to the Pulse of the Planet with the Twitter Platform
Connecting to the Pulse of the Planet with the Twitter PlatformAndy Piper
 
Building Twitter's SDKs for Android
Building Twitter's SDKs for AndroidBuilding Twitter's SDKs for Android
Building Twitter's SDKs for AndroidAndy Piper
 
Developer Advocacy - A Life Less Ordinary
Developer Advocacy - A Life Less OrdinaryDeveloper Advocacy - A Life Less Ordinary
Developer Advocacy - A Life Less OrdinaryAndy Piper
 
Twitter in the Internet of Things
Twitter in the Internet of ThingsTwitter in the Internet of Things
Twitter in the Internet of ThingsAndy Piper
 
Twitter APIs - the starter guide
Twitter APIs - the starter guideTwitter APIs - the starter guide
Twitter APIs - the starter guideAndy Piper
 
Connecting to the pulse of the planet with Twitter APIs
Connecting to the pulse of the planet with Twitter APIsConnecting to the pulse of the planet with Twitter APIs
Connecting to the pulse of the planet with Twitter APIsAndy Piper
 
Internet ALL the Things - a walking tour of MQTT
Internet ALL the Things - a walking tour of MQTTInternet ALL the Things - a walking tour of MQTT
Internet ALL the Things - a walking tour of MQTTAndy Piper
 
Combining Context with Signals in the IoT (longer version)
Combining Context with Signals in the IoT (longer version)Combining Context with Signals in the IoT (longer version)
Combining Context with Signals in the IoT (longer version)Andy Piper
 
Why the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open SourceWhy the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open SourceAndy Piper
 
Combining Context with Signals in the Internet of Things
Combining Context with Signals in the Internet of ThingsCombining Context with Signals in the Internet of Things
Combining Context with Signals in the Internet of ThingsAndy Piper
 
MQTT - standards-based plumbing for the Internet of Things
MQTT - standards-based plumbing for the Internet of ThingsMQTT - standards-based plumbing for the Internet of Things
MQTT - standards-based plumbing for the Internet of ThingsAndy Piper
 
My Quantified Self and the promise of wearables
My Quantified Self and the promise of wearablesMy Quantified Self and the promise of wearables
My Quantified Self and the promise of wearablesAndy Piper
 
Why Data, Code and Mobile converge in the Open Cloud
Why Data, Code and Mobile converge in the Open CloudWhy Data, Code and Mobile converge in the Open Cloud
Why Data, Code and Mobile converge in the Open CloudAndy Piper
 
From Cloud Computing to Platform as a Service – BCS Oxfordshire
From Cloud Computing to Platform as a Service – BCS OxfordshireFrom Cloud Computing to Platform as a Service – BCS Oxfordshire
From Cloud Computing to Platform as a Service – BCS OxfordshireAndy Piper
 
Why Apps, Data and Mobile Converge in the Open Cloud
Why Apps, Data and Mobile Converge in the Open CloudWhy Apps, Data and Mobile Converge in the Open Cloud
Why Apps, Data and Mobile Converge in the Open CloudAndy Piper
 
The Internet of Things is Made of Signals
The Internet of Things is Made of SignalsThe Internet of Things is Made of Signals
The Internet of Things is Made of SignalsAndy Piper
 

More from Andy Piper (20)

Adapt & Survive
Adapt & SurviveAdapt & Survive
Adapt & Survive
 
Rebooting A Community #DevRelCon
Rebooting A Community #DevRelConRebooting A Community #DevRelCon
Rebooting A Community #DevRelCon
 
Twitter APIs for #MediaHackday
Twitter APIs for #MediaHackdayTwitter APIs for #MediaHackday
Twitter APIs for #MediaHackday
 
Imagining the Future, when the Future is already Now
Imagining the Future, when the Future is already NowImagining the Future, when the Future is already Now
Imagining the Future, when the Future is already Now
 
Connecting to the Pulse of the Planet with the Twitter Platform
Connecting to the Pulse of the Planet with the Twitter PlatformConnecting to the Pulse of the Planet with the Twitter Platform
Connecting to the Pulse of the Planet with the Twitter Platform
 
Building Twitter's SDKs for Android
Building Twitter's SDKs for AndroidBuilding Twitter's SDKs for Android
Building Twitter's SDKs for Android
 
Developer Advocacy - A Life Less Ordinary
Developer Advocacy - A Life Less OrdinaryDeveloper Advocacy - A Life Less Ordinary
Developer Advocacy - A Life Less Ordinary
 
Twitter in the Internet of Things
Twitter in the Internet of ThingsTwitter in the Internet of Things
Twitter in the Internet of Things
 
Twitter APIs - the starter guide
Twitter APIs - the starter guideTwitter APIs - the starter guide
Twitter APIs - the starter guide
 
Connecting to the pulse of the planet with Twitter APIs
Connecting to the pulse of the planet with Twitter APIsConnecting to the pulse of the planet with Twitter APIs
Connecting to the pulse of the planet with Twitter APIs
 
Internet ALL the Things - a walking tour of MQTT
Internet ALL the Things - a walking tour of MQTTInternet ALL the Things - a walking tour of MQTT
Internet ALL the Things - a walking tour of MQTT
 
Combining Context with Signals in the IoT (longer version)
Combining Context with Signals in the IoT (longer version)Combining Context with Signals in the IoT (longer version)
Combining Context with Signals in the IoT (longer version)
 
Why the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open SourceWhy the Internet of Things will be built on Open Source
Why the Internet of Things will be built on Open Source
 
Combining Context with Signals in the Internet of Things
Combining Context with Signals in the Internet of ThingsCombining Context with Signals in the Internet of Things
Combining Context with Signals in the Internet of Things
 
MQTT - standards-based plumbing for the Internet of Things
MQTT - standards-based plumbing for the Internet of ThingsMQTT - standards-based plumbing for the Internet of Things
MQTT - standards-based plumbing for the Internet of Things
 
My Quantified Self and the promise of wearables
My Quantified Self and the promise of wearablesMy Quantified Self and the promise of wearables
My Quantified Self and the promise of wearables
 
Why Data, Code and Mobile converge in the Open Cloud
Why Data, Code and Mobile converge in the Open CloudWhy Data, Code and Mobile converge in the Open Cloud
Why Data, Code and Mobile converge in the Open Cloud
 
From Cloud Computing to Platform as a Service – BCS Oxfordshire
From Cloud Computing to Platform as a Service – BCS OxfordshireFrom Cloud Computing to Platform as a Service – BCS Oxfordshire
From Cloud Computing to Platform as a Service – BCS Oxfordshire
 
Why Apps, Data and Mobile Converge in the Open Cloud
Why Apps, Data and Mobile Converge in the Open CloudWhy Apps, Data and Mobile Converge in the Open Cloud
Why Apps, Data and Mobile Converge in the Open Cloud
 
The Internet of Things is Made of Signals
The Internet of Things is Made of SignalsThe Internet of Things is Made of Signals
The Internet of Things is Made of Signals
 

Recently uploaded

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Lightweight Messaging for a Connected Planet

  • 1. Lightweight Messaging for a Connected Planet Andy Piper WebSphere Messaging Community Lead, IBM
  • 3. The Internet of Things Trillions of smart devices instrument our world today Interconnecting these smart devices creates a Central Nervous System
  • 4. Building a Smarter Planet + + =
  • 5. The Networked Enterprise Connectivity for Applications Head Offices, Transport WebSphere MQ Data centres REST/HTTP Intelligent Cloud Computing WS* Mission-Critical Connectivity & Intelligence Messages WebSphere MQ Regional Offices Stores, Outlets Files WebSphere MQ File Transfer Edition Interconnected Transform, WebSphere Message Broker Enrich, WebSphere ESB Mediate DataPower WebSphere Sensor Events Catalog WebSphere Service Registry & Repository Intelligence WebSphere Business Events Instrumented Remote Systems and Devices Cognos. ILOG, SPSS InfoSphere Streams Connectivity for Smart Devices Other InfoSphere and Tivoli products Transport MQ Telemetry HTTP Multicast Actuators Embedded Controllers Sensors Power meters, weather data Tag printers, status lights, Load Millions of Filtering of duplicate read events, Store- based HVAC & lighting controls, SCADA sensors, pressure, volume, generation, HVAC and lighting, RFID readers, Motion detectors… Valves, switches and pumps… devices Industrial Network Gateways (SCADA)
  • 7. Design principles ■ Publish/subscribe messaging paradigm (useful for the majority of sensor applications) ■ Minimise the on-the-wire footprint. ■ Expect and cater for frequent network disruption – built for low bandwidth, high latency, unreliable, high cost networks ■ Expect that client applications may have very limited processing resources available. ■ Provide traditional messaging qualities of service where the environment allows. ■ Publish the protocol royalty-free, for ease of adoption by device vendors and third- party software developers.
  • 8. Key facts ■ Low complexity and footprint ■ Simple publish/subscribe messaging semantics  Asynchronous (“push”) delivery of messages to applications  Simple verbs: connect, publish, (un)subscribe, disconnect  Minimised on-the-wire format  Plain byte array message payload  No application message headers  Protocol compressed into bit-wise headers and variable length fields  Smallest possible packet size is 2 bytes ■ In-built constructs to support loss of contact between client and server  “Last will and testament” to publish a message if the client goes offline  Stateful “roll-forward” semantics and “durable” subscriptions
  • 10. Good point. Here's a (very) quick comparison.
  • 11. Data-centricity MQTT is agnostic of data content and transfers simple byte arrays, making drip-feeds of updating information trivial. HTTP is (basically) document-centric.
  • 12. Simplicity MQTT has few methods (publish/subscribe/unsubscribe) and is quick to learn. HTTP can be complex (although it is often well- understood) - there are a multitude of return codes and methods.  REST is a great principle but not always the best for simple data applications (POST/PUT/GET/DELETE? er what?)
  • 13. Light on the network The smallest possible packet size for an MQTT message is 2 bytes.  The protocol was optimised from the start for unreliable, low-bandwidth, expensive, high- latency networks. HTTP is relatively verbose - lots of "chatter" in a POST
  • 14. Easy distribution of data MQTT distributes 1-to-none, 1-to-1 or 1-to-n via the publish/subscribe mechanism → very efficient HTTP is point-to-point (can be mediated/clustered but no distribution mechanism). To distribute to multiple receivers a large number of POSTs may be required.
  • 15. Lightweight Stack (CPU/Mem) MQTT has been trivially implemented on tiny to larger platforms in very small libraries [IBM ref implementation = ~80Kb for full broker] HTTP (often with associated XML or JSON libraries for SOAP and REST etc) can be relatively large on top of OS network libraries Plus... even if the client is small, consider whether it is really necessary to run an HTTP server on every device
  • 16. Variable Quality-of-Service MQTT supports fire-and-forget or fire-and- confirm (aka QoS 0/1/2) HTTP has no retry / confirmation / attempt at once-only delivery. It is basically brittle, i.e. retry needs to be written in at the application level. Applications must also handle timeouts.
  • 17. Sounds like there's a place for both! Where is MQTT in use?
  • 18. • Simple • Lightweight (CPU,Mem,**Net) • Data-centric • Distributes data (pub/sub) • Range of QoS → strong developer community
  • 20. Ok, to be fair, I have no knowledge of their physical strength, but they are all awesome...
  • 21. Home automation http://chris.yeoh.info/?p=188
  • 22. Gardening “It all started with the seemingly simple question – “How can I water the garden without leaving my laptop/phone/sofa using tech?”” - Dan Fish http://www.ossmedicine.org/home_automation/arduino/12/watering-the-garden-oss-style-a-year-with-some-open-hardware/
  • 23. TV, Android, burglar “control” http://www.hardill.me.uk/wordpress/?p=204
  • 24. Mind-controlled Taxis b “Kevin already had the headset hooked up to MQTT, so it would be trivial to use my Arduino MQTT library to get them all talking.” - Nick O'Leary http://knolleary.net/2010/04/22/how-i-got-onto-prime-time-bbc-one/
  • 25. Flashing Arduino-controlled ducks “Now, you may wonder why I would want 20 rubber ducks to flash when my phone goes off.... There is no scientific or technical reason in itself. I just had a Mini Cooper’s worth of rubber ducks sitting around, unemployed.” - Chris Phillips http://eightbar.co.uk/2009/03/12/the-amazing-mqtt-enabled-ducks/
  • 26. This sounds moderately interesting (and fun) Lemme at it!
  • 27. Seriously. We've been waiting for 25 slides already. CODE, DAMMIT
  • 28. The IBM way • http://www.alphaworks.ibm.com/tech/rsmb • Download rsmb-1.2.0.zip • Unzip • Run nohup ./broker >> /dev/null & • Play with C client utils, code, and be merry! • Available for Linux IA32, IA64 kernel 2.6.8+; Linux on IBM System z; Linux for ARM XScale, kernel 2.0.0+ (Crossbow Stargate or Eurotech Viper); Windows XP; Mac OS X Leopard; Unslung (Linksys NSLU2) – Binary only, request other platforms from IBM
  • 29. Alternatively... • http://mosquitto.org • On e.g. Ubuntu: sudo add-apt-repository ppa:mosquitto-dev/mosquitto- ppa && sudo apt-get update && sudo apt-get install mosquitto (optional: mosquitto-pub, mosquitto-sub, python- mosquitto) • Runs as a daemon; IPv4/IPv6-capable • C++ and Python examples available • Packaged for Ubuntu, Fedora, RHEL, OpenSuSE, CentOS, Debian, Mandriva; Windows - binary; OS X – binary (homebrew compile via github package); source tarball; dev version in bitbucket
  • 30. Client APIs • C • C++ • Java (your route to Android and Kindle goodness) • .NET (yes, Mono too...) • Delphi • Perl • Python • PHP • Ruby • Erlang • Arduino • mbed
  • 31. Show us the code! public void sendAMessage() throws MqttException { MqttProperties mqttProps = new MqttProperties(); Create a connection using the mqttProps.setCleanStart( true ); connection factory, this time MqttClient client = MqttClientFactory. INSTANCE. for a clean starting client createMqttClient("testClient", “tcp://localhost:1883”, mqttProps); Register the class as a listener and client.registerCallback(this); connect to the broker client.connect(); client.publish(“abc/123”, new MqttPayload((“Hello World!”).getBytes(),0), (byte) 2, false); client.disconnect(); Publish a message to the } given topic and disconnect public void publishArrived (String topicName, MqttPayload payload, byte qos, boolean retained, int msgId) { System.out.println(“Got it!”); } On receipt of a publication, simply print out a message on the console to say we received it
  • 32. Moar code plz #!/usr/bin/python import pynotify import mosquitto Setup a callback – post a # define what happens after connection desktop notification with message topic and payload def on_connect(rc): when a publication arrives print "Connected" # On receipt of a message create a pynotification and show it def on_message(msg): n = pynotify.Notification (msg.topic, msg.payload) n.show () # create a client connection mqttc = mosquitto.Mosquitto("python_sub") # define the callbacks mqttc.on_message = on_message mqttc.on_connect = on_connect Set a client id (“python_sub”), connect to localhost, and # connect subscribe on topic “test” mqttc.connect("localhost", 1883, 60, True) # subscribe to topic test mqttc.subscribe("test", 2) # keep connected to broker while mqttc.loop() == 0: pass http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/
  • 33. Community • http://mqtt.org (including wiki) • rsmb forum at IBM alphaWorks • #mqtt on freenode • mosquitto project on launchpad • http://homecamp.org.uk • many bloggers, developers, etc...
  • 34. More random-but-cool schtuffs • File sync over MQTT? http://mquin.livejournal.com/177855.html • Desktop notifications http://ceit.uq.edu.au/content/mqtt-and-growl and http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/ • Web thermometers http://chemicaloliver.net/internet/mqtt-and-websocket-thermometer-using-the-html5-meter-tag/ • Digital-to-analogue readouts http://chemicaloliver.net/arduino/mqtt-and-ammeters/ • CEIT @ UQ research projects http://ceit.uq.edu.au/content/messaging-protocol-applications • LEGO microscope control http://eprints.soton.ac.uk/45432/
  • 35. Elsewhere in the world, exciting things were occurring...
  • 36. Integrating to the Enterprise WebSphere MQ Telemetry Sensors DIRECT MQTT CLIENT WebSphere Mobile, smart meters MQ 7.0.1 MQXR Applications BRIDGE Rich clients MQTT BRIDGE requiring buffering, WebSphere MQ Telemetry remote management Daemon for Devices DIRECT capabilities, or MQTT CLIENT Microbroker advanced data handling (Lotus Expeditor, WebSphere Sensor Events)
  • 37. Smarter Healthcare Medical organization created a remote pace-maker monitoring solution to provide better patient care Client Pains  Physicians needed better monitoring of cardiac patients  Improve efficiency of checkups  Meet healthcare data capture standards Enables higher level of patient care and peace of mind Improves administrative efficiency and maintenance Helps conform to standards and ease integration of data
  • 38. Smarter Energy Utility company developing an Intelligent Utility Network offering for optimizing load on electricity grids Business Partner  Needs robust middleware technology to connect to remote smart meters  Needs to be able to rapidly scale solution nationally Able to offer daily energy savings of 15-20% Enables utilities to reduce peaks and avoid punitive charges Helps save electricity through better peak load management
  • 39. KTHXBAI! Andy Piper @andypiper http://andypiper.co.uk
  • 40. Thanks!! • Roger Light @ralight (mosquitto awesomeness) • Nick O'Leary @knolleary (Arduino/MQTT awesomeness – images from Flickr – and general uber-awesomeness) • Chris Yeoh @ckbyeoh (home hacking awesomeness) • Benjamin Hardill @hardillb (TV hacking awesomeness) • Chris Phillips @cminion (Rubber Duck awesomeness) • Oliver Smith @chemicaloliver (lots of webby awesomeness) • Dan Fish @ossmedicine (garden awesomeness) • Donna Benjamin @kattekrab (Inkscape awesomeness)

Editor's Notes

  1. Hello. Thanks for coming all the way to L block I'm Andy Been at IBM nearly 10 years working in integration software Been a Linux user and hacker for longer than that. Really wanted to come here to talk about some of the cool stuff we've been doing
  2. Getting straight into this Fits really nicely with some of the things we've been talking about this week around mobile, and around things like Arduino and automation
  3. If you've seen any IBM adverts recently you may have seen these icons or heard the words “Smarter Planet”. What does that mean? As the world becomes instrumented, interconnected and intelligent, we have the opportunity to think and act in new ways—economically, socially and technically.
  4. Corporate stuff isn't always popular at a conference like this but of course it is worth understanding
  5. Let's talk about one of those protocols at the edge of the network. About 10 years ago one of our Distinguished Engineers, Dr Andy Stanford-Clark, was working with oil companies and industrial automation companies and saw the opportunity for a lightweight protocol for connecting devices
  6. I don't want to ignite any kind of flamewar here, I just want to highlight a couple of the key differences which may make us think about how we get data between devices
  7. For clients requiring better remote operations, buffering, concentrators then there are more topology options. The WMQT Daemon for Devices was formerly Really Small Message Broker available on alphaWorks MQTT is already available in Microbroker (a component of Lotus Expeditor)
  8. Phone by bed monitors pacemaker Dial-up -> MQTT to WMB -> analytics engine Avoid regular clinic visits
  9. Energy co can send small changes and commands to homes over mobile network, minor temp adjustments -> significant savings