SlideShare a Scribd company logo
Distributed Systems
vs.
Compositionality
Dr. Roland Kuhn
@rolandkuhn — CTO of Actyx
Caveat:
This presentation shows unreleased APIs!
Weird starting point:
π calculus
What is a calculus?
• syntax for writing down a computation
• reduction rules for evaluating the syntax
4
π calculus: the syntax
5
Robin Milner et al, 1992
⇡ ::=
8
><
>:
x(y) receive y along x
xhyi send y along x
⌧ unobservable action
(1)
P ::=
X
i2I
⇡i.Pi P1|P2 new a P !P 0 (2)
π calculus: the reductions
6
TAU : ⌧.P + M ! P (3)
REACT : x(y).P + M xhzi.Q + N ! z/y P Q (4)
PAR :
P ! P0
P|Q ! P0|Q
(5)
RES :
P ! P0
new x P ! new x P0
(6)
STRUCT :
P ! P0
Q ! Q0
if P ⌘ Q ^ P0
⌘ Q0
(7)
Robin Milner et al, 1992
An example reduction
7
P = new z
⇣
(xhyi.0 + z(w).whyi.0) x(u).uhvi.0 xhzi.0
⌘
possibility	1
possibility	2
An example reduction
8
P = new z
⇣
0 yhvi.0 xhzi.0
⌘
An example reduction
9
P = new z
⇣
(xhyi.0 + z(w).whyi.0) x(u).uhvi.0 xhzi.0
⌘
possibility	2
An example reduction
10
P = new z
⇣
(xhyi.0 + z(w).whyi.0) zhvi.0 0
⌘
only	one	possibility
An example reduction
11
P = new z
⇣
vhyi.0 0 0
⌘
An example reduction
12
P = vhyi.0
There’s more!
• structural congruence allows symbolic
manipulation
• rename, reorder sums, expand recursion, …
• bi-simulation describes functional equivalence
13
So, what is a calculus?
• a way to write down computations
• a means to reason about computations
• a tool to compose computations
14
Composition
Composition in the π calculus
• you can
• run computations sequentially
• run computations concurrently
• synchronize concurrent computations
16
Composing processes
17
new cA
⇣
Pclient PserviceA
⌘
channel	where	
serviceA	is	reachable
will	send	to	cA	and	
eventually	react	to	
response
will	react	to	cA	and	
eventually	send	back	
a	response
We need protocols!
What is a protocol?
• defines a communication discipline:
• who can send what kind of message, and when
• which kinds of message to expect, and when
• each distributed process must adhere to the
common protocol
• a global protocol can be checked for safety
19
Session types
• Session: a unit of conversation
• Session Type: the structure of a conversation,

a sequence of interactions in a

communication-centric program model
• originally only binary sessions,

multiparty session types introduced 2008
• primitives are

sending, receiving, sequence, choice, recursion



20
http://groups.inf.ed.ac.uk/abcd/
Session types example
21
Sreqresp = !Request(params) . ?Response(result)
Sreqresp = ?Request(params) . !Response(result)
But is it safe? Does it compose?
22
Pclient PserviceA PbackendA
PserviceB PbackendB
Protocols don’t compose!
• at least not in general, as far as we know
• some cases are (mostly?) okay
• non-cyclic
• non-interacting
• what a bummer!

⟹ let’s find a smaller problem to solve
23
Composing Actor Behavior
Behavior composition
25
new cinternal
⇣
PserviceA PclientB
⌘
26
case class DoStuff(stuff: Stuff)
case class DoIt(it: It)
case class DoneSuccessfully(result: Result)
class MyActor(receptionist: ActorRef) extends Actor {
override def preStart(): Unit = receptionist ! Register
def receive = initializing
def initializing: Receive = {
case Registered =>
// do stuff
context.become(running)
}
def running: Receive = {
case DoStuff(stuff) =>
context.actorOf(Props[Child]) ! DoIt(???)
context.become(waitingForResult(stuff))
}
def waitingForResult(stuff: Stuff): Receive = {
case DoneSuccessfully(result) =>
// do stuff, e.g. replying
context.become(running)
}
}
We need reusable composable
behavior snippets!
Radical idea: π calculus within!
• idea sparked while listening to Alex Prokopec
• create DSL inspired by π calculus
• lifted representation of asynchronous actions
• combinators for sequential & parallel composition
28
What does it look like?
29
π calculus Akka Typed Sessions
new c P val serverChannel = channel[Command](128)
P initialize: Process[ActorRef[Request]]
π.P for {

backend ← initialize

server ← register(backend)

} yield run(server, backend)
P|Q fork(task): Process[Unit]

read(serverChannel) race timeout(1.second)

getThingA join getThingB
x(y) read(serverChannel): Process[Command]
x❬y❭ serverChannel.ref ! msg

(synchronous send operation not there, yet)
Example of a Server Process
30
def run(server: Channel[ServerCommand],
backend: ActorRef[BackendCommand])
: Process[Nothing] =
for {
cmd ← read(server)
} yield cmd match {
case GetIt(which, replyTo) =>
val spinOff =
talkWithBackend(which, backend)
.foreach(thing => replyTo ! GotIt(thing.weird))
fork(spinOff race timeout(5.seconds))
.then(run(server, backend))
}
Example of a Server Process
31
def talkWithBackend(which: String,
backend: ActorRef[BackendCommand])
: Process[TheThing] = {
val code = channel[Code](1)
val thing = channel[TheThing](1)
backend ! GetThingCode(0xdeadbeefcafeL, code.ref)
for {
c ← readAndSeal(code)
} yield {
c.magicChest ! GetTheThing(which, thing.ref)
readAndSeal(thing)
}
}
What does this have to do with Akka?
• Akka Typed Behavior to interpret Process
• channel reference is a lean child ActorRef
• this closes the gap between the Actor Model
and CSP/π
• Actors have stable identity but only one channel
• anonymous Processes have multiple channels

(with identity)
32
Outlook
Tracking effects
• lifted representation of Process allows
tracking of effects
• embedding of session type in π calculus exists
• verify Process against a session type
34
Irresponsible Speculation
35
// Effects is similar to HList (but a tree)
trait Process[T, E <: Effects] {
def map[U, UE <: Effects](f: T => Process[U, UE])
:Process[U, UE :*: E]
def join[U, UE <: Effects](p: Process[U, UE])
:Process[(T, U), UE :+: E]
def race // ???
}
def read[T](c: Channel[T]): Process[T, Recv[c.type]]
def write[T](ref: ActorRef[T]): Process[T, Send[ref.type]]
def fork[T, TE <: Effects](p: Process[T, TE])
: Process[Unit, NoEffect :|: TE]
Current State
• behaviors can be composed both sequentially
and concurrently
• effects are not yet tracked
• Scribble generator for Scala not yet there
• theoretical work at Imperial College, London

(Prof. Nobuko Yoshida & Alceste Scalas)
36
©Actyx AG 2016 – All Rights Reserved

More Related Content

What's hot

Introduction to Akka-Streams
Introduction to Akka-StreamsIntroduction to Akka-Streams
Introduction to Akka-Streams
dmantula
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
Rick Warren
 
Principles in Data Stream Processing | Matthias J Sax, Confluent
Principles in Data Stream Processing | Matthias J Sax, ConfluentPrinciples in Data Stream Processing | Matthias J Sax, Confluent
Principles in Data Stream Processing | Matthias J Sax, Confluent
HostedbyConfluent
 
Distributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsDistributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsSteve Pember
 
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Event sourcing  - what could possibly go wrong ? Devoxx PL 2021Event sourcing  - what could possibly go wrong ? Devoxx PL 2021
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Andrzej Ludwikowski
 
Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?
Andrzej Ludwikowski
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
Shiao-An Yuan
 
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Codemotion
 
Stabilising the jenga tower
Stabilising the jenga towerStabilising the jenga tower
Stabilising the jenga tower
Gordon Chung
 
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overviewFlink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward
 
Designing for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive StreamsDesigning for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive Streams
Stéphane Maldini
 
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
confluent
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
ihji
 
Flink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San JoseFlink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San JoseKostas Tzoumas
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
Jobaer Chowdhury
 
Anatomy of an action
Anatomy of an actionAnatomy of an action
Anatomy of an action
Gordon Chung
 
A dive into akka streams: from the basics to a real-world scenario
A dive into akka streams: from the basics to a real-world scenarioA dive into akka streams: from the basics to a real-world scenario
A dive into akka streams: from the basics to a real-world scenario
Gioia Ballin
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
Gal Marder
 
Apache ZooKeeper
Apache ZooKeeperApache ZooKeeper
Apache ZooKeeper
Scott Leberknight
 
Chronix as Long-Term Storage for Prometheus
Chronix as Long-Term Storage for PrometheusChronix as Long-Term Storage for Prometheus
Chronix as Long-Term Storage for Prometheus
QAware GmbH
 

What's hot (20)

Introduction to Akka-Streams
Introduction to Akka-StreamsIntroduction to Akka-Streams
Introduction to Akka-Streams
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
Principles in Data Stream Processing | Matthias J Sax, Confluent
Principles in Data Stream Processing | Matthias J Sax, ConfluentPrinciples in Data Stream Processing | Matthias J Sax, Confluent
Principles in Data Stream Processing | Matthias J Sax, Confluent
 
Distributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsDistributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with Events
 
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Event sourcing  - what could possibly go wrong ? Devoxx PL 2021Event sourcing  - what could possibly go wrong ? Devoxx PL 2021
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
 
Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
 
Stabilising the jenga tower
Stabilising the jenga towerStabilising the jenga tower
Stabilising the jenga tower
 
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overviewFlink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
 
Designing for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive StreamsDesigning for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive Streams
 
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
 
Flink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San JoseFlink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San Jose
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
 
Anatomy of an action
Anatomy of an actionAnatomy of an action
Anatomy of an action
 
A dive into akka streams: from the basics to a real-world scenario
A dive into akka streams: from the basics to a real-world scenarioA dive into akka streams: from the basics to a real-world scenario
A dive into akka streams: from the basics to a real-world scenario
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
Apache ZooKeeper
Apache ZooKeeperApache ZooKeeper
Apache ZooKeeper
 
Chronix as Long-Term Storage for Prometheus
Chronix as Long-Term Storage for PrometheusChronix as Long-Term Storage for Prometheus
Chronix as Long-Term Storage for Prometheus
 

Viewers also liked

Akka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor ModelAkka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor ModelRoland Kuhn
 
Project Gålbma – Actors vs Types
Project Gålbma – Actors vs TypesProject Gålbma – Actors vs Types
Project Gålbma – Actors vs Types
Roland Kuhn
 
Go Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future ApplicationsGo Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future Applications
Roland Kuhn
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Jonas Bonér
 
Semantics
SemanticsSemantics
Semantics
amna-shahid
 
Introduction to natural semanticsmetalanguage
Introduction to natural semanticsmetalanguageIntroduction to natural semanticsmetalanguage
Introduction to natural semanticsmetalanguageGustina Savhira
 
Language and Meta-language for Enterprise Architecture
Language and Meta-language for Enterprise ArchitectureLanguage and Meta-language for Enterprise Architecture
Language and Meta-language for Enterprise Architecture
Ivo Velitchkov
 
Bytheway_Sexist_language_20090604
Bytheway_Sexist_language_20090604Bytheway_Sexist_language_20090604
Bytheway_Sexist_language_20090604
Otago Polytechnic
 
sentence meaning is different from speaker's meaning.-news headlines from dif...
sentence meaning is different from speaker's meaning.-news headlines from dif...sentence meaning is different from speaker's meaning.-news headlines from dif...
sentence meaning is different from speaker's meaning.-news headlines from dif...
Hifza Kiyani
 
Metalanguage
MetalanguageMetalanguage
Metalanguage
Amity Beane
 
Meta Languages
Meta LanguagesMeta Languages
Meta Languages
Liam Dunphy
 
Language
LanguageLanguage
Language
Guido Wachsmuth
 
Client Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right WayClient Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right Way
DataStax Academy
 
Akka cluster overview at 010dev
Akka cluster overview at 010devAkka cluster overview at 010dev
Akka cluster overview at 010devRoland Kuhn
 
Reactive Design Patterns
Reactive Design PatternsReactive Design Patterns
Reactive Design Patterns
Legacy Typesafe (now Lightbend)
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Zalando Technology
 
Chapter 2 grammatical metalanguage
Chapter 2 grammatical metalanguageChapter 2 grammatical metalanguage
Chapter 2 grammatical metalanguageJesullyna Manuel
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
Roland Kuhn
 
2. sales training sales process
2. sales training   sales process2. sales training   sales process
2. sales training sales processEarl Stevens
 

Viewers also liked (20)

Akka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor ModelAkka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor Model
 
Project Gålbma – Actors vs Types
Project Gålbma – Actors vs TypesProject Gålbma – Actors vs Types
Project Gålbma – Actors vs Types
 
Go Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future ApplicationsGo Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future Applications
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
 
Semantics
SemanticsSemantics
Semantics
 
Formal Semantics
Formal SemanticsFormal Semantics
Formal Semantics
 
Introduction to natural semanticsmetalanguage
Introduction to natural semanticsmetalanguageIntroduction to natural semanticsmetalanguage
Introduction to natural semanticsmetalanguage
 
Language and Meta-language for Enterprise Architecture
Language and Meta-language for Enterprise ArchitectureLanguage and Meta-language for Enterprise Architecture
Language and Meta-language for Enterprise Architecture
 
Bytheway_Sexist_language_20090604
Bytheway_Sexist_language_20090604Bytheway_Sexist_language_20090604
Bytheway_Sexist_language_20090604
 
sentence meaning is different from speaker's meaning.-news headlines from dif...
sentence meaning is different from speaker's meaning.-news headlines from dif...sentence meaning is different from speaker's meaning.-news headlines from dif...
sentence meaning is different from speaker's meaning.-news headlines from dif...
 
Metalanguage
MetalanguageMetalanguage
Metalanguage
 
Meta Languages
Meta LanguagesMeta Languages
Meta Languages
 
Language
LanguageLanguage
Language
 
Client Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right WayClient Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right Way
 
Akka cluster overview at 010dev
Akka cluster overview at 010devAkka cluster overview at 010dev
Akka cluster overview at 010dev
 
Reactive Design Patterns
Reactive Design PatternsReactive Design Patterns
Reactive Design Patterns
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
 
Chapter 2 grammatical metalanguage
Chapter 2 grammatical metalanguageChapter 2 grammatical metalanguage
Chapter 2 grammatical metalanguage
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
 
2. sales training sales process
2. sales training   sales process2. sales training   sales process
2. sales training sales process
 

Similar to Distributed systems vs compositionality

Hierarchical free monads and software design in fp
Hierarchical free monads and software design in fpHierarchical free monads and software design in fp
Hierarchical free monads and software design in fp
Alexander Granin
 
Using R in remote computer clusters
Using R in remote computer clustersUsing R in remote computer clusters
Using R in remote computer clusters
Burak Himmetoglu
 
Concur15slides
Concur15slidesConcur15slides
Concur15slides
Andrea Cerone
 
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Ivan Čukić
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculus
Vlad Patryshev
 
Making fitting in RooFit faster
Making fitting in RooFit fasterMaking fitting in RooFit faster
Making fitting in RooFit faster
Patrick Bos
 
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
Iosif Itkin
 
Get Reactive: Microservices, Programming, and Systems
Get Reactive: Microservices, Programming, and SystemsGet Reactive: Microservices, Programming, and Systems
Get Reactive: Microservices, Programming, and Systems
Jeremy Davis
 
Benchmarking and PHPBench
Benchmarking and PHPBenchBenchmarking and PHPBench
Benchmarking and PHPBench
dantleech
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
James Wong
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Harry Potter
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Luis Goldster
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
Fraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Young Alista
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Tony Nguyen
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of Python
Takeshi Akutsu
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of python
Yung-Yu Chen
 
slides.07.pptx
slides.07.pptxslides.07.pptx
slides.07.pptx
balewayalew
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potter
distributed matters
 

Similar to Distributed systems vs compositionality (20)

Hierarchical free monads and software design in fp
Hierarchical free monads and software design in fpHierarchical free monads and software design in fp
Hierarchical free monads and software design in fp
 
Using R in remote computer clusters
Using R in remote computer clustersUsing R in remote computer clusters
Using R in remote computer clusters
 
Concur15slides
Concur15slidesConcur15slides
Concur15slides
 
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculus
 
Making fitting in RooFit faster
Making fitting in RooFit fasterMaking fitting in RooFit faster
Making fitting in RooFit faster
 
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
 
Get Reactive: Microservices, Programming, and Systems
Get Reactive: Microservices, Programming, and SystemsGet Reactive: Microservices, Programming, and Systems
Get Reactive: Microservices, Programming, and Systems
 
Benchmarking and PHPBench
Benchmarking and PHPBenchBenchmarking and PHPBench
Benchmarking and PHPBench
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of Python
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of python
 
slides.07.pptx
slides.07.pptxslides.07.pptx
slides.07.pptx
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potter
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 

Recently uploaded

Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 

Recently uploaded (20)

Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 

Distributed systems vs compositionality

  • 1. Distributed Systems vs. Compositionality Dr. Roland Kuhn @rolandkuhn — CTO of Actyx
  • 4. What is a calculus? • syntax for writing down a computation • reduction rules for evaluating the syntax 4
  • 5. π calculus: the syntax 5 Robin Milner et al, 1992 ⇡ ::= 8 >< >: x(y) receive y along x xhyi send y along x ⌧ unobservable action (1) P ::= X i2I ⇡i.Pi P1|P2 new a P !P 0 (2)
  • 6. π calculus: the reductions 6 TAU : ⌧.P + M ! P (3) REACT : x(y).P + M xhzi.Q + N ! z/y P Q (4) PAR : P ! P0 P|Q ! P0|Q (5) RES : P ! P0 new x P ! new x P0 (6) STRUCT : P ! P0 Q ! Q0 if P ⌘ Q ^ P0 ⌘ Q0 (7) Robin Milner et al, 1992
  • 7. An example reduction 7 P = new z ⇣ (xhyi.0 + z(w).whyi.0) x(u).uhvi.0 xhzi.0 ⌘ possibility 1 possibility 2
  • 8. An example reduction 8 P = new z ⇣ 0 yhvi.0 xhzi.0 ⌘
  • 9. An example reduction 9 P = new z ⇣ (xhyi.0 + z(w).whyi.0) x(u).uhvi.0 xhzi.0 ⌘ possibility 2
  • 10. An example reduction 10 P = new z ⇣ (xhyi.0 + z(w).whyi.0) zhvi.0 0 ⌘ only one possibility
  • 11. An example reduction 11 P = new z ⇣ vhyi.0 0 0 ⌘
  • 13. There’s more! • structural congruence allows symbolic manipulation • rename, reorder sums, expand recursion, … • bi-simulation describes functional equivalence 13
  • 14. So, what is a calculus? • a way to write down computations • a means to reason about computations • a tool to compose computations 14
  • 16. Composition in the π calculus • you can • run computations sequentially • run computations concurrently • synchronize concurrent computations 16
  • 17. Composing processes 17 new cA ⇣ Pclient PserviceA ⌘ channel where serviceA is reachable will send to cA and eventually react to response will react to cA and eventually send back a response
  • 19. What is a protocol? • defines a communication discipline: • who can send what kind of message, and when • which kinds of message to expect, and when • each distributed process must adhere to the common protocol • a global protocol can be checked for safety 19
  • 20. Session types • Session: a unit of conversation • Session Type: the structure of a conversation,
 a sequence of interactions in a
 communication-centric program model • originally only binary sessions,
 multiparty session types introduced 2008 • primitives are
 sending, receiving, sequence, choice, recursion
 
 20 http://groups.inf.ed.ac.uk/abcd/
  • 21. Session types example 21 Sreqresp = !Request(params) . ?Response(result) Sreqresp = ?Request(params) . !Response(result)
  • 22. But is it safe? Does it compose? 22 Pclient PserviceA PbackendA PserviceB PbackendB
  • 23. Protocols don’t compose! • at least not in general, as far as we know • some cases are (mostly?) okay • non-cyclic • non-interacting • what a bummer!
 ⟹ let’s find a smaller problem to solve 23
  • 26. 26 case class DoStuff(stuff: Stuff) case class DoIt(it: It) case class DoneSuccessfully(result: Result) class MyActor(receptionist: ActorRef) extends Actor { override def preStart(): Unit = receptionist ! Register def receive = initializing def initializing: Receive = { case Registered => // do stuff context.become(running) } def running: Receive = { case DoStuff(stuff) => context.actorOf(Props[Child]) ! DoIt(???) context.become(waitingForResult(stuff)) } def waitingForResult(stuff: Stuff): Receive = { case DoneSuccessfully(result) => // do stuff, e.g. replying context.become(running) } }
  • 27. We need reusable composable behavior snippets!
  • 28. Radical idea: π calculus within! • idea sparked while listening to Alex Prokopec • create DSL inspired by π calculus • lifted representation of asynchronous actions • combinators for sequential & parallel composition 28
  • 29. What does it look like? 29 π calculus Akka Typed Sessions new c P val serverChannel = channel[Command](128) P initialize: Process[ActorRef[Request]] π.P for {
 backend ← initialize
 server ← register(backend)
 } yield run(server, backend) P|Q fork(task): Process[Unit]
 read(serverChannel) race timeout(1.second)
 getThingA join getThingB x(y) read(serverChannel): Process[Command] x❬y❭ serverChannel.ref ! msg
 (synchronous send operation not there, yet)
  • 30. Example of a Server Process 30 def run(server: Channel[ServerCommand], backend: ActorRef[BackendCommand]) : Process[Nothing] = for { cmd ← read(server) } yield cmd match { case GetIt(which, replyTo) => val spinOff = talkWithBackend(which, backend) .foreach(thing => replyTo ! GotIt(thing.weird)) fork(spinOff race timeout(5.seconds)) .then(run(server, backend)) }
  • 31. Example of a Server Process 31 def talkWithBackend(which: String, backend: ActorRef[BackendCommand]) : Process[TheThing] = { val code = channel[Code](1) val thing = channel[TheThing](1) backend ! GetThingCode(0xdeadbeefcafeL, code.ref) for { c ← readAndSeal(code) } yield { c.magicChest ! GetTheThing(which, thing.ref) readAndSeal(thing) } }
  • 32. What does this have to do with Akka? • Akka Typed Behavior to interpret Process • channel reference is a lean child ActorRef • this closes the gap between the Actor Model and CSP/π • Actors have stable identity but only one channel • anonymous Processes have multiple channels
 (with identity) 32
  • 34. Tracking effects • lifted representation of Process allows tracking of effects • embedding of session type in π calculus exists • verify Process against a session type 34
  • 35. Irresponsible Speculation 35 // Effects is similar to HList (but a tree) trait Process[T, E <: Effects] { def map[U, UE <: Effects](f: T => Process[U, UE]) :Process[U, UE :*: E] def join[U, UE <: Effects](p: Process[U, UE]) :Process[(T, U), UE :+: E] def race // ??? } def read[T](c: Channel[T]): Process[T, Recv[c.type]] def write[T](ref: ActorRef[T]): Process[T, Send[ref.type]] def fork[T, TE <: Effects](p: Process[T, TE]) : Process[Unit, NoEffect :|: TE]
  • 36. Current State • behaviors can be composed both sequentially and concurrently • effects are not yet tracked • Scribble generator for Scala not yet there • theoretical work at Imperial College, London
 (Prof. Nobuko Yoshida & Alceste Scalas) 36
  • 37. ©Actyx AG 2016 – All Rights Reserved