Events, Picos, and Microservices
-
Upload
phil-windley -
Category
Internet
-
view
206 -
download
2
Transcript of Events, Picos, and Microservices
![Page 1: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/1.jpg)
Events, Picos, and MicroservicesPhillip J. Windley, PhD Enterprise Architecture, BYU CTO, Kynetx, Inc. @windley
![Page 2: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/2.jpg)
![Page 3: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/3.jpg)
This APIs in this talk aren’t RESTful
![Page 4: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/4.jpg)
Internet of Things
![Page 5: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/5.jpg)
The Internet of Things will lead to a computing experience that is immersive & pervasive.
![Page 6: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/6.jpg)
Ambient Computing
![Page 7: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/7.jpg)
vs
![Page 8: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/8.jpg)
![Page 9: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/9.jpg)
The Current #IoT Model Won’t Scale
![Page 10: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/10.jpg)
Me
![Page 11: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/11.jpg)
![Page 12: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/12.jpg)
GE
![Page 13: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/13.jpg)
Internet of
My Things
Me
GE
![Page 14: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/14.jpg)
The Internet of My Things
![Page 15: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/15.jpg)
The Internet of My Things leads to The API of Me
![Page 16: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/16.jpg)
Events vs Requests
![Page 17: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/17.jpg)
“this happened” vs “do this”
![Page 18: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/18.jpg)
![Page 19: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/19.jpg)
![Page 20: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/20.jpg)
Event System Properties
Events are autonomous Event-driven system are more loosely coupled Downstream (receiver) driven flow control Near real-time propagation
![Page 22: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/22.jpg)
![Page 23: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/23.jpg)
picos
![Page 24: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/24.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/25.jpg)
Owner Pico
Fleet Pico
Vehicle Pico
Vehicle Pico
Vehicle Pico
![Page 26: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/26.jpg)
Web Application
Application Data
Browser
![Page 27: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/27.jpg)
Web Application
Application Data
Browser
![Page 28: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/28.jpg)
Vehicle's Pico
iCalendarWeb
Mobile
![Page 29: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/29.jpg)
Rather than a model where a system presents an API for a collection of resources….
![Page 30: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/30.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/31.jpg)
Phil's Pico
owner
![Page 32: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/32.jpg)
Phil's Pico
owner
Lynne's Pico
owner
![Page 33: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/33.jpg)
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner
![Page 34: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/34.jpg)
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner
![Page 35: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/35.jpg)
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner
![Page 36: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/36.jpg)
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner borrower
![Page 37: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/37.jpg)
Phil's Pico
![Page 38: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/38.jpg)
Phil's Pico
![Page 39: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/39.jpg)
Picos Support A Familiar Model
Kynetx Rules Engine
OtherData
Sources
WebServices
APIs
Rulesets PersistentData
APIs
container
![Page 40: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/40.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/41.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/42.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/43.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/44.jpg)
Built on open standards Built on open source
![Page 45: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/45.jpg)
But it’s not just about manufactured things...
![Page 46: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/46.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/47.jpg)
Picos Use an Event Query API
pico
functions
rules
persistentstorage
or CancelDone
User Interface
name
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/48.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/49.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/50.jpg)
carvoyant: numeric_data_key
vehicle event bus
![Page 51: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/51.jpg)
carvoyant: numeric_data_key
vehicle event bus
fuel level low
![Page 52: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/52.jpg)
carvoyant: numeric_data_key
fuse: update_fuel_level
vehicle event bus
fuel level low
![Page 53: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/53.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/54.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/55.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/56.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/57.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/58.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/59.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/60.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/61.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/62.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/63.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/64.jpg)
KRLRules Runs in picos Built for microservices Complex event expressions Persistent variables Side-effects are quarantined
![Page 65: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/65.jpg)
Developer Tools
![Page 66: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/66.jpg)
Self Healing
![Page 67: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/67.jpg)
f(f(x)) = f(x)Idempotent
![Page 68: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/68.jpg)
Asynchrony
![Page 69: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/69.jpg)
Accretive Systems
![Page 70: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/70.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/71.jpg)
My book on event programming
![Page 73: Events, Picos, and Microservices](https://reader038.fdocuments.us/reader038/viewer/2022110122/55a78cd61a28ab356e8b4846/html5/thumbnails/73.jpg)
Contact info: Phil Windley
[email protected] www.windley.com
@windley
Events, Picos, and Microservices