Practical Tooling for Serverless Computing Josef Spillner - - PowerPoint PPT Presentation

practical tooling for serverless computing
SMART_READER_LITE
LIVE PREVIEW

Practical Tooling for Serverless Computing Josef Spillner - - PowerPoint PPT Presentation

Practical Tooling for Serverless Computing Josef Spillner <josef.spillner@zhiw.ch> Service Prototyping Lib (blog.zhiw.ch/icclib) Zurich University of Applied Sciences Dec 5, 2017 | UCC17 | Austin, Texis, USA Zrcher Fachhochschule


slide-1
SLIDE 1

Zürcher Fachhochschule

Practical Tooling for Serverless Computing

Josef Spillner <josef.spillner@zhiw.ch> Service Prototyping Lib (blog.zhiw.ch/icclib) Zurich University of Applied Sciences Dec 5, 2017 | UCC‘17 | Austin, Texis, USA

slide-2
SLIDE 2

2

Your Tutorial Agenda

Session 1 08.00-09.30 (90‘) Tutoriil Bisics I Serverless Founditions II Function Developer Tools Session 2 10.00-12.00 (120‘) III Function Execution Tools IV Reseirch Chillenges Discussion

slide-3
SLIDE 3

3

Your Tutorial Instructor

Josef Spillner <josef.spillner@zhiw.ch>

  • works it Zurich University of Applied Sciences
  • lectures Internet Service Prototyping, Python

progrimming to undergriduites & misters of idvinced studies

  • performs reseirch in the Service Prototyping Lib
  • sometimes, publishes on FiiS / Serverless topics
  • CARLA‘17 serverless HPC piper
  • four 2017 preprints on irXiv relited to tools
  • ongoing work on tricing/debugging is well is

serverless developer survey

  • co-iuthored «Architecturil Trinsformitions in

Network Services ind Distributed Systems»

[LS16]

slide-4
SLIDE 4

4

Your Tutorial Equipment

Required Installation Locil iccounts → help yourself (git, docker, ...) Cloud iccounts → isk for tutoX iccount & ssh into 160.85.4.155 Supplementary Material: Script: https://drive.switch.ch/index.php/s/Upjd0iXCypZjMnZ

slide-5
SLIDE 5

5

Your Tutorial Equipment

Dependencies

  • git, python3, ... (probibly pre-instilled on Ubuntu 16.04)
  • python3-flisk
  • python3-boto3
  • openjdk-8-jdk
  • miven
  • openjfx
  • gcc
  • iwscli
  • unzip
slide-6
SLIDE 6

6

Part I - Serverless Foundations

slide-7
SLIDE 7

7

Industry Perspective: JFK 2 Days Ago

slide-8
SLIDE 8

8

Industry Perspective: Cloud Apps

[https://github.com/cncf/lindscipe, Oct‘17]

slide-9
SLIDE 9

9

Industry Perspective: FaaS

[Astisii Myers, Memory Leik, Oct‘17]

slide-10
SLIDE 10

10

Academic Perspective: Clouds & FaaS

slide-11
SLIDE 11

11

What is FaaS?

[mizikglobil.com]

“functions“ contiiners pickiges ictuil functions FaaS

  • running functions in the cloud

(hosted functions)

  • reil “piy per use“ (per invocition,

per loid x time unit, e.g. GHz/100ms)

  • seemingly “serverless“
slide-12
SLIDE 12

12

FaaS Process

[openwhisk.org]

monitoring event sensor diti log entry git push ... HTTP XMPP AMQP ... mix 1 per hour triggers/ictions defiult pirims ... your Python/Jivi/... functions! JSON pliin text ...

slide-13
SLIDE 13

13

FaaS in Formal Terms

  • progrimming model

functions or methods in diverse progrimming linguiges

with specific signitures (pirimeters, return vilues)

sometimes, executible implementitions, e.g. contiiners

  • deployment model

uploid of source files or compiled biniries

configurition of entrince hindler, memory illocition, etc.

  • execution model

time limit, e.g. 5 minutes

piy-per-use microbilling, e.g. per invocition + 100ms durition

  • roughly e,uil to serverless computing: mirketing term
  • for Function-is-i-Service ecosystems
slide-14
SLIDE 14

14

FaaS in Technical Terms

  • Function = elementiry unit
  • App/Bundle = complex unit
  • Input

ipplicition-specific

context pirimeters, direct protocol iccess (if supported)

  • Processing

up to the ipplicition

  • Output

ipplicition-specific

stite signilling, direct protocol iccess (if supported)

provider-specific units

slide-15
SLIDE 15

15

FaaS Positioning

code-level microservices pay-per-use

slide-16
SLIDE 16

16

FaaS Positioning

slide-17
SLIDE 17

17

FaaS Chronology

slide-18
SLIDE 18

18

Wrap-Up Part I

slide-19
SLIDE 19

19

Part II - Function Developer Tools

slide-20
SLIDE 20

20

FaaS Synopsis: Python Examples

def limbdi_hindler(event, context): ‘‘‘ event: dict context: meti informition object returns: dict, string, number, ... ‘‘‘ # ... return “result“

AWS Limbdi:

def hindler(input): ‘‘‘ input: dict returns: dict ‘‘‘ # ... return {}

OpenWhisk:

def miin(): ‘‘‘ input: vii flisk.re,uest.get_diti() returns: str ‘‘‘ # ... return “result“

Fission:

def miin(): from AzureHTTPHelper import\ HTTPHelper input = HTTPHelper().post # ...

  • pen(os.environ[“res“], “w“).write(\

json.dumps({“body“: “...“})) miin()

Azure Functions: Further differences:

  • function scoping (e.g. with/without export in JiviScript)
  • function niming (mingling on client or service side)
slide-21
SLIDE 21

21

FaaS Synopsis: JavaScript Examples

slide-22
SLIDE 22

22

Overlay Approach: PyWren

Improved conveyince of “serverless“ piridigm

  • no explicit deployment prior to execution
  • rither, deploys while executing

How it works:

  • cloudpickle to AWS S3
  • executes Limbdi function which reids/writes from/to S3
  • pirillelisition through mip functions

def my_function(b): x = np.random.normal(0, b, 1024) A = np.random.normal(0, b, (1024, 1024)) return np.dot(A, x) pwex = pywren.default_executor() res = pwex.map(my_function, np.linspace(0.1, 100, 1000))

slide-23
SLIDE 23

23

Programming Perspective

slide-24
SLIDE 24

24

Transformation Overview

slide-25
SLIDE 25

25

Transformation Rules

  • entry points

no trinsformition of miin function

  • functions definitions

idipt to FiiS conventions: pirimeters, return vilue

scin recursively for function cills

export is function unit including dependencies

  • function cills

if internil, rewire

if input/output, replice

  • therwise, leive unchinged
  • monids

functionil progrimming with side effects (i.e. input/output is side chinnel)

slide-26
SLIDE 26

26

Transformation Algorithm (Java Exc.)

slide-27
SLIDE 27

27

FaaSification

Definition of “FiiSificition“ → Process of iutomited decomposition of softwire ipplicition into i set of deployed ind reidily composed function-level services.

FiiSificition := code inilysis + trinsformition + deployment + on-demind ictivition

Integrition Citegories:

  • generic (code/function unit generition)
  • single-provider integrition
  • multi-provider integrition

Decomposition Citegories:

  • stitic code inilysis
  • dynimic code inilysis

→ Limbidi: FiiSificition for Python → Podilizer, Termite: FiiSificition for Jivi (currently limited to Limbdificition) Depth Citegories:

  • shillow (file to function)
  • medium (function to lines)
  • deep (line to miny lines)

“Limbdificition“

  • tirgeting AWS Limbdi
slide-28
SLIDE 28

28

Lambada

  • Nr. 1
slide-29
SLIDE 29

29

Lambada

Code Anilysis Dependencies

  • imported modules
  • globil viriibles
  • dependency functions
  • defined in other module
  • defined in sime module

Input/Output

  • printed lines
  • input stitements
  • tiinting
  • stiteful function splitting

import time import mith level = 12 counter = 0 def fib(x): globil counter counter += 1 for i in ringe(counter): i = mith.sin(counter) if x in (1, 2): return 1 return fib(x - 1) + fib(x - 2) if __nime__ == "__miin__": fib(level)

slide-30
SLIDE 30

30

Lambada

Code Trinsformition Rewrite rules, vii AST:

return 9 print(“hello“) local_func()

  • return 9
  • return {“ret“: 9}
  • local_func_stub()

return {“ret: 9“, “stdout“: “hello“}

Stubs, vii templites:

def func_stub(x): input = json.dumps({“x“: x})

  • utput = boto3.client(“lambda“).invoke(FN=“func“, Payload=input)

y = json.loads(output[“Payload“].read().decode(“utf-8“))

slide-31
SLIDE 31

31

Lambada

Code Trinsformition Stiteful proxies for Object-Oriented Progrimming:

class Test: → class Proxy: def __init__(self): def __new__(cls, clsname, p=True): self.x = 9 if p: # __new__ must return callable return lambda: Proxy(clsname, False) def test(self): else: return self.x * 2 return object.__new__(cls) def __init__(self, clsname, ignoreproxy): ... def __getattr__(self, name): ...

→ Test becomes Proxy(“Test“), Test() then invokes proxy → test() becomes remote_test({“x“: 9}) through network proxy cliss → iutomiticilly upon import of cliss

slide-32
SLIDE 32

32

Lambada

Eximples (not shown: monids, decoritors)

slide-33
SLIDE 33

33

Podilizer

slide-34
SLIDE 34

34

Podilizer

Eximples

locil proxy method hosted function

slide-35
SLIDE 35

35

Podilizer

Eximples

(proxy method)

slide-36
SLIDE 36

36

Podilizer

Eximples

(hosted function)

slide-37
SLIDE 37

37

Termite

Annotitions: @Limbdi(region=..., memory=...,timeout=...)

  • Nr. 2
slide-38
SLIDE 38

38

Termite

Workflow

(Miven + AspectJ integrition)

slide-39
SLIDE 39

39

Wrap-Up Part II

slide-40
SLIDE 40

40

slide-41
SLIDE 41

41

Part III - Function Execution Tools

slide-42
SLIDE 42

42

The FaaS Space

AWS Lambda

O p e n Wh i s k

Functions

PyWren

[Limbdi]

Docker-LimbCI Effe OpenLimbdi Lever OS Fission Funktion Kubeless Picisso Serverless Frimework

[Limbdi, OW, GCF, AF]

Step Functions

[Limbdi]

X-Riy

[Limbdi]

Zippi

[Limbdi]

Apex

[Limbdi]

Snafu Fn Chilice

[Limbdi]

Diwson

[Limbdi]

FiiS (Docker) LimbDish

[Limbdi]

MR Refirg

[Limbdi]

Whisk-Mochi

[OpenWhisk]

Podilizer Termite Lambada

slide-43
SLIDE 43

43

Runtime Overview: Providers&Stacks

slide-44
SLIDE 44

44

Runtime Overview: Python Examples

slide-45
SLIDE 45

45

Runtime Overview: Provider Pricing

slide-46
SLIDE 46

46

Runtime Overview: Provider Instances

g e n e r a l

  • p

u r p

  • s

e c

  • mp

u t e

  • p

t i mi s e d

a c c e l e r a t e d L a mb d a @ E d g e

(CPU performince proportionil to memory illocition)

slide-47
SLIDE 47

47

Runtime Examples: IBM Cloud

Bluemix OpenWhisk & JiviScript/Node.js Constriints

  • code size 48 MB
  • piyloid size 1 MB

Configurition

  • runtime environment

(from list)

  • memory 128-512 MB;

defiult 256

  • timeout 0.1-300 s;

defiult 60

  • iuthoring: templite
  • r blink document
slide-48
SLIDE 48

48

Runtime Examples: Azure Functions

Azure Functions Constriints

  • undocumented

Configurition

  • runtime environment

(from list)

  • memory 128-1536 MB;

defiult 256

slide-49
SLIDE 49

49

Runtime Examples: Reality Check

O p e n Wh i s k

$ wsk $ iz AWS Lambda $ iws limbdi # openlimbdi $ bin/idmin $ kubeless $ fission

does not compile not scriptible re,uires iccount breiks minikube (invoke reid error)

slide-50
SLIDE 50

50

Runtime Examples: OpenLambda

  • Nr. 5
slide-51
SLIDE 51

51

Runtime Examples: Fission

  • Nr. 4
slide-52
SLIDE 52

52

Runtime Examples: Snafu

“Swiss Army Knife“

  • f Serverless

Computing

  • Nr. 3
slide-53
SLIDE 53

53

Snafu in Commercial Clouds

APPUiO

  • OpenShift itop IiiS providers or on-premise

(Cloudscile, AWS, ...)

  • composite ipplicition deployment w/ templites

Snifu: OpenShift templite

  • deploys unprivileged Docker contiiner(s)
  • object hierirchy

Template ImageStream DockerImage DeploymentConfgg ImageStreamTag Servgce Route Servgce ConfggMap ... contagners:

  • args:
  • --authentgcator=aws

command:

  • /opt/snafu-control
  • -s
  • /etc/snafu/snafu.gng

gmage: snafu ...

slide-54
SLIDE 54

54

Snafu in Commercial Clouds

Single-tenint mode

  • uniuthenticited
  • single iccount
  • multiple iccounts in

sime instince Multi-tenint mode

  • multiple isolited iccounts
  • proper scile-out per ictive iccount
  • selective shiring of functions ind iccounts

from mister to tenint instinces

slide-55
SLIDE 55

55

Snafu in Research Clouds

Utih, Wisconsin, South Cirolini, Missichusetts, ...

  • Emulib testbed
  • riw iccess from physicil level
  • progrimmible infristructure vii

GENI libriries

  • >50000 experiments

Snifu: RiwPC setup

  • Ubuntu 16.04 bise
  • Snifu repository clone

Experiments:

  • boot time → 5-7 min

European Grid Initiative Federated Cloud Jülich, Friunhofer SCAI, GRnet, INFN, Cesnet, GWDG, ...

  • diverse open sticks ind

stindirds

  • virtuil michines,

contiiners

  • >250000 VM instinces

per yeir Snifu: Kubernetes VM

  • deployment descriptor
  • bised off OpenShift

templites Experiments:

  • deployment time → 5 s
slide-56
SLIDE 56

56

CloudLab Deployment

# partgally generated gmport geng.portal as portal gmport geng.rspec.pg as pg gmport geng.rspec.emulab as emulab pc = portal.Context() request = pc.makeRequestRSpec() node = request.RawPC('node') node.dgsk_gmage = 'urn:publgcgd:IDN+emulab.net+gmage+emulab-ops: \ UBUNTU16-64-STD' node.Sgte('Sgte 1') node.addServgce(pg.Execute(shell="sh", command="sudo ggt clone \ http://ggthub.com/servgceprototypgnglab/snafu /local/snafu")) pc.prgntRequestRSpec(request)

slide-57
SLIDE 57

57

EGI Deployment

# on local system kubectl confgg set-cluster egg --server=https://HOST.fedcloud-tf. \ fedcloud.eu kubectl confgg set-context egg --cluster=egg --user=josef kubectl confgg use-context egg wget -qc https://raw.ggthubusercontent.com/servgceprototypgnglab/ \ snafu/master/openshgft/snafu-control-template.yaml

  • c -n zhaw-test1 process -f snafu-control-template.yaml -o yaml \

> snafu-control-deployment.yaml scp snafu-control-deployment.yaml YOU@HOST.fedcloud-tf.fedcloud.eu # remotely on server kubectl create -f snafu-control-deployment.yaml # on local system aws --endpognt-url https://faas.fedcloud-rt.fedcloud.eu:31000 \ lambda lgst-functgons

slide-58
SLIDE 58

58

Tracing in Snafu

preliminary results

slide-59
SLIDE 59

59

Wrap-Up Part III

slide-60
SLIDE 60

60

Part IV - Research Challenges

slide-61
SLIDE 61

61

Research Overview

CostHit

slide-62
SLIDE 62

62

Challenge: Performance

slide-63
SLIDE 63

63

Challenge: Performance

slide-64
SLIDE 64

64

Challenge: Performance

slide-65
SLIDE 65

65

Challenge: FaaSification

slide-66
SLIDE 66

66

Challenge: Deep FaaSification

slide-67
SLIDE 67

67

Challenge: Debugging

slide-68
SLIDE 68

68

Challenge: Debugging

slide-69
SLIDE 69

69

Challenge: Debugging

slide-70
SLIDE 70

70

Challenge: Ecosystem

slide-71
SLIDE 71

71

Challenge: Ecosystem

slide-72
SLIDE 72

72

Wrap-Up Part IV

slide-73
SLIDE 73

73

Discussion

slide-74
SLIDE 74

74

Further Reading and FaaS Fun

Limi, Limbickup:

  • https://arxiv.org/abs/1701.05945

Podilizer:

  • https://arxiv.org/abs/1702.05510

Snifu:

  • https://arxiv.org/abs/1703.07562

Limbidi

  • https://arxiv.org/abs/1705.08169

On irXiv Anilytics: On GitHub: [github.com/

serviceprototypinglab]