Events, Picos, and Microservices

73
Events, Picos, and Microservices Phillip J. Windley, PhD Enterprise Architecture, BYU CTO, Kynetx, Inc. @windley

Transcript of Events, Picos, and Microservices

Page 1: Events, Picos, and Microservices

Events, Picos, and MicroservicesPhillip J. Windley, PhD Enterprise Architecture, BYU CTO, Kynetx, Inc. @windley

Page 2: Events, Picos, and Microservices
Page 3: Events, Picos, and Microservices

This APIs in this talk aren’t RESTful

Page 4: Events, Picos, and Microservices

Internet of Things

Page 5: Events, Picos, and Microservices

The Internet of Things will lead to a computing experience that is immersive & pervasive.

Page 6: Events, Picos, and Microservices

Ambient Computing

Page 7: Events, Picos, and Microservices

vs

Page 8: Events, Picos, and Microservices
Page 9: Events, Picos, and Microservices

The Current #IoT Model Won’t Scale

Page 10: Events, Picos, and Microservices

Me

Page 11: Events, Picos, and Microservices
Page 12: Events, Picos, and Microservices

GE

Page 13: Events, Picos, and Microservices

Internet of

My Things

Me

GE

Page 14: Events, Picos, and Microservices

The Internet of My Things

Page 15: Events, Picos, and Microservices

The Internet of My Things leads to The API of Me

Page 16: Events, Picos, and Microservices

Events vs Requests

Page 17: Events, Picos, and Microservices

“this happened” vs “do this”

Page 18: Events, Picos, and Microservices
Page 19: Events, Picos, and Microservices
Page 20: Events, Picos, and Microservices

Event System Properties

Events are autonomous Event-driven system are more loosely coupled Downstream (receiver) driven flow control Near real-time propagation

Page 21: Events, Picos, and Microservices

Fuse is Three Things

http://joinfuse.com

Page 22: Events, Picos, and Microservices
Page 23: Events, Picos, and Microservices

picos

Page 24: Events, Picos, and Microservices

Picos are online computersIdentity—they represent a specific entity Storage—they persistently encapsulate both structured and unstructured data Open event network—they respond to events Processing—they run applications autonomously Event Channels—they have connections to other picos Services—The provide a consistent set of services APIs—they provide access to and access other online services

Page 25: Events, Picos, and Microservices

Owner Pico

Fleet Pico

Vehicle Pico

Vehicle Pico

Vehicle Pico

Page 26: Events, Picos, and Microservices

Web Application

Application Data

Browser

Page 27: Events, Picos, and Microservices

Web Application

Application Data

Browser

Page 28: Events, Picos, and Microservices

Vehicle's Pico

iCalendarWeb

Mobile

Page 29: Events, Picos, and Microservices

Rather than a model where a system presents an API for a collection of resources….

Page 30: Events, Picos, and Microservices

Rather than a model where a system presents an API for a collection of resources….

Picos present a model wherein each pico presents it’s own, customizable API

Page 31: Events, Picos, and Microservices

Phil's Pico

owner

Page 32: Events, Picos, and Microservices

Phil's Pico

owner

Lynne's Pico

owner

Page 33: Events, Picos, and Microservices

Phil's Pico Tom's Pico

owner

Lynne's Pico

owner

Page 34: Events, Picos, and Microservices

Phil's Pico Tom's Pico

owner

Lynne's Pico

owner

Page 35: Events, Picos, and Microservices

Phil's Pico Tom's Pico

owner

Lynne's Pico

owner

Page 36: Events, Picos, and Microservices

Phil's Pico Tom's Pico

owner

Lynne's Pico

owner borrower

Page 37: Events, Picos, and Microservices

Phil's Pico

Page 38: Events, Picos, and Microservices

Phil's Pico

Page 39: Events, Picos, and Microservices

Picos Support A Familiar Model

Kynetx Rules Engine

OtherData

Sources

WebServices

APIs

Rulesets PersistentData

APIs

container

Page 40: Events, Picos, and Microservices

Picos Support A Familiar Model

Kynetx Rules Engine

OtherData

Sources

WebServices

APIs

Rulesets PersistentData

APIs

container

Persistent Compute Object object

Page 41: Events, Picos, and Microservices

Picos Support A Familiar Model

Kynetx Rules Engine

OtherData

Sources

WebServices

APIs

Rulesets PersistentData

APIs

container

Persistent Compute Object object

CloudOS

Confi

gura

tion

Man

agem

ent

Clou

dOS

Serv

ice

Notifi

catio

nSe

rvice

Pers

onal

Dat

a Se

rvice

UI S

uppo

rt

File

Soci

al

Soci

al Fuse

Libr

ary

Gua

rd

Tour

Libr

ary

libraries

Page 42: Events, Picos, and Microservices

Picos Support A Familiar Model

Kynetx Rules Engine

OtherData

Sources

WebServices

APIs

Rulesets PersistentData

APIs

container

Persistent Compute Object object

Fore

vr.u

s(c

onta

ct)

Tim

elin

e(s

ocia

l)

To D

o &

Rem

inde

rs

Vehi

cle

Man

ange

men

t

Hom

e M

anag

emen

t

Inte

ntca

stin

g

Fuse

Gua

rd

Tour

applications

CloudOS

Confi

gura

tion

Man

agem

ent

Clou

dOS

Serv

ice

Notifi

catio

nSe

rvice

Pers

onal

Dat

a Se

rvice

UI S

uppo

rt

File

Soci

al

Soci

al Fuse

Libr

ary

Gua

rd

Tour

Libr

ary

libraries

Page 43: Events, Picos, and Microservices

Picos Are Decentralized & Networked

picopico

HostingSpace

PicoSpace

HostingCompany A

Hosting Company B

SelfHosted

pico

pico

pico

pico

picopico

pico

KRE KRE KRE PicoContainers

Page 44: Events, Picos, and Microservices

Built on open standards Built on open source

Page 45: Events, Picos, and Microservices

But it’s not just about manufactured things...

Page 46: Events, Picos, and Microservices

This can get complex…

Institution

TourIndex Location

Index

ReportIndex

Tour"LUFX"

Tour"KUFF"

Location"R7RK"

Report"1"

Location"G5YH"

Report"current"

Location"T67G"

Managers

Guards

Guard"Frank"

Subscriptions

permanent

temporary

Report"2"Report"2"Report"2"Reports

ToursToursToursTours

LocationsLocationsLocationsLocations

Page 47: Events, Picos, and Microservices

Picos Use an Event Query API

pico

functions

rules

persistentstorage

or CancelDone

User Interface

name

email

phone

query API

event API

user makes change in UIresulting in an event

UI updates presentation using query API

rules validate and process event, often updating model

functions return results based on persistent data

Page 48: Events, Picos, and Microservices

Programming ModelProgram in any language you like

OAuth access to pico

Pico provides

user data

processing

API and inter-pico communications

Page 49: Events, Picos, and Microservices

MicroservicesOrganized around a single business capability Small, generally less than 1000 lines and code and usually much smaller Event-based and asynchronous Run in their own process Independently deployable Decentralized data storage

Page 50: Events, Picos, and Microservices

carvoyant: numeric_data_key

vehicle event bus

Page 51: Events, Picos, and Microservices

carvoyant: numeric_data_key

vehicle event bus

fuel level low

Page 52: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

Page 53: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

create alert

fuse: new_alert

Page 54: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

create alert

fuse: new_alert

send notification

notification: status

Page 55: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

create alert

fuse: new_alert

record new fuel

send notification

notification: status

Page 56: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

create alert

fuse: new_alert

record new fuel

IFTTT

send notification

notification: status

Page 57: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

create alert

fuse: new_alert

record new fuel

save trip IFTTT

send notification

notification: status

Page 58: Events, Picos, and Microservices

carvoyant: numeric_data_key

fuse: update_fuel_level

vehicle event bus

fuel level low

create alert

fuse: new_alert

record new fuel

save trip IFTTT

send notification

notification: status

record brand data

Page 59: Events, Picos, and Microservices

Healing Subscriptionsrule check_subscriptions {

select when pds profile_updated

pre {

vid = carvoyant:vehicle_id();

my_subs = carvoyant:getSubscription(vid);

should_have = required_subscription_list.length();

}

if(my_subs.length() < should_have) then

send_directive("not enough subscriptions")

fired {

log ">>>> vehicle #{vid} needs subscription check";

raise fuse event need_initial_carvoyant_subscriptions;

}

}

Page 60: Events, Picos, and Microservices

Healing Subscriptionsrule check_subscriptions {

select when pds profile_updated

pre {

vid = carvoyant:vehicle_id();

my_subs = carvoyant:getSubscription(vid);

should_have = required_subscription_list.length();

}

if(my_subs.length() < should_have) then

send_directive("not enough subscriptions")

fired {

log ">>>> vehicle #{vid} needs subscription check";

raise fuse event need_initial_carvoyant_subscriptions;

}

}

Page 61: Events, Picos, and Microservices

Healing Subscriptionsrule check_subscriptions {

select when pds profile_updated

pre {

vid = carvoyant:vehicle_id();

my_subs = carvoyant:getSubscription(vid);

should_have = required_subscription_list.length();

}

if(my_subs.length() < should_have) then

send_directive("not enough subscriptions")

fired {

log ">>>> vehicle #{vid} needs subscription check";

raise fuse event need_initial_carvoyant_subscriptions;

}

}

Page 62: Events, Picos, and Microservices

Healing Subscriptionsrule check_subscriptions {

select when pds profile_updated

pre {

vid = carvoyant:vehicle_id();

my_subs = carvoyant:getSubscription(vid);

should_have = required_subscription_list.length();

}

if(my_subs.length() < should_have) then

send_directive("not enough subscriptions")

fired {

log ">>>> vehicle #{vid} needs subscription check";

raise fuse event need_initial_carvoyant_subscriptions;

}

}

Page 63: Events, Picos, and Microservices

Healing Subscriptionsrule check_subscriptions {

select when pds profile_updated

pre {

vid = carvoyant:vehicle_id();

my_subs = carvoyant:getSubscription(vid);

should_have = required_subscription_list.length();

}

if(my_subs.length() < should_have) then

send_directive("not enough subscriptions")

fired {

log ">>>> vehicle #{vid} needs subscription check";

raise fuse event need_initial_carvoyant_subscriptions;

}

}

Page 64: Events, Picos, and Microservices

KRLRules Runs in picos Built for microservices Complex event expressions Persistent variables Side-effects are quarantined

Page 65: Events, Picos, and Microservices

Developer Tools

Page 66: Events, Picos, and Microservices

Self Healing

Page 67: Events, Picos, and Microservices

f(f(x)) = f(x)Idempotent

Page 68: Events, Picos, and Microservices

Asynchrony

Page 69: Events, Picos, and Microservices

Accretive Systems

Page 70: Events, Picos, and Microservices

Why do this?Orthogonality and modularity are powerful: network effects! Loose coupling Simple services are easier to get right More private

Page 71: Events, Picos, and Microservices

My book on event programming

Page 72: Events, Picos, and Microservices

http://joinfuse.com

Internet Identity Workshop

Page 73: Events, Picos, and Microservices

Contact info: Phil Windley

[email protected] www.windley.com

@windley

Events, Picos, and Microservices