No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices...

25
No More, No Less A Formal Model for Serverless Computing Maurizio Gabbrielli, Ivan Lanese, Stefano Pio Zingaro INRIA, France / Università di Bologna, Italy Coordination 2019 Saverio Giallorenzo, Fabrizio Montesi, Marco Peressotti University of Southern Denmark, Denmark

Transcript of No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices...

Page 1: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

No More, No LessA Formal Model for Serverless Computing

Maurizio Gabbrielli, Ivan Lanese, Stefano Pio ZingaroINRIA, France / Università di Bologna, Italy

Coordination 2019

Saverio Giallorenzo, Fabrizio Montesi, Marco PeressottiUniversity of Southern Denmark, Denmark

Page 2: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

A gentle introduction to “serverless”...

...

Adapted from “Serverless Architecture Patterns” by Abby Fuller, AWS

Event Source Function Cloud Architecture

Page 3: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

A gentle introduction to “serverless”...

Monolith Microservices Serverless

provisioned, pay-per-deployment

on-demand, pay-per-execution

Page 4: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

A gentle introduction to “serverless”...

Monolith Microservices Serverless

Page 5: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

A gentle introduction to “serverless”...

Monolith Microservices Serverless

?!

Still rougharound theedges

Page 6: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

A gentle introduction to “serverless”...

https://aws.amazon.com/serverless/

Tailor

Page 7: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

A gentle introduction to “serverless”...

https://github.com/alanwill/aws-tailor

Tailor

an excerpt

Page 8: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

… and its current limitations (non-exhaustive)

● Currently ~15’ execution timeout;

● No function-to-function invocation. Functions need an in-between stateful service to call each other;

● Sparse coordination logic.

Page 9: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

… and its current limitations (non-exhaustive)

● Traffic-dependent scaling of functions implies:○ complex cost model;○ complex system load

estimations.

● Poor performance for standard communication patterns

Jonas, Eric, et al. "Cloud Programming Simplified: A Berkeley View on Serverless Computing."

Block Storage

Object Storage

File System

Elastic Database

Memory Store

Function access

Transparent Provisioning

Availability and persistence

Latency

Costs

Page 10: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

… and its current limitations (non-exhaustive)

Lock-in due to absence of standards on:

● function support/execution environments;

● function call semantics;

● semantics of stateful services.

Page 11: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Direction

● We want to study S.C. avoiding any vendor/technology specifics

● We need a formal model for Serverless Computing that

○ Captures current incarnations of S.C.

(e.g. event-based, storage-mediated as in AWS)

○ Supports proposed approaches/features

(e.g. function-to-function invocation, updatable function definitions)

Page 12: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Serverless Kernel Calculus (SKC)

● Systems: ⟨S,𝒟⟩

● Function definitions: f↦M

● Running functions: c◂M

Repository of function definitionsNetwork of running functions

λ-termFunction name

λ-termPromise

Page 13: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Serverless Kernel Calculus (SKC)

● Systems: ⟨S,𝒟⟩

● Function definitions: f↦M

● Running functions: c◂M

Repository of function definitionsNetwork of running functions

λ-termFunction name

λ-termPromise

Page 14: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Serverless Kernel Calculus (SKC)

● Systems: ⟨S,𝒟⟩

● Function definitions: f↦M

● Running functions: c◂M

Repository of function definitionsNetwork of running functions

λ-termFunction name

λ-termPromise

Page 15: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Serverless Kernel Calculus (SKC)

● Systems: ⟨S,𝒟⟩

● Function definitions: f↦M

● Running functions: c◂M

Repository of function definitionsNetwork of running functions

λ-termFunction name

λ-termPromise

Page 16: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

SKC function terms

M ::= M M' ∣ V

∣ f

∣ async M

∣ set f M

∣ take f

V ::= x ∣ λx.M

∣ c

⟨ℰ[async M],𝒟⟩ ⟶ ⟨ℰ[c] ∣ c◂M,𝒟⟩

⟨ℰ[set f M],𝒟⟩ ⟶ ⟨ℰ[f],𝒟[f↦M]⟩

⟨ℰ[take f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟∖f⟩

Function invocation

Asynchronous eval

Function RepositoryUpdates

⟨ℰ[f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟⟩

Futures ⟨c◂V ∣ S,𝒟⟩ ⟶ ⟨S[V/c],𝒟⟩

Page 17: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

SKC function terms

M ::= M M' ∣ V

∣ f

∣ async M

∣ set f M

∣ take f

V ::= x ∣ λx.M

∣ c

⟨ℰ[async M],𝒟⟩ ⟶ ⟨ℰ[c] ∣ c◂M,𝒟⟩

⟨ℰ[set f M],𝒟⟩ ⟶ ⟨ℰ[f],𝒟[f↦M]⟩

⟨ℰ[take f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟∖f⟩

Function invocation

Asynchronous eval

Function RepositoryUpdates

⟨ℰ[f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟⟩

Futures ⟨c◂V ∣ S,𝒟⟩ ⟶ ⟨S[V/c],𝒟⟩

Page 18: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

SKC function terms

M ::= M M' ∣ V

∣ f

∣ async M

∣ set f M

∣ take f

V ::= x ∣ λx.M

∣ c

⟨ℰ[async M],𝒟⟩ ⟶ ⟨ℰ[c] ∣ c◂M,𝒟⟩

⟨ℰ[set f M],𝒟⟩ ⟶ ⟨ℰ[f],𝒟[f↦M]⟩

⟨ℰ[take f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟∖f⟩

Function invocation

Asynchronous eval

Function RepositoryUpdates

Futures ⟨c◂V ∣ S,𝒟⟩ ⟶ ⟨S[V/c],𝒟⟩

Page 19: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

SKC function terms

M ::= M M' ∣ V

∣ f

∣ async M

∣ set f M

∣ take f

V ::= x ∣ λx.M

∣ c

⟨ℰ[set f M],𝒟⟩ ⟶ ⟨ℰ[f],𝒟[f↦M]⟩

⟨ℰ[take f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟∖f⟩

Function invocation

Asynchronous eval

Function RepositoryUpdates

Futures

Page 20: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

SKC function terms

M ::= M M' ∣ V

∣ f

∣ async M

∣ set f M

∣ take f

V ::= x ∣ λx.M

∣ c

⟨ℰ[async M],𝒟⟩ ⟶ ⟨ℰ[c] ∣ c◂M,𝒟⟩

⟨ℰ[set f M],𝒟⟩ ⟶ ⟨ℰ[f],𝒟[f↦M]⟩

⟨ℰ[take f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟∖f⟩

Function invocation

Asynchronous eval

Function RepositoryUpdates

⟨ℰ[f],𝒟[f↦M]⟩ ⟶ ⟨ℰ[M],𝒟⟩

Futures ⟨c◂V ∣ S,𝒟⟩ ⟶ ⟨S[V/c],𝒟⟩

λ + Futures + Function Repository

Page 21: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Programmable events in SKC

● Store handlers for event e in the definition repository 𝒟:

install_handler ↦ λe.λhandler. let old_handler = take e let new_handler = λv.do async (handler v) (current_handler v) set e new_handler

● Raise event e (with v) by invoking its handlers in 𝒟:

e v

● ( See the paper for Tailor in SKC )

Page 22: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Programmable events in SKC

● Store handlers for event e in the definition repository 𝒟:

install_handler ↦ λe.λhandler. let old_handler = take e let new_handler = λv.do async (handler v) (current_handler v) set e new_handler

● Raise event e (with v) by invoking its handlers in 𝒟:

e v

● ( See the paper for Tailor in SKC )

Updatable function definitions

Page 23: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Programmable events in SKC

● Store handlers for event e in the definition repository 𝒟:

install_handler ↦ λe.λhandler. let old_handler = take e let new_handler = λv.do async (handler v) (current_handler v) set e new_handler

● Raise event e (with v) by invoking its handlers in 𝒟:

e v

● ( See the paper for Tailor in SKC )

Updatable function definitions

Function-to-functioninvocation

Page 24: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

Conclusions and future work

We introduced SKC a Kernel Calculus for Serverless Computing:● Build on established models (λ-calculus + futures + function repository)● captures current programming models ● supports next-gen features e.g. function-to-function invocation

Serverless: current challenges SKC: research direction

The coordination logic is spare and loosely-consistent

Choreographic Programming targeting SKC.

Estimation of performance and costs is complex Quantitative SKC

Page 25: No More, No Less€¦ · A gentle introduction to “serverless”... Monolith Microservices Serverless provisioned, pay-per-deployment on-demand, pay-per-execution

No More, No Lessλ + Futures + Function Repository

=A formal model for Serverless Computing

Thanks for your attention