A presentation at CodeBEAM BR by Brooklyn Zelenka
Living On the Edge ๐โกA Brave New (Post-Cloud) World ๐ฐโจ
[โฆ] by 2025, 75% of data will be processed outside the traditional data centre or cloud ~ IBM (paraphrasing a Gartner study)
Brooklyn Zelenka @expede
Brooklyn Zelenka @expede โข CTO at Fission โข https://fission.codes โข Infra & browser SDK for edge apps โข PLT, distributed systems โข Specs: DIF, ETH Core โข Meetups: Vancouver FP, Code & Co ee YVR ff โข Libs: Witchcraft, Exceptional, Rescue, &c
WebNative ๐ Meta ๐ฎ โข R&D from Fission & others โข Future looking / an emerging area โข Interesting tech, very exciting โข โฆbut not all problems solved today โข Some advantages to flexible tech even before the network changes โข Universal Hostless Substrate (2019)
WebNative ๐ Meta ๐ฎ โข R&D from Fission & others โข Future looking / an emerging area โข Interesting tech, very exciting โข โฆbut not all problems solved today โข Some advantages to flexible tech even before the network changes โข Universal Hostless Substrate (2019)
WebNative ๐ Fission R&D โข Local first โข Edge only โข No servers โข Fully distributed โข Encrypted at Rest, E2EE โข User owned data @FISSIONCodes
WebNative ๐ Overview Part I: Motivation Part II: On the Edge How we got here Why BEAM What changed? Primer All About Data A Few Techniques
Part I Motivation ๐ญ
Motivation ๐ญ 90s Web
Motivation ๐ญ 90s Web ๐ ๐ฅ
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข ๐
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข โ ๐
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข โ ๐ช ๐
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข โ ๐ช ๐
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข โ ๐ช ๐
Motivation ๐ญ 90s Web ๐ ๐ฅ ๐ข โ ๐ช ๐
Motivation ๐ญ 90s Web ๐ ๐ ๐ ๐ฅ ๐ข ๐ฅ ๐ฅ โ ๐ช ๐
Motivation ๐ญ 90s Web ๐ ๐ ๐ ๐ฅ ๐ข ๐ฅ ๐ฅ โ ๐ช ๐ ๐
Motivation ๐ญ Scaling Up ๐ ๐ ๐ ๐ฅ ๐ฅ ๐ฅ ๐ โ โ โ ๐ ๐ ๐ ๐ ๐ ๐
Motivation ๐ญ Scaling Up ๐ ๐ ๐ ๐ฅ ๐ฅ ๐ฅ ๐ โ โ โ ๐ ๐ ๐ ๐ ๐ ๐
Motivation ๐ญ Scaling Up ๐ ๐ ๐ ๐ฅ ๐ฅ ๐ฅ โ ๐ โThe Cloudโ ๐ ๐โโโโโโ โ ๐ ๐ โ ๐ ๐
Motivation ๐ญ Abstracting ๐ ๐ ๐ ๐ฅ ๐ฅ ๐ฅ โ ๐ โServerlessโ ๐ ๐ โ ๐ ฮปฮปฮปฮปฮปฮปฮปฮปฮปฮปฮปฮปฮป ๐ โ ๐ ๐
โฆand so it was for many yearsโฆ
โฆand so it was for many yearsโฆ ๐ฆโ๐๐พ๐ฐ๐ข๐
Motivation ๐ญ Natural Consequences ๐
Motivation ๐ญ Natural Consequences ๐ โข Server-focus โข More stack to learn โข DevOps, Docker, k8s
Motivation ๐ญ Natural Consequences ๐ โข Server-focus โข More stack to learn โข DevOps, Docker, k8s โข Single source of truth โข i.e. โthe databaseโ
Motivation ๐ญ Natural Consequences ๐ โข Server-focus โข More stack to learn โข DevOps, Docker, k8s โข Single source of truth โข i.e. โthe databaseโ โข Client concerned with data sync
Motivation ๐ญ Natural Consequences ๐ โข Server-focus โข More stack to learn โข DevOps, Docker, k8s โข Single source of truth โข i.e. โthe databaseโ โข Client concerned with data sync โข AWS, Azure, GCP
Motivation ๐ญ Natural Consequences ๐ โข Server-focus โข More stack to learn โข DevOps, Docker, k8s โข Single source of truth โข i.e. โthe databaseโ โข Client concerned with data sync f โข AWS, Azure, GCP Source: 2021 Stack Over low Developer Survey
Motivation ๐ญ Sending a โDirectโ Message
Motivation ๐ญ Sending a โDirectโ Message
Motivation ๐ญ Sending a โDirectโ Message
Motivation ๐ญ Sending a โDirectโ Message
Motivation ๐ญ What Even is a โServerโ? ๐ง
Motivation ๐ญ Network Topology ๐ง
Motivation ๐ญ Network Topology ๐ง โ
Motivation ๐ญ Network Topology ๐ง โ ๐จ๐ค ๐ฉ๐พ Centralized ๐ง๐จ
Motivation ๐ญ Network Topology ๐ง ๐พ โ ๐จ๐ค ๐ฉ๐พ Centralized ๐ง๐จ โ ๐ค ๐
Motivation ๐ญ Network Topology ๐ง ๐พ โ ๐จ๐ค ๐ฉ๐พ Centralized โ ๐ค ๐ ๐ง๐จ ๐
Motivation ๐ญ Network Topology ๐ง ๐พ โ โ ๐จ๐ค ๐ฉ๐พ Centralized ๐ค ๐ ๐ ๐ง๐จ ๐ง๐จ ๐ฉ๐พ ๐จ๐ค Hub (e.g. gateway or load balanced)
Motivation ๐ญ Network Topology ๐ง ๐พ โ โ ๐จ๐ค ๐ฉ๐พ Centralized โ ๐ค ๐ ๐ ๐ง๐จ ๐ง๐จ ๐ฉ๐พ ๐จ๐ค Hub (e.g. gateway or load balanced)
Motivation ๐ญ Network Topology ๐ง ๐พ โ โ ๐จ๐ค ๐ฉ๐พ Centralized โ ๐ค ๐ ๐ ๐ง๐จ ๐ง๐จ ๐ฉ๐พ ๐จ๐ค Hub (e.g. gateway or load balanced) ๐ค ๐พ
Motivation ๐ญ Network Topology ๐ง ๐พ โ โ ๐จ๐ค ๐ฉ๐พ Centralized โ ๐ค ๐ ๐ ๐ง๐จ ๐ง๐จ ๐ฉ๐พ ๐ง๐จ ๐จ๐ค Hub (e.g. gateway or load balanced) ๐ค ๐พ โ ๐จ๐ค
Motivation ๐ญ Network Topology ๐ง ๐พ โ โ ๐จ๐ค ๐ฉ๐พ Centralized โ ๐ค ๐ ๐ ๐ง๐จ ๐ง๐จ ๐ฉ๐พ ๐ง๐จ ๐จ๐ค Hub (e.g. gateway or load balanced) ๐ง๐จ ๐ค ๐พ โ ๐จ๐ค ๐ฉ๐พ Hierarchical or pipelined
Motivation ๐ญ Network Topology ๐ง ๐พ โ โ ๐จ๐ค ๐ฉ๐พ Centralized โ ๐ค ๐ ๐ ๐ง๐จ ๐ง๐จ ๐ฉ๐พ ๐ง๐จ ๐จ๐ค Hub (e.g. gateway or load balanced) ๐ง๐จ ๐ค ๐พ โ ๐จ๐ค ๐ฉ๐พ Hierarchical or pipelined
A Challenger Emerges A New Environment ๐ฐ
New Environment ๐ฐ New Assumptions โข Powerful client devices (e.g. M1 chips, smartphones, IoT) โข Latency is the bottleneck โข Mobile (i.e. smartphone) use only growing โข Lose connection, drop when switching towers โข Do more with the existing physical network โข Not unlike how Mooreโs Law lead to more parallelism
New Environment ๐ฐ New Biz Who Dis?
New Environment ๐ฐ New Biz Who Dis? โข Paradigm shift means new opportunities
New Environment ๐ฐ New Biz Who Dis? โข Paradigm shift means new opportunities โข 5G networks & Starlink โข Put an edge PoP right on the base station โข Low-latency compute across the street
New Environment ๐ฐ New Biz Who Dis? โข Paradigm shift means new opportunities โข 5G networks & Starlink โข Put an edge PoP right on the base station โข Low-latency compute across the street โข Edge PoPs in retail stores (yes really) โข 90% of Americans live <16km from a Walmart โข Walmart has lots of floor space โข Add servers to Walmart = Walmart Edge
A New Environment Low Latency ๐
Low Latency ๐ Latency is a Physical Barrier ๐ง โข Speed of light / speed of causality โข <40ms = edge dominates โข 8ms is ideal โข Ultra Reliable Low Latency (URLLC)
Low Latency ๐ Latency is a Physical Barrier ๐ง โข Speed of light / speed of causality โข <40ms = edge dominates โข 8ms is ideal โข Ultra Reliable Low Latency (URLLC) f Source: Ericsson http://cscn2017.ieee-cscn.org/ iles/2017/08/Janne_Peisa_Ericsson_CSCN2017.pdf
Low Latency ๐ Spherical Cow Assumption ๐ฎ โข No compute, straight line, in a vacuum, guaranteed delivery, etc โข 40ms โข Sรฃo Paulo โก NYC, Vancouver, Stockholm โข Sรฃo Paulo โ Sidney, Tokyo, Seoul Credit: Keenan Crane http://www.cs.cmu.edu/~kmcrane/Projects/ModelRepository/
Low Latency ๐ Spherical Cow Assumption ๐ฎ โข No compute, straight line, in a vacuum, guaranteed delivery, etc โข 40ms โข Sรฃo Paulo โก NYC, Vancouver, Stockholm โข Sรฃo Paulo โ Sidney, Tokyo, Seoul Credit: Keenan Crane http://www.cs.cmu.edu/~kmcrane/Projects/ModelRepository/
Low Latency ๐ What 8ms Looks Like
Low Latency ๐ What 8ms Looks Like Montevideo โก Rio de Janeiro Ideal Vacuum
Low Latency ๐ What 8ms Looks Like Montevideo โก Rio de Janeiro Ideal Vacuum Brasilia ๐ Salvador Ideal Vacuum
Low Latency ๐ What 8ms Looks Like Montevideo โก Rio de Janeiro Ideal Vacuum Brasilia ๐ Salvador Ideal Vacuum Brasilia ๐ Barreiras Ideal Fiber
Low Latency ๐ Causal Islands ๐๐
Low Latency ๐ Causal Islands ๐๐
Low Latency ๐ Causal Islands ๐๐
Low Latency ๐ Causal Islands ๐๐
Low Latency ๐ Light Cone & Relativistic Ordering
Low Latency ๐ Light Cone & Relativistic Ordering Source: Duesentrieb via Wikimedia Commons
Turning Up High Volume ๐
High Volume ๐ Unprecedented Volume ๐ฆ โข We have high scale NOW? Only more devices & usage in the future! โข Sensors everywhere: IoT devices, continuous health data โข Geospatial data (e.g. autonomous vehicles, XR)
High Volume ๐ Feedback Cycle Source: Microsoft โข Remote surgery โข Extended reality โข Location transparency โข Competitive cloud gaming Source: YouTube, South China Morning Post โข Realtime manufacturing โข Continuous ML training Source: Google & Bungie
Sensor data explosion will kill the cloud. Sensors will produce massive amounts of data, but the existing infrastructure will not be able to handle the volumes or the rates [โฆ] We are absolutely going to return to a peer-to-peer computing model [โฆ] not unlike the distributed computing model We are going to move to a world of data-centric programming. ~ a16z, โThe End of Cloud Computingโ
High Volume ๐ Edge Absorbs Cloud (and MEC)
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐คณ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐คณ ๐ผ ๐พโ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐คณ ๐ผ ๐พโ ๐ข ๐พโ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐คณ ๐ฐ ๐ฐ ๐ผ ๐ข ๐พโ ๐พโ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐ฐ ๐คณ ๐ผ ๐พโ ๐ฐ ๐ฐ ๐ข โ ๐พโ ๐พโ โ ๐พ โ ๐พ โ ๐พ ๐พโ โ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐ฐ Local ๐คณ First ๐ผ ๐พโ ๐ฐ ๐ฐ ๐ข โ ๐พโ ๐พโ โ ๐พ โ ๐พ โ ๐พ ๐พโ โ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐ฐ Local ๐คณ First Realtime, Storage, Caching, OLTP ๐พโ ๐ผ ๐ฐ ๐ฐ ๐ข โ ๐พโ ๐พโ โ ๐พ โ ๐พ โ ๐พ ๐พโ โ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐ฐ Local ๐คณ First Realtime, Storage, Caching, OLTP ๐พโ ๐ผ ๐ฐ Relay, Replication, Consistency, Tasks ๐ข ๐พโ ๐ฐ โ ๐พโ โ ๐พ โ ๐พ โ ๐พ ๐พโ โ
High Volume ๐ Edge Absorbs Cloud (and MEC) ๐ฐ Local ๐คณ First Realtime, Storage, Caching, OLTP ๐พโ ๐ผ ๐ฐ Relay, Replication, Consistency, Tasks ๐ข ๐พโ ๐ฐ โ Aggregation, Batching, Training, โ ๐พ โ ๐พ OLAP ๐พโ โ ๐พ ๐พโ โ
What does this all mean? Consequence ๐ธ
Consequence ๐ธ New Assumptions, New Approach
Consequence ๐ธ New Assumptions, New Approach โข New features naturally fall out of the architecture โข Recognize that weโre increasingly connected/networked โข Local-first means network e cient (in the normal case) ffi โข Data can run anywhere = commons networks
Consequence ๐ธ Tackling the Fallacies
Consequence ๐ธ Tackling the Fallacies Latency is zero Bandwidth is infinite Transport cost is zero The network is secure There is one administrator The network is reliable The network is homogeneous Topology doesnโt change
Consequence ๐ธ Tackling the Fallacies Latency is zero Bandwidth is infinite Transport cost is zero The network is secure There is one administrator The network is reliable The network is homogeneous Topology doesnโt change We need to handle 100% of these up front
Consequence ๐ธ Tackling the Fallacies Latency is zero Treat latency directly (speed of causality) Treat (order of causality / relativistic) Bandwidth is infinite Apps continue to work with zero bandwidth Only push when & what needed Transport cost is zero Minimize network use The network is secure Assume that the pipes are broken Direct access control There is one administrator Fine grained, delegate capabilities (OCAP) The network is reliable Time, delivery, & order independence The network is homogeneous Device agnostic Topology doesnโt change atomic unit is the edge device (same like the atomic unit is the actor)
Consequence ๐ธ Giving Up Topological Control
Consequence ๐ธ Giving Up Topological Control โ ๐ฅ ๐ฑ ๐ ๐ฑ ๐ผ ๐ฑ ๐ป ๐ฑ ๐ ๐ฐ
Consequence ๐ธ Data, Data, Data ๐พ
Consequence ๐ธ Data, Data, Data ๐พ โข Only UI & data are essential
Consequence ๐ธ Data, Data, Data ๐พ โข Only UI & data are essential โข New primitives โข Consistency (CRDTs, STM, Distributed Datalog) โข State transfer โก state synchronization โก state views
Consequence ๐ธ Data, Data, Data ๐พ โข Only UI & data are essential โข New primitives โข Consistency (CRDTs, STM, Distributed Datalog) โข State transfer โก state synchronization โก state views โข Access control needs to be inherent โข OCAP & CBC methods (AKA cryptography)
Part II On the Edge ๐ง
On the Edge ๐ง Why Functional Programming โข Data-oriented โข Pure functions on data is just data โข Shared nothing architectures โข Immutability, easy concurrency โข Manage complexity by being declarative โข What > how โข Data > process
On the Edge ๐ง Why the BEAM Specifically โข Low conceptual distance from actor model to OCAP โข Community experience with distributed systems โข Used to building up complexity from simple parts โข Weโre already using a bunch of this! โข e.g. Phoenix Presence ๐ ๐ ๐
Whatโs special about Phoenixโs implementation is we have a system that applies cutting edge CS research to tackle day-to-day problems in the applications we all write. Phoenix Presence - has no single point of failure - has no single source of truth - relies entirely on the standard library with no operational dependencies - self heals ~ Chris McCord, โWhat Makes Phoenix Presence Specialโ
What if we turn Phoenix Live View Upside Down? ๐
On the Edge ๐ง Phoenix LiveView
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ ๐
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ ๐ฅ ๐พ
On the Edge ๐ง Phoenix LiveView Users ๐จ๐ซ๐ฉ๐ญ๐งโ๐ท Client ๐ฅ ๐พ๐พ๐พ๐พ ๐ โ โ WSS / REST / GraphQL โ Controller Logic โ Data Store ๐ DevOps ๐ค Developer ๐ฉ๐ป ๐ฅ ๐พ ๐ฅ ๐พ
On the Edge ๐ง Upside Down โ ๐ฅ ๐๐พ ๐พ๐พ๐พ ๐ฅ ๐พ๐พ
Itโs all about the Data, Data, Data ๐
Data dominates. If youโve chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming. Rob Pike, 5 Rules of Programming
Itโs All About the Data ๐ f Problems! Property Consequence Run anywhere No process in charge of access control Casual islands Inconsistent views of data (or downtime) Unstable topology No consistent connections Local irst In accessible, no replicas
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ โข If network partition (P) โข Choose between: โข Availability (A) โ Local-first & uptime โข Consistency (C)
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ C โข If network partition (P) โข Choose between: โข Availability (A) โ Local-first & uptime โข Consistency (C) A
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ C โข If network partition (P) โข Choose between: P โข Availability (A) โ Local-first & uptime โข Consistency (C) A
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ C โข If network partition (P) โข Choose between: P โข Availability (A) โ Local-first & uptime โข Consistency (C) โข Else (E) when running normally: โข Choose between: โข Latency (L) โ โข Consistency (C) A
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ C โข If network partition (P) โข Choose between: P โข Availability (A) โ Local-first & uptime E โข Consistency (C) โข Else (E) when running normally: โข Choose between: โข Latency (L) โ โข Consistency (C) A L
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ C โข If network partition (P) โข Choose between: P โข Availability (A) โ Local-first & uptime E โข Consistency (C) โข Else (E) when running normally: โข Choose between: โข Latency (L) โ โข Consistency (C) A L
Itโs All About the Data ๐ CAP โก PACELC ๐ฆ๐ฆ C โข If network partition (P) โข Choose between: P โข Availability (A) โ Local-first & uptime E โข Consistency (C) โข Else (E) when running normally: โข Choose between: โข Latency (L) โ โข Consistency (C) A L PA/EL
Itโs All About the Data ๐ Mutable Content โข Predominantly single-source (per file) server/client โข %{node_id => %{path => content}} โข DNS maps names to IP addresses โข PIDs associate processes with numbers โข e.g. send(:example@42.123.45.6, :ping) โข Focused on the physical network โข Referential opacity ff โข Calling same PID often will return di erent data
Itโs All About the Data ๐ Mutable Content โข Predominantly single-source (per file) server/client โข %{node_id => %{path => content}} โข DNS maps names to IP addresses โข PIDs associate processes with numbers โข e.g. send(:example@42.123.45.6, :ping) โข Focused on the physical network โข Referential opacity ff โข Calling same PID often will return di erent data V I R T UA L A D D R E S S P H Y S I C A L L O C AT I O N
Itโs All About the Data ๐ Consistent Keys โข A layer of abstraction above location โข %{hash(content) => content} โข Hash AKA โcontent identifierโ or CID โข Special โuniversalโ relationship to content โข Focused on the data โข Stored anywhere, same ID โข E cient caching โข Immutable data++ ffi โข Not just consistent pointers; consistent data V I R T UA L A D D R E S S P H Y S I C A L L O C AT I O N
Itโs All About the Data ๐ Consistent Keys โข A layer of abstraction above location โข %{hash(content) => content} CONTENT ID โข Hash AKA โcontent identifierโ or CID โข Special โuniversalโ relationship to content โข Focused on the data โข Stored anywhere, same ID โข E cient caching โข Immutable data++ ffi โข Not just consistent pointers; consistent data V I R T UA L A D D R E S S P H Y S I C A L L O C AT I O N
Itโs All About the Data ๐ Hash-Based Relationships
Itโs All About the Data ๐ Hash-Based Relationships (CID ~ Data PID) { Qm123456โฆ: { data: nil, links: [ {name: โcompanyโ, hash: Qmabcdefโฆ} {name: โlicenseโ, hash: Qmzyxwvuโฆ} ] } }
Itโs All About the Data ๐ Hash-Based Relationships (CID ~ Data PID) { { Qm123456โฆ: { data: nil, links: [ {name: โcompanyโ, hash: Qmabcdefโฆ} {name: โlicenseโ, hash: Qmzyxwvuโฆ} ] } } Qmabcdefโฆ: { data: โFissionโ, links: [ {name: โcityโ, hash: Qm1gb5snโฆ}, {name: โaboutโ, hash: Qmzyxwvuโฆ} ] } }
Itโs All About the Data ๐ Hash-Based Relationships (CID ~ Data PID) { { Qm123456โฆ: { data: nil, links: [ {name: โcompanyโ, hash: Qmabcdefโฆ} {name: โlicenseโ, hash: Qmzyxwvuโฆ} ] } } Qmabcdefโฆ: { data: โFissionโ, links: [ {name: โcityโ, hash: Qm1gb5snโฆ}, {name: โaboutโ, hash: Qmzyxwvuโฆ} ] } } Qm123456โฆ/company/about/ceo => โBoris Mannโ
Itโs All About the Data ๐ Content IDs Are Easy [no network version]
Itโs All About the Data ๐ Partial Dependencies
Itโs All About the Data ๐ Partial Dependencies t
Itโs All About the Data ๐ Partial Dependencies t
Itโs All About the Data ๐ Partial Dependencies t
Itโs All About the Data ๐ Partial Dependencies t
Itโs All About the Data ๐ Partial Dependencies t
Itโs All About the Data ๐ This all worksโฆ
Itโs All About the Data ๐ Associative
Itโs All About the Data ๐ Out of Order Delivery ๐ โ ๐ง โ ๐ง ๐ ๐
Itโs All About the Data ๐ Out of Order Delivery ๐ โ ๐ง โ ๐ง ๐ ๐
Itโs All About the Data ๐ Commutative Monoid (AKA Minimal CRDT)
Itโs All About the Data ๐ Commutative Monoid (AKA Minimal CRDT) Sibling / Concurrent
Itโs All About the Data ๐ PNCounter
Itโs All About the Data ๐ PNCounter
Itโs All About the Data ๐ PNCounter
Itโs All About the Data ๐ PNCounter
Itโs All About the Data ๐ PNCounter
The Age of Decentralized Systems ๐
Decentralized Systems ๐ Scale Curve Adapted from http://www.perfdynamics.com/Manifesto/USLscalability.html
Decentralized Systems ๐ Scale Curve Linear Ideal Adapted from http://www.perfdynamics.com/Manifesto/USLscalability.html
Decentralized Systems ๐ Scale Curve Linear Ideal Amdahlโs Law Adapted from http://www.perfdynamics.com/Manifesto/USLscalability.html
Decentralized Systems ๐ Scale Curve Linear Ideal Amdahlโs Law Data Contention Adapted from http://www.perfdynamics.com/Manifesto/USLscalability.html Universal Scaling Law
Decentralized Systems ๐ Scale Curve ๐คฏ Linear Ideal Shared Adaptive Memoization (โTheoretical) Amdahlโs Law Data Contention Adapted from http://www.perfdynamics.com/Manifesto/USLscalability.html Universal Scaling Law
Decentralized Systems ๐ Conflict Free Effects ๐๐งฑ Side Effect Stream Pure Effect Stream Pure Function Stream Base Event Stream
Decentralized Systems ๐ Conflict Free Effects ๐๐งฑ Side Effect Stream Pure Effect Stream Pure Function Stream Base Event Stream t
Decentralized Systems ๐ GenEffect ๐
Decentralized Systems ๐ Different Clients ~ Schema Drift Source: Project Cambria, Ink & Switch https://www.inkandswitch.com/cambria.html
Secure Decentralized Data Access Fixing the Leaky Pipes ๐ฟ
Fixing the Leaky Pipes ๐ฟ Object Capability Model (OCAP)
Fixing the Leaky Pipes ๐ฟ Object Capability Model (OCAP) โข ACL is โreactive authโ / OCAP is โproactive authโ
Fixing the Leaky Pipes ๐ฟ Object Capability Model (OCAP) โข ACL is โreactive authโ / OCAP is โproactive authโ โข OCAP contains all the info about access
Fixing the Leaky Pipes ๐ฟ Object Capability Model (OCAP) โข ACL is โreactive authโ / OCAP is โproactive authโ โข OCAP contains all the info about access โข Generally some reference, proof, or key โข โฆnot unlike having a PID โข Rights to anything directly created (parenthood) โข The right to delegate subset of access to another (introduction)
Fixing the Leaky Pipes ๐ฟ Object Capability Model (OCAP) โข ACL is โreactive authโ / OCAP is โproactive authโ โข OCAP contains all the info about access โข Generally some reference, proof, or key โข โฆnot unlike having a PID โข Rights to anything directly created (parenthood) โข The right to delegate subset of access to another (introduction) โข Long history (e.g. X.509, SDSI, SPKI, Macaroons)
Fixing the Leaky Pipes ๐ฟ 3rd-Party Subdelegation & Attenuation
Fixing the Leaky Pipes ๐ฟ 3rd-Party Subdelegation & Attenuation ๐ฅ
Fixing the Leaky Pipes ๐ฟ 3rd-Party Subdelegation & Attenuation ๐ฅ โ
Fixing the Leaky Pipes ๐ฟ 3rd-Party Subdelegation & Attenuation ๐ฅ ๐ โ
Fixing the Leaky Pipes ๐ฟ 3rd-Party Subdelegation & Attenuation ๐ฅ ๐ โ ๐
Fixing the Leaky Pipes ๐ฟ 3rd-Party Subdelegation & Attenuation ๐ฅ ๐ โ 2โฃ ๐
Fixing the Leaky Pipes ๐ฟ Direct Access Control โขAdvantages โขProactive โขProactive โขWorks o ine โขRevocation โขAttenuation โขGive up (more) access stats โขEasy to understand rules โขUser control (GDPR, CCPA) โขInteroperable ffl โขChallenges
Fixing the Leaky Pipes ๐ฟ Hierarchal Read Access
Fixing the Leaky Pipes ๐ฟ Cryptree ๐ JSON Binary Encrypted Node ๐ AES256 + ๐ Virtual Node = Index ๐ ๐ Metadata ๐
Fixing the Leaky Pipes ๐ฟ Cryptree Sketch โ
Fixing the Leaky Pipes ๐ฟ Cryptree Sketch โ Local stateful, remote stateless
How to Do O ine & Distributed Auth ffl Universal Auth & ID ๐
Universal Auth & ID ๐ Universal IDs
Universal Auth & ID ๐ Universal IDs โข W3C, DIF, Microsoft
Universal Auth & ID ๐ Universal IDs โข W3C, DIF, Microsoft โข Based on public-key cryptography
Universal Auth & ID ๐ Universal IDs โข W3C, DIF, Microsoft โข Based on public-key cryptography โข Truly โuniversalโ user IDs
Universal Auth & ID ๐ Universal IDs โข W3C, DIF, Microsoft โข Based on public-key cryptography โข Truly โuniversalโ user IDs โข Agnostic about backing
Universal Auth & ID ๐ Universal IDs โข W3C, DIF, Microsoft โข Based on public-key cryptography โข Truly โuniversalโ user IDs โข Agnostic about backing โข For users, devices, and more
Universal Auth & ID ๐ JWT Encoded
Universal Auth & ID ๐ JWT Encoded
Universal Auth & ID ๐ JWT Encoded
Universal Auth & ID ๐ Auth Chaining
Universal Auth & ID ๐ OAuth vs UCAN Sequence
Universal Auth & ID ๐ OAuth vs UCAN Sequence
Universal Auth & ID ๐ OAuth vs UCAN Sequence (Verifiable & user originated)
Universal Auth & ID ๐
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ Service B ๐ User
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User ff UCAN with ๐ ID / email Describes o er for ๐ค
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค ff OIDC Login
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login ff OIDC Token
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login OIDC Token ff ff O er for ๐ค+๐ Secured with signature ๐ฝ and HMAC ๐๐
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login OIDC Token O er for ๐ค+๐ Secured with signature ๐ฝ and HMAC ๐๐ ff ff ๐โs OIDC token?
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login OIDC Token O er for ๐ค+๐ Secured with signature ๐ฝ and HMAC ๐๐ ๐โs OIDC token? ff ff ๐โs OIDC token!
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login OIDC Token O er for ๐ค+๐ Secured with signature ๐ฝ and HMAC ๐๐ ๐โs OIDC token? ๐โs OIDC token! ff ff Check ๐ HMAC and ๐ฝ signature
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค Service A ๐ฝ ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login OIDC Token O er for ๐ค+๐ Secured with signature ๐ฝ and HMAC ๐๐ ๐โs OIDC token? ๐โs OIDC token! Check ๐ HMAC and ๐ฝ signature ff ff Update ๐ค subscription for ๐
Universal Auth & ID ๐ ๐ External OIDC Server ๐ค ๐ฝ Service A ๐ Service B User UCAN with ๐ ID / email Describes o er for ๐ค OIDC Login OIDC Token O er for ๐ค+๐ Secured with signature ๐ฝ and HMAC ๐๐ ๐โs OIDC token? ๐โs OIDC token! Check ๐ HMAC and ๐ฝ signature Update ๐ค subscription for ๐ ff ff 204 Accepted
Summary ๐ฑ
Instead of immediately asking โwhich database would be best to hold presences?โ, we could ask โhow can we best replicate data in a distributed system without the user having to worry about it?โ. The platforms you build on top of drive the design decisions you make in your products. With Elixir, you are empowered to tackle problems that in other platforms would feel impossible to solve without tradeoffs with heavy dependencies. ~ Chris McCord, What Makes Phoenix Presence Special
Getting Ready ๐ฑ Data > Compute โข Focus on data & structure โข Clarify โrealโ dependencies on data โข Start thinking about the properties in your code โข Adopt OCAP โข Use abstraction for declarative interfaces
๐ง๐ท Thank You, CodeBEAM BR ๐ brooklyn@fission.codes https://fission.codes github.com/expede @expede
The BEAM is exceptional for distributed systems, concurrency, and soft-realtime workloads. This makes it a wonderful fit for the cloud computing era of the past decade, but whatโs next? Network assumptions are changing for the first time in 20+ years: new technologies like StarLink and 5G are leading to a shift in edge and low-latency computing. To handle the new causal limits and bumping into the speed of light, we will need to be able to grapple with multiple sources of truth, leverage commons networks & dynamic swarms, and allow for the movement of compute to data. In this keynote, Brooklyn will share some R&D being done at Fission and elsewhere for edge- and local-first computing, a few techniques that you can apply today for distributed computing, and vision for how Elixir can position itself as the premier ecosystem for this developing era.