View
217
Download
0
Category
Preview:
Citation preview
Reactive Programming Models for IoT
Todd L. Montgomery @toddlmontgomery
Internet of Things?
Just a Silicon Valley buzzword?
Already Here! Not New!
Reactive Programming?
Just another buzzword?
Also Not New!
Connecting “Things” …Reactively…
What most of us think happens
Request
Response
Request
Response
What really happens
And if not, we’ll make it!
Request
Response
What also really happens
But… Who does this?
@toddlmontgomery
Request
Response
Support (UI/Device)
Security (Challenge)
Keep-Alive or Watchdog
User State Query
Stream
What also really happens
News, Stocks, Texts/SMS, Video, Audio, Social, …
Ingest
What also really happens
Temperature, Heart Rate, Web Logs, Sensor Data, Seismic Readings, Steps, Stairs, Gyro
Data, GPS, Acceleration, Breathing, EKG, EEG, …
Request
Response
What also really happens
Stream & Ingest
Pretty much how everything actually works…
What also REALLY happens
Message
Message
The Break Down
Request, Response, Stream, and Ingest are really types
Message-Driven
Message-Driven
Reactive Applications
Message Driven
Responsive Resilient
Elastic
http://www.reactivemanifesto.org/
REST
RPC
Function Call
Message-Driven
LISP
Distributed Systems Evolution
?
IoT…
@toddlmontgomery
HTCPCP RFC 2324, Extended by RFC 7168
http://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol
"there is a strong, dark, rich requirement for a protocol designed espressoly [sic] for the brewing of coffee"
@toddlmontgomery
courtesy of
Sometimes it is good to reinvent the wheel
@toddlmontgomery
What History Has Taught Us
THE IoT Language!
THE IoT Protocol!
THE IoT Runtime!
THE IoT ______!
Internet of Things
Multi-Lingual (and Polyglot)
Multi-Protocol & Multi-Standard
Multi-“Platform” Huge Scale Highly Integrated
Connected. Integrated.
Great time to be a protocol geek!
Connected. Services. Tools.Nuklei
Multi-Lingual (and Polyglot)
Location Transparency
Multi-Protocol & Data Format
Basic Low-Level API
Protocols
Nuklei
Deployment Container
LogicReactive
Message Stream
Depends on language, runtime, platform, etc. Asynchronous
Binary “Loose” Ordering
Protocols
NukleiLogic
Reactive Message Stream
Asynchronous Binary Boundary
Basic read/write
API
Various Protocol Options
Choice of protocols becomes deployment concern
Deployment Container
Simple, consistent usage allows functional
composition of protocols
Protocols?
Shared Memory IPC
WebSocket
JMS
WebRTC
Not just in the traditional sense…
HTTP/1.1MQTT
HTTP/2
AMQPCoAP
TCP/UDP/IP
Aeron 0MQ
@toddlmontgomery
pro·to·col noun \ˈprō-tə-ˌko ̇l, -ˌkōl, -ˌkäl, -kəl\ !
... !3 b : a set of conventions governing the treatment and especially the formatting of data in an electronic communications system <network protocols>
...
3 a : a code prescribing strict adherence to correct etiquette and precedence (as in diplomatic exchange and in the military services) <a breach of protocol> !
@toddlmontgomery
Protocols are the key to Integration
REST has demonstrated this!
@toddlmontgomery
Functional Protocol Composition
e.g. HTTP over TCP looks same as HTTP over IPC or HTTP over WebSocket or
HTTP over JMS
e.g. Streams over Messages is a form of Fragmentation/
Reassembly
Packet/Frame is common building block (Ethernet,
ATM, etc.)
Layering becomes natural & trivial. Also forces
boundaries & decoupling
Not New
@toddlmontgomery
TCP
HTTP
Shared Memory WebSocket JMS…
Everything below the boundary can change even
at runtime
Everything above the boundary can assume a
constant interface
… ……
Boundary might be asynchonrous
@toddlmontgomery
Data Format
JSON
FIX / SBE CBOR
YAML
XML JMS Message
Divorced from Data Association
Map<> and other native associations are better than
format specific APIs
HPACK
@toddlmontgomery
AddressingURIs - Just, but not only Strings
https://www.ietf.org Think about how much context this contains!
Define an Endpoint for Connectivity
Simple, Natural, & Familiar
@toddlmontgomery
Location Transparency
Bind Address to “Proxy”
“Proxy” Object Migration
Endpoint can be anywhere
More Forced Decoupling
Isolation & Deployment Containment
OS level isolation, don’t duplicate at the application layer
VM
AMI
App Server
@toddlmontgomery
Basic Low-Level API
“Common”Message/Packet/Frame -based
BSD Sockets has it right
Read/Write BLOBs
read(buffer, offset, length) write(buffer, offset, length)
/mikro1
Nuklei
Proxy
/mikro2
Proxy
https://localhost:80
https://example.com
https://localhost:80/mikro2
https://example.com
In Process or Out
@toddlmontgomery
Flyweights
Struct Overlays Semi-Stateful Parsers
Know how to access fields efficientlyPrefer to access via dead reckoning (stateless)
@toddlmontgomery
Additionally…
Flow Control… Security…
Schedulers…Polyglot?…
Java, then JavaScript, C, iOS, …
Message
Message
To Sum Up
https://github.com/kaazing/nuklei
Very Early & Still Evolving
Connected. Services. Tools.
@toddlmontgomery
Questions?
• Kaazing http://www.kaazing.com • GitHub https://github.com/kaazing • Slideshare http://www.slideshare.com/toddleemontgomery • Twitter @toddlmontgomery
Thank You!
Recommended