DevNation 2015 – Andrea Ceiner – Is your MQTT broker IoT-Ready

so my name is Andrea chain er I work for a company called the eurotech um we are in the machine to machine business in some d├ęcadas and we are red up partners and this gave us the opportunity to be here we will go through these topics today so we would have will see the challenges in an IOT typical business scenario then a quick introduction to MQTT we will see how am q and MQTT work together then we will see for use cases implemented with these technologies in different vertical business markets and finally we will have a conclusion on the open IOT community in eclipse that we are participating with and finally there will be space for current answers okay typical business issues in an IOT scenario before going on I would like to know how many of you already have programmed software in a machine to machine or IOT okay so suppose the remaining eighty percent of you is more experienced in the enterprise of the programming for interpretations okay there are some differences the two words are getting closer one to the other but still there are some differences we will highlight them so a typical IOT or machine-to-machine business scenario you have a sensor to connect a temperature sensor or whatever and you have to write your embedded application I say embedded because it did the sensor must be reached and connected somehow so the physical distance is an issue at the moment so you have to connect the sensor you have to write a business logic very simple that could be a threshold in the temperature and then to do an action to perform an action so not much difficult so far because all you have to do is you have only one type of hardware to to cope with so few hardware functions to learn just one cereal lection suppose or just one protocol to to study and then you have a simple business logic a single type of connectivity to pose over tcp/ip with your application and one single business application to right now then things get more complicated because you did a good job and then on your desk comes more tasks in your backlog and so that means that you have to connect a different kind of sensor and probably this sensor is not any more directly connected to your application but is connected to a microcomputer that we normally called m2m gateways which could be in talking about an open hardware sort of raspberry pi or art we nor beaglebone but there are industrial and rugged computers like the black box in the trains in the cars in buildings in airplanes etc in vending machines so you have to talk or not directly with your sensor but through a microcomputer in the middle and the new sensor that you have to connect doesn’t speak the same protocol suppose is speaking bluetooth flight and the other one is that is a serious problem is a serial protocol so on the bottom on the bottom side of the picture you have the data producers and you know that they are connected with your intermediate computer in different manners with different sensing networks then you might have more than one different kind of device in the intermediate level we are still on the field so we with the with the two first layers of this picture starting bottom bottom up we are still on field that means that we are in this room where we have sensors and we have maybe on the door side a gateway and then we have a gateway on the other side of the floor and another gateway in the next floor and below so we are still on field we are not yet on a server side or on cloud or on on my data center and these gateways in the middle they run different operative systems the application speaking with these sensors are because the thresholds are different that we business logical the embedded business logic might be different one should be supposed to send all data retrieved by the sensor and the other one instead to select the data to send to the cloud not to transmit the temperature in every second button trust me the temperature only when there is a threshold exceeding so complex business logic and then between the cloud and these gateways also the media could be different you could have cellular

communication with the problems of unreliable networks you could have Ethernet you could have a satellite you could have long-range plus internet protocol so different protocols also on that side another factor of complication is the fact that these gateways might be geographically dispersed and your business applications could be not just one because the more you work on e to the mall that let’s say it grows up you have different business applications to analyze data to filter data to feed these data into your ear p applications into your enterprise applications which today are already computerizing the tasks that we do every day in our during our job in our roles in our company like being in charge of the supply chain the accounting or my plant management but now I want to turn these applications into IOT application that means that I need near real-time data coming directly from the sensors into these existing business applications so the picture gets much more complicated I go into this point to point unmanageable situation and the the points where this kind of communications can break down can go down are nearly everywhere you have a point of failure between the sensor and the gateway between the Gateway and the cloud suppose the modem is not working properly in certain certain conditions you could have problems at the broker side which is the one manages the connections maybe when you have millions of connection you start to enter into into troubles and then you could have problems inside the platform as a service because normally these platforms are not simple software they are modular they’re composed by many components like complex event processing big data management web applications security and administration layers so you have a complex platform and things could go wrong also inside the platform and finally you could have problems between the API interfaces and the business applications which are made with different technologies and with a different life cycle so you coping traditionally with the enterprise application you already know these problems they are quite common in the enterprise business they are not so common in the m2m which was closed and now with the I with the opening of the IP and with what is called Internet of Things are open to the integration interoperability with all new kind of applications that until now had nothing to do with the machine to machine while instead now they’re hungry of being fitted by real-time data in this case when you have a big problem the best practice has always been to the couple to break down the big problem is smaller problems so to address one by one so the coupling normalizing standardizing so the first big simplification that you can do is separating the information technologies from the operational technologies do not mix the map we will see how why and then integrate them and then normalize them so this is the standard architecture I would say now in a typical IOT scenario this is not branded by us this best practice he have sensors have gateways you have operational technologies in the cloud and finally have the information technologies and the business applications if we see this picture from another perspective we see that we have on one side the operational technologies on the other side the information technologies inside the operational technologies we have devices sensors we have smart connected devices like the thermometer with the blue ballot which is transmitting by MQTT directly to the cloud the broccoli cloud or we have the famous gateways concentrating and aggregating all the sensors and devices and human machine interfaces in a specific area these kind of computers gateways today can benefit of software-defined gateways we for instance created a framework based on Oct I is a Java framework which is very common in as a best practice in

enterprise software which is was not absolutely common in in the embedded space where C C++ and assembler are still dominating but Java is growing up very rapidly and is the bridge between the enterprise software development and the embedded software development so we for instance created the Java framework but it also is an open source distribution and and and the main purpose of this framework is to have a software definition of the hardware functions and of the embedded application running that gateway that is exactly what happened years ago when we had the virtualization and the software-defined storage software-defined servers and then created the possibility to have the dynamic data centers that today now we call cloud so the cloud infrastructure this is the consequence of virtualization then we have seen the networking function virtualization which changed completely the shape of the market of the networking devices before we had a specific a dog fit for pues devices a rotary switch fire was a firewall and wasn’t able to perform any other kind of function today we have the networking software defined function so that means that in a box i can upload the configuration of a Rooter as well as a way for 50 so that box can play different kind of functions and the same is happening in our visualizing sensors so and this is huge because same sores are nearly everywhere everywhere where informatics did not yet enter now you are sitting on a chair this chair is a chair today but suppose that we want to turn these chairs into people counters and into weigh scales we just have to add a simple sensor very very cheap and powered by battery which will last nine years and we transmit a real time how many people is sitting in that chair and if I am the manufacturer of the chair I want to learn how many people is sitting over there and how long maybe also the way of the people sitting there so you can turn objects into smart objects that’s all about operational technologies but when we have to integrate operational technology with information technologies there are mainly two information that we have to send on both sides on one side we have to transmitted data matrix collected from sensors to the business applications in near real-time on the other side we have to send instructions from the business applications to an engine to a vending machine to devices connected to the cloud so probably you already have heard there are very many protocols not only this one these are well known they are not the only one there is a jungle of protocols fortunately open standards are helping a lot in normalizing also the protocol is standardizing the protocol jungle but just make a summary that I like we have a jungle of protocols in the sensing network we can have wired or wireless sensor networks very short short-range mid-range long range and these are different protocols very immature growing up very rapidly today nearly thirty percent of the networking is halted by these kind of radio protocols or white products which are cost less they do not cost the carrier the communication and the scene and the data over a seaman m2m seem so these are costs less that’s why they’re growing up very rapidly then you have the other kind of protocol from the field to the cloud which is MQTT co-op is emerging that’s another protocol they are still over tcp/ip so here we have internet or things because we have EP as a common protocol Internet Protocol on the other side we don’t have I OT we have just m2m because we don’t even have IP as a protocol and then we have rest api s JMS amqp making the bridge between the operational technologies and information technologies particularly and web sockets of course for real-time communication and then HTTP dominates the web of the space of enterprise applications web based so just to give some keywords that qualify operational technologies versus information technologies in the operational technologies we are in the space of real time we are in the space of low power

low footprint few messages per connection so millions of connections but few messages this is the typical case of a sensor that for 24 hours and 59 minutes and 59 seconds and is in profound sleep deep sleep as a stage it’s a real state of a device deep sleep he will wake up a millisec on the transmit few kilobytes and go down and sleep again is life for here he lucky but this is the typical this is one of the typical scenarios in an IOT same source behave differently that rather than business applications and then if we look instead what happens in there in the IT space is exactly the opposite so we have high performance so from the chipsets to the Middle where everything was everyone was focused on high performance because the power was not a problem so Intel is making very high performance chip sets right at Oracle and all the software vendors are focusing on high performance middle words high performance doesn’t mean low power means high power behind large footprint you know Enterprise Service bus you take one of the interoperability standards like hl7 in health care you have a message that goes from one application to another application going through an enterprise service bus this message is out inclusive contains everything the header the footer the semantics the dictionaries how to decode the code which is the dictionary decoding the code so then the footprint is huge but this is perfect for that requirement the space of enterprise interpretability communication between applications because application are the coupled and the message must contain all information this cannot work in an m2m space so the other characteristics is that is that you typically have a few connections if you look at your yes be in hospital or in an enterprise or in a planter in a manufacturing plant you will have finally thousands of applications maybe hundreds of application connected to your bus exchanging a lot of messages continuously so you have very many messages few connections in fact the protocols like amqp which come from the enterprise space are fit for that purpose serving very very many messages very frequent very reliable high performance few connections so looking now at the operational technologies we have a platform called its platform as a service called every word cloud inside that platform there’s a reddit middleware which is the amq MQTT broker the platform has different building blocks so having an IOT platform is not just a matter of having a broker the broker must be compatible with more than one protocol the main purpose of the broker is to make the complete the translation from one protocol to the other and to be reliable but mainly to serve the connectivity purposes then there are all the other functions and purposes that you have to to take care of so am Q is very good middleware and gives us a very good broker because it is for high performance messages so it’s perfect to make the bridge between operational technologies and information technologies is cross language and multi-protocol capability so could translate from MQTT to amq to JMS etc etc and then is already ready for cloud another thing that we liked very much is that it is based on Oct I how many of you know how CGI all of you so I don’t have to tell anything about CGI about its advantages and architecture and another thing that we appreciate what a lot is the fact that it is highly tuneable so you have in your mq xml file a lot of parameters that you can tune this is a great power but also this is the great job to be done ok it’s 2 years that we are tuning amq in about 60 parameters to reach the performances in the m2m IOT space that we want to reach otherwise our IOT test test and test cases are not passed how many of you knows I’m kitty so Hal for view so few words about MQTT MQTT is not a brand new protocol MQTT was designed by eurotech and IBM together 15

years ago the specification was written together and also the job implementation was written together the main the main reason for which we design a roll down this specific is 40 pages specification of such a protocol was that IBM got a big deal and we still are in that in that in the maintenance phase of that project and we were a subcontractor of IBM we are still managing eighty percent of oil and gas pipelines in north america canada and united kingdom and this was the project at that time we and IBM already understood the IP would have become the protocol also for machine-to-machine communication but in those times the costs of telemetry over i over long distance over telecom / carrier was extremely expensive much more expensive descending a person on the field to do the maintenance with a car with a plane so it was cheaper sending people rather than moving information and the only worldwide coverage was given by the satellite which was even more expensive so we understood the HTTP was not the right protocol because it is query response we will see in the next slide why we understood that we were in the need to have a specific protocol that was using efficiently the bandwidth because the when bandwidth was extremely expensive so had to be low bandwidth low power because most of the devices are powered by batteries or must consume low battery two-way communication that mr communication must be started initiated always by the device for security reason then the session must remain always on not like an HTTP that you each time you have a new session ID so the session ID must may not lose that one then it it must be published subscribe because it makes it simplifies a lot of things another thing that that we liked very much of the protocol is the fact that you can have the hierarchical topic name space in this helps creating a partitioning of applications on the embedded side which permits you to aggregated data and to create iut metamodels on the server side automatically so to preserve the one of the principles that on the edge side you must remain data analyst excel as soon as you plug a new sensor you don’t have to change your source code or whatever in the platform neither on the edge node nor on the cloud to enable the data real-time communication from the sensor to the cloud ok firewall friendly because when you start the communication from the edge node you are exiting a firewall from a local network that is this sensing network here to the cloud so most of the firewalls by default permits you to get out and they stop you when you want to enter from internet so the fact that communication is always initiated from a local network towards the public network is a matter of security firewall friendly SSL is already foreseen by MTT so you have the MK tts so you have the secure and the secure socket and the authentication and then today we have a very large ecosystem all around MQTT this is impressive because this gives you the difference between mt TT and HTTP and you see for instance the performances how many messages per hour are received over a 3g communication in mt DT compared to http you have a hundred sixty thousand messages versus 1000 messages 101 dot seven thousand messages all the rest of the figures are really impressive and this means also saving battery and also reliability because if you look at the message node losses you see that amputee by definition gives you a mechanism to assure the reliability of the message you have quality of service inside 012 and with the MQTT SN also the meanest one SN mean sensing network while instead with HTTP you have to take care by yourself so you have to create your code to take care of reliability of the message but the HTTP doesn’t give you by protocol this kind of reliability why is that the entity gives you such a stuffing which is very important okay so MQTT is okay for IOT but is not enough be you know that you find also open source and free distribution either of brokers and of client like PAHO now is a client and PDT but beyond a pure MQTT

client or server there is a lot of stuff that you have to consider on the device ID you have six things on transport service you have to obstruct the transport service because if you want to change MQTT with co-op that is another protocol you don’t want to change your own embedded application which are running inside that projector you want to decouple them so first thing you have to create a mechanisms to obstruct with jab AAP is the transport from the real protocol then the credential and authentication management this is not given by MQTT as a black box you have to to add this to to to to the to the protocol the provisioning the provisioning must be managed provisionally means initializing that device so the initialization from the cloud or through the cloud as a name to dt message goes into that device could be the firmware could be the operating system could be the software stack where the embedded applications are running data services when that device is transmitting to the cloud that device suppose is transmitting via cellular communication the cellular communications by definition reliable and is one of the most nightmares that all of us have when you go live with an IOT project so the cellular goes down this is pretty normal that goes down so you must manage the local cache in-memory database flashing on a local database etc etc so something that you have taught in order that you can reconnect once the connection is always on and the cellular communication works again you have to re-establish the publishing service and reconnect and forward the messages in the right priority and in the right order if ok we consider also the the fact that before we transmit the telemetry data this telemetry data cannot go in clear as they have been received from the sand so they must be transformed first of all they must be compressed either for security and for performances then you have to give a data model for IOT otherwise your your business application finally we will have a hard job to cope with this data and to process this data so you need to give a topic in a namespace to partition the applications for instance in the topic here article namespace that we use we identify the customer and then the device and then inside advice the single embedded application one could be temperature the other one could be light the other one could be whatever ok in this way partition you can partition the application this helps you creating a semantic data model then you have to manage some important events like birth and death and dependable occasion certificates to recognize when a device go live for the first time or go down for the last time in its life these are two very important events then MQTT is a publish-subscribe doesn’t have by default the request response mechanism so you have to define one by yourself which is quite useful in very many business scenarios if all that stuff is what you had you have to add at eight at the device ID that there are some stuff that you have to to mind also on the server side first of all enforcing authentication we are now all around the broker so the broker itself doesn’t give you all the stuff you have to have a sort of broker assistant or broker plugin that you have to create to manage authentication and forth authorization access control lists role-based access control is to post on specific topics enforcing account policies and tracking the session audit log then you have to reinforce the connectivity by tracking the device connectivity and inventing your mechanism to giving the real-time status of the connectivity then you have to decide what to do with the data either you want to store the data that you are receiving from the sensors in real time or you want to dispatch this data towards an information technology stack which has big data database or whatever so you have to have these mechanisms to dispatch to switch and they must be configurable finally you it’s a very good practice to have a rule engine or a complex event processing that inspects that in real time when they arrive on the broker and you didn’t take actions based on rules that you have defined

possibly not not in the source code another important thing is that you have to configure amq to create a network of brokers and a cluster to give more reliability scalability to your infrastructure in terms of the poem toponymy i think is the right word and then to cope with the protocol translation I’m ttt2 amq JMS etc and then you can create your custom banners or no CGI what are the challenges of a immediate were like amq which was made for requirements coming from the enterprise business but mainly to first of all in the enterprise business your middle word is mainly in an intranet here it is exposed to internet and it has to cope with millions of connections few messages but millions of connections and this is something that normally is under underestimated so exposing exposing amq and the broker to internet into millions of connection you have to go through some recommendations so protecting the broker instances so don’t take the firewall default configuration this is nothing more mistaken that taking the accepting the default configuration go port by port reduce the number of open ports configure secure the amq connector that is a parameter in MQM xml enforces SL configure the cluster the couple SSL termination that is another parameter in in a mq xml from the broken up so that you have an ssl proxy which just does the decoding of ssl to no ssl and so you do not vary over load with the useless work the broker so the broker can cope with more connections another recommendation is that due to respecto cgi but all of you are aware about o cgi so i will not spend words on it so don’t do it your way respect your cgi best practices they are really useful remain in the space of in-memory don’t go through tcp/ip there is a latency sometimes this latency is not acceptable oh okay network of brokers we already said another day also this could be very useful so in a mq you have the possibility to fine-tune the checkpoints the frequency of the checkpoint so the red logs and the data logs size and frequency error recycle do it finally tuning tuning at the MQTT so the coupling threads and connection so use shared connection for fred’s do not do do not use the dedicated there are two precious resources disabled j makes it better not to use it rather instead use the advisory support to create your monitoring system but it is another feature provided by mq increase the durable topic prefetch so that you can process bulk of messages and on what I not instead one by one last recommendation from version five dot 11 of x g mq you can try to use beautiful topic subscriptions you create a pool of subscribers and you can send a publish a message just to one of them and not to the mall every time which is useless so if this is if so far we have seen how to use the good technologies that we have today let’s see how they have been placed in in real business scenarios we have used them in very many different verticals so from Cruz balls fridges in the shopping malls industrial chillers HVAC systems transportation trains taxi gymnastic poles energy metering transportation healthcare military military military use cases etc even restrooms but why such a diversity because of operational technologies are horizontal so the technology do we have spoken so far horizontal either on the information technology side and the operational technology side so to go vertical what we have to do is create the embedded application that interface that sensor on one side and on the other end of the picture create the

or create the form or the business application function which are ready which is going to be encapsulated in already existing business applications they’ll have to create a new business application so let’s see ya at a typical use case this is the use case that is inactive here at the booth we have equipped some rooms with the smarter stereoscopic cameras there is a software inside the cameras as soon as you go through the exposition rooms in this floor in the ballroom a there are sterile copy comes counting people in and out and these people counter then this information is mixed up with the social media you can use the topic as a joint key with a hashtag so that you can in real time count people but also learn what are they talking about so you have a typical example of Internet of people integrated with the Internet of Things the devices that are set up here are a gateway stereoscopic cameras called people counter and then they’re also there are a couple of environmental stations they are monitoring in real-time 20 different type of gas particulate p.m. 2 pm-5 p.m. 10 nuclear radiation is probably hopefully we will not detect anything and magnetic fields another use case of the same devices is running live in the since years in the Heathrow Airport in this case the company who won the tender with the airport to clean the restrooms was going to be kicked out of the deal because of the high number of claims of passengers passing through Heathrow Heathrow is the largest airport of London and because of the there were dirty because no paper no soap etc etc so we met they met my colleagues in a convention like this and they acquired these people counters they understood the power of real-time data and they change the service from here here they’re stealing in the business now and they are making a good service now they are very much appreciated by the customer because the the data they retrieved the went far beyond what they expected so it was useful not only for them but also for the customer and I tell you very many tell you why because first of all they turned the shedule of the cleaning service it was not any more on shadow it wasn’t the man so they turned the restroom in an intelligent restroom and when the rest was counting 15 males enter into the restaurant that was calling the the staff and the staff was going and bringing so paper etc then they realized that some rest rooms were unused they brought the report to the customer the customer decided to turn a cost center that is a restroom into a profit Center that is a shop so they closed the restroom and turn it to shop rented it as a shop and so they turned it so the power of information the same devices are used in trains buses both to count people 222222 control if your profits are correct because in the bus or train you have a certain percentage of people that do not purchase the ticket so they just jump into the bus and then jump off you want to know in which stops of the other route this is happening so that you can reinforce that part that part of the pathway of that line of bus etc in this case we have equipped company of taxis and they’re very much happy because first they were looking just to read to improve the revenues but then they’re enforced also the security of the drivers they improve the revenues because they go exactly where there is people waiting for them so this the service improved the customers waiting for a taxi are happier because it isn’t there are never long Hughes as soon as they arrive a taxi immediately know the system dispatch the taxi closes taxi drivers to the to the queue and so the taxi arrives without calling it very soon so never alone you never a long waiting time for passengers and drivers are always picking up people so they do not stand waiting for people this is waste money for them this is time without profits so they increase the profit and then they pushed the other day I found you with a pep a button to be pushed to as an alarm button and these triggers immediately add a sort of rescue procedure they know the position of the taxi where it is home they switch on the loudspeakers so they can also listen to the to the to the talk inside the car completely

different scenario in this case they require that they wanted to monitor the refrigeration units in a grocery and to perform asset management remotely same devices same information technologies integrated with operational technologies a different business case so MQTT is IOT ready but what about us programmers are we ready so we mentioned Java this is a report by red monk about all the programming languages and technology and you can see Java is the top number one over there in terms of lower time to market and investment protection there are out there are more than nine million Java developers in the world most of them are like you in the enterprise space but with the technology that are available today you don’t have to learn about Laura zigbee Bluetooth the serial hardware functions wireless you don’t have to learn about that this is a commodity for you have frameworks like the CUDA project that we will talk about soon that simplifies so it all you have to know is Java when you know Java you can make your applications also in the end in the m2m space so there is not any more cultural gap a cultural barrier so the the enterprise Java developers can be shipped to IOT probable projects without any problem in 2012 eurotech sierra wireless and IBM founded the Eclipse IOT work group eurotech donated the software-defined Java gateway with the name of Korra and when we founded the consulting with we were just three members after three years there are 23 members more than 50 projects more than 15 million lines of source code available and this is the faster-growing Eclipse work group this is really great is giving us a lot of satisfaction and we are very happy to have done this switch from a proprietary software based company very jealous of its secrets we are a hardware manufacturer finally to an open source approach we are really happy this is giving us a lot of satisfaction this is not the definition made by me or by us it’s a quote by this guy which is very I like it very much so if you have time go to slide sure and read his pay his comments about IOT and open source open source is really important for IOT plays an important role in my opinion much more important the proprietary software so you have a cooler project which is the software-defined gateway Oh CGI based inside the DI Oh open IOT stack for java developers is attractive is going well we have more than 1,000 downloads per month or so it’s interesting and we need you I mean if you want to be part of it you are very welcome you can join and you can contribute and you can make this magic grow up so thank you very much you