Reactive Programming Models for IoT Todd L. Montgomery - - PowerPoint PPT Presentation

reactive programming models for iot
SMART_READER_LITE
LIVE PREVIEW

Reactive Programming Models for IoT Todd L. Montgomery - - PowerPoint PPT Presentation

Reactive Programming Models for IoT Todd L. Montgomery @toddlmontgomery Psst! Already Here! Not New! Internet of Things? Just a Silicon Valley buzzword? Psst! Also Not New! Reactive Programming? Just another buzzword? Connecting Things


slide-1
SLIDE 1

Reactive Programming Models for IoT

Todd L. Montgomery @toddlmontgomery

slide-2
SLIDE 2

Internet of Things?

Just a Silicon Valley buzzword?

Psst! Already Here! Not New!

slide-3
SLIDE 3

Reactive Programming?

Just another buzzword?

Psst! Also Not New!

slide-4
SLIDE 4

Connecting “Things” …Reactively…

slide-5
SLIDE 5

What most of us think happens

Request Response

slide-6
SLIDE 6

Request Response

What really happens

And if not, we’ll make it!

slide-7
SLIDE 7

Request Response

What also really happens

But… Who does this?

slide-8
SLIDE 8

@toddlmontgomery

Request Response

Support (UI/Device) Security (Challenge) Keep-Alive

  • r Watchdog

User State Query

slide-9
SLIDE 9

Stream

What also really happens

News, Stocks, Texts/SMS, Video, Audio, Social, …

slide-10
SLIDE 10

Ingest

What also really happens

Temperature, Heart Rate, Web Logs, Sensor Data, Seismic Readings, Steps, Stairs, Gyro Data, GPS, Acceleration, Breathing, EKG, EEG, …

slide-11
SLIDE 11

Request Response

What also really happens

Stream & Ingest

Pretty much how everything actually works…

slide-12
SLIDE 12

What also REALLY happens

slide-13
SLIDE 13

Message Message

The Break Down

Request, Response, Stream, and Ingest are really types Message-Driven Message-Driven

slide-14
SLIDE 14

Reactive Applications

Message Driven Responsive Resilient Elastic

http://www.reactivemanifesto.org/

slide-15
SLIDE 15

REST RPC Function Call Message-Driven LISP

Distributed Systems Evolution

slide-16
SLIDE 16

IoT…

slide-17
SLIDE 17
slide-18
SLIDE 18

@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"

slide-19
SLIDE 19

@toddlmontgomery

slide-20
SLIDE 20
slide-21
SLIDE 21

courtesy of

slide-22
SLIDE 22

Sometimes it is good to reinvent the wheel

slide-23
SLIDE 23

@toddlmontgomery

What History Has Taught Us

slide-24
SLIDE 24

THE IoT Language!

slide-25
SLIDE 25

THE IoT Protocol!

slide-26
SLIDE 26

THE IoT Runtime!

slide-27
SLIDE 27

THE IoT ______!

slide-28
SLIDE 28

Internet of Things

Multi-Lingual (and Polyglot) Multi-Protocol & Multi-Standard Multi-“Platform” Huge Scale Highly Integrated

slide-29
SLIDE 29
  • Connected. Integrated.

Great time to be a protocol geek!

slide-30
SLIDE 30
  • Connected. Services. Tools.

Nuklei

Multi-Lingual (and Polyglot) Location Transparency Multi-Protocol & Data Format Basic Low-Level API

slide-31
SLIDE 31

Protocols

Nuklei

Deployment Container

Logic

Reactive Message Stream

Depends on language, runtime, platform, etc. Asynchronous Binary “Loose” Ordering

slide-32
SLIDE 32

Protocols

Nuklei Logic

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

slide-33
SLIDE 33

Protocols?

Shared Memory IPC WebSocket JMS WebRTC

Not just in the traditional sense…

HTTP /1.1 MQTT HTTP /2 AMQP CoAP TCP /UDP /IP Aeron 0MQ

slide-34
SLIDE 34

@toddlmontgomery

pro·to·col noun \ˈprō-tə-ˌkȯ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>

slide-35
SLIDE 35

@toddlmontgomery

Protocols are the key to Integration

REST has demonstrated this!

slide-36
SLIDE 36

@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

slide-37
SLIDE 37

@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

slide-38
SLIDE 38

@toddlmontgomery

Binary Encoding

Thing 1 Thing 2

Not a human Also, …not a human Does not need to be human readable

http://tools.ietf.org/html/rfc7049

Concise Binary Object Representation (CBOR) FIX / Simple Binary Encoding (SBE)

https://github.com/real-logic/simple-binary-encoding

HPACK (Part of HTTP /2) …

slide-39
SLIDE 39

@toddlmontgomery

Addressing

URIs - Just, but not only Strings https://www.ietf.org

Think about how much context this contains!

Define an Endpoint for Connectivity Simple, Natural, & Familiar

slide-40
SLIDE 40

@toddlmontgomery

Isolation & Location Transparency

Deployment Container docker, AWS, VM, … Leverage Binding & Resolution to decouple Migration Endpoint can be anywhere

slide-41
SLIDE 41

Deployment Container

OS level isolation, don’t duplicate at the application layer

VM AMI App Server

slide-42
SLIDE 42

@toddlmontgomery

Basic Low-Level API

“Common” Message/Packet/Frame -based BSD Sockets has it right

From an old protocol hacker…

slide-43
SLIDE 43

@toddlmontgomery

Defining a Service

★ Address = String ★ Service Logic = Lambda

Endpoint Because they should be that simple

slide-44
SLIDE 44

@toddlmontgomery

@FunctionalInterface public interface Mikro { void onMessage( Object header, int typeId, AtomicBuffer buffer, int offset, int length); }

Previous Protocol Flyweight ByteBuffer

  • n Steroids
slide-45
SLIDE 45

@toddlmontgomery

Flyweights

Struct Overlays Semi-Stateful Parsers Know how to access fields efficiently Prefer to access via dead reckoning (stateless)

slide-46
SLIDE 46

@toddlmontgomery

Sending to a Service

★ Proxy = Resolve(Address) ★ Proxy.send(Data)

From anything, not just another Service

For Efficiency, Reuse, and Caching

slide-47
SLIDE 47

@toddlmontgomery

@FunctionalInterface public interface Proxy { int send( int typeId, AtomicBuffer buffer, int offset, int length); }

ByteBuffer

  • n Steroids
slide-48
SLIDE 48

@toddlmontgomery

Additionally…

Flow Control… Security… Schedulers… Polyglot?…

Think Packet Scheduling? Java, then JavaScript, C, iOS, Not an afterthought Also, not an afterthought

slide-49
SLIDE 49

Message Message

To Sum Up

slide-50
SLIDE 50

https://github.com/kaazing/nuklei

Very Early & Still Evolving

  • Connected. Services. Tools.
slide-51
SLIDE 51

@toddlmontgomery

Questions?

  • Kaazing http://www.kaazing.com
  • GitHub https://github.com/kaazing
  • Slideshare http://www.slideshare.com/toddleemontgomery
  • Twitter @toddlmontgomery

Thank You!