Distributed Async Await: A New Programming Model for the Cloud

ScyllaDB 355 views 42 slides Oct 15, 2024
Slide 1
Slide 1 of 42
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42

About This Presentation

Dive into the future of cloud dev with Distributed Async Await. Simplify your code and conquer the chaos of distributed systems. Learn the ins and outs of async-await, functions, promises, and more. Transform your approach to scalable, reliable, and delightful cloud apps. 🚀 #CloudDev #AsyncAwait


Slide Content

A ScyllaDB Community
Distributed Async Await
Dominik Tornow
Founder & CEO of Resonate HQ

Resonate HQ
Dominik Tornow
Founder & CEO at Resonate HQ, Inc
■Began my career in Silicon Valley in 2006
■Focus on concurrent, distributed systems
■Distributed Async Await by day
■Think Distributed Systems by night

Space
Time

Space

Time

Concurrency
P | Q

Distribution
P | Q | ⚡

P = a • b • c
Q = x • y • z

a • b • c • x • y • z
a • b • x • c • y • z
a • b • x • y • c • z
a • b • x • y • z • c
a • x • b • c • y • z
a • x • b • y • c • z
a • x • b • y • z • c
a • x • y • b • c • z
a • x • y • b • z • c

a
x
a • b
a • x
x • a
x • y
a • b • c
a • b • x
a • x • b

(P | Q | ⚡) ≡ (P • Q) ∨ (Q • P)

" #
Concurrency Partial Order Coordination
Distribution Partial Failure Recovery

Distributed Async Await
Dead Simple Distributed Systems

Dead Simple to Understand
Dead Simple to Develop
Dead Simple to Operate

Formalization of
Concurrent Structure
Formalization of
Recovery
Async Await local no
Distributed
Async Await
global yes

Express
concurrent and distributed structure
Distributed Programming Model
Execute
concurrent and distributed structure
Distributed Execution Model

async function downloadAndSummarizeUrls(urls: string[]) {
return Promise.all(urls.map(u => downloadAndSummarizeUrl(u)));
}
async function downloadAndSummarizeUrl(url: string) {
let content = await download(url);
let summary = await summarize(content);
return summary;
}

Execution
Execution
Promise
Promise
Promise
ExecutionPromise
ExecutionPromise
Promise Execution
ExecutionPromise
Execution

async function downloadAndSummarizeUrls(context : Context, urls: string[]) {
return Promise.all(urls.map(u => context.rfc(downloadAndSummarizeUrl, u)));
}
async function downloadAndSummarizeUrl(context : Context, url: string) {
let content = await context.lfc(download, url);
let summary = await context.lfc(summarize, content);
return summary;
}

Execution
Execution
Promise
ID
Promise
ID
Promise
ID
Execution
Promise
ID
Execution
Promise
ID
Promise
ID
Execution
Execution
Promise
ID
Execution

Execution
Execution
Promise
ID
Promise
ID
Promise
ID
Execution
Promise
ID
Execution
Promise
ID
Promise
ID
Execution
Execution
Promise
ID
Execution

Execution
Execution
Promise
ID
Promise
ID
Promise
ID
Execution
Promise
ID
Execution
Promise
ID
Promise
ID
Execution
Execution
Promise
ID
Execution

Functions & Promises
Distributed Programming Model

Function
Execution
Promise
Function
Execution
Promise
Caller Calleeinvokes
awaits

Function
Execution
Promise
Function
Execution
Promise
Caller Calleeinvokes
awaits
Unique IdentifierUnique Identifier

Architecture Overview
Distributed Execution Model

Execution Execution
Execution ExecutionExecutionExecution
Resonate
Server
Node nNode 1
Execution
λ1.1
Execution
λ1.n
Execution
λn.1
Execution
λn.n
Resonate SDK Resonate SDK
Application Layer
Distributed Application
Platform Layer
Distributed Runtime
Promise
π1.1
Promise
π1.n
Promise
πn.1
Promise
πn.n

Execution Execution
Execution ExecutionExecutionExecution
Resonate
Server
Node nNode 1
Execution
λ1.1
Execution
λ1.n
Execution
λn.1
Execution
λn.n
Resonate SDK Resonate SDK
Application Layer
Distributed Application
Platform Layer
Distributed Runtime
Promise
π1.1
Promise
π1.n
Promise
πn.1
Promise
πn.n

Execution Execution
Execution ExecutionExecutionExecution
Node nNode 1
Execution
λ1.1
Execution
λ1.n
Execution
λn.1
Execution
λn.n
Resonate SDK Resonate SDK
Application Layer
Distributed Application
Platform Layer
Distributed Runtime
Promise
π1.1
Promise
π1.n
Promise
πn.1
Promise
πn.n
Resonate
Server

Execution Execution
Execution ExecutionExecutionExecution
Resonate
Server
Node nNode 1
Execution
λ1.1
Execution
λ1.n
Execution
λn.1
Execution
λn.n
Resonate SDK Resonate SDK
Application Layer
Distributed Application
Platform Layer
Distributed Runtime
Promise
π1.1
Promise
π1.n
Promise
πn.1
Promise
πn.n

Execution Execution
Execution ExecutionExecutionExecution
Resonate
Server
Node n
Execution
λ1.1
Execution
λ1.n
Execution
λn.1
Execution
λn.n
Resonate SDK Resonate SDK
Application Layer
Distributed Application
Platform Layer
Distributed Runtime
Promise
π1.1
Promise
π1.n
Promise
πn.1
Promise
πn.n
Node 1

Execution Execution
Execution ExecutionExecutionExecution
Resonate
Server
Node n
Execution
λ1.1
Execution
λ1.n
Execution
λn.1
Execution
λn.n
Resonate SDK Resonate SDK
Application Layer
Distributed Application
Platform Layer
Distributed Runtime
Promise
π1.1
Promise
π1.n
Promise
πn.1
Promise
πn.n
Node 1

Distributed Event Loop Protocol
Distributed Execution Model

Caller Callee
Caller Callee
invoke function
return promise
await
return

Caller Promise
Caller Promise
invoke function
return promise
await
resume
Callee
Callee
register callback
return
invoke

Caller Server CalleeSDK SDK
create promise
invoke function
await
register callback
register callback
send invoke
invoke
return
complete promise
send resume
resume

Distributed Task Protocol
Distributed Async Await

Server Transport App Node
Server Transport App Node
claim url
claim url
claim
task
heartbeat
ack
complete
ack

Resonate HQ
Thank you! Let’s connect.
Dominik Tornow
[email protected]
@DominikTornow
https://resonatehq.io
Tags