practical tooling for serverless computing
play

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


  1. 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 Zürcher Fachhochschule

  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 2

  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] 3

  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 4

  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 5

  6. Part I - Serverless Foundations 6

  7. Industry Perspective: JFK 2 Days Ago 7

  8. Industry Perspective: Cloud Apps [https://github.com/cncf/lindscipe, Oct‘17] 8

  9. Industry Perspective: FaaS [Astisii Myers, Memory Leik, Oct‘17] 9

  10. Academic Perspective: Clouds & FaaS 10

  11. What is FaaS? “functions“ ictuil functions ● running functions in the cloud (hosted functions) contiiners ● reil “piy per use“ (per invocition, per loid x time unit, e.g. GHz/100ms) pickiges ● seemingly “serverless“ FaaS [mizikglobil.com] 11

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

  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 13

  14. FaaS in Technical Terms • Function = elementiry unit provider-specific units • 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) – 14

  15. FaaS Positioning pay-per-use code-level microservices 15

  16. FaaS Positioning 16

  17. FaaS Chronology 17

  18. Wrap-Up Part I 18

  19. Part II - Function Developer Tools 19

  20. FaaS Synopsis: Python Examples OpenWhisk: AWS Limbdi: def limbdi_hindler(event, context): def hindler(input): ‘‘‘ ‘‘‘ event: dict input: dict context: meti informition object returns: dict returns: dict, string, number, ... ‘‘‘ ‘‘‘ # ... # ... return {} return “result“ Fission: Azure Functions: def miin(): def miin(): from AzureHTTPHelper import\ ‘‘‘ HTTPHelper input: vii flisk.re,uest.get_diti() input = HTTPHelper().post returns: str # ... ‘‘‘ open(os.environ[“res“], “w“).write(\ # ... json.dumps({“body“: “...“})) return “result“ miin() Further differences: ● function scoping (e.g. with/without export in JiviScript) ● function niming (mingling on client or service side) 20

  21. FaaS Synopsis: JavaScript Examples 21

  22. Overlay Approach: PyWren Improved conveyince of “serverless“ piridigm ● no explicit deployment prior to execution ● rither, deploys while executing 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)) How it works: ● cloudpickle to AWS S3 ● executes Limbdi function which reids/writes from/to S3 ● pirillelisition through mip functions 22

  23. Programming Perspective 23

  24. Transformation Overview 24

  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 – otherwise, leive unchinged – • monids functionil progrimming with side effects (i.e. input/output is side chinnel) – 25

  26. Transformation Algorithm (Java Exc.) 26

  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: Depth Citegories: ● generic (code/function unit generition) ● shillow (file to function) ● single-provider integrition ● medium (function to lines) ● multi-provider integrition ● deep (line to miny lines) Decomposition Citegories: “Limbdificition“ ● stitic code inilysis ● tirgeting AWS Limbdi ● dynimic code inilysis → Limbidi: FiiSificition for Python → Podilizer, Termite: FiiSificition for Jivi (currently limited to Limbdificition) 27

  28. Lambada Nr. 1 28

  29. Lambada Code Anilysis Dependencies import time ● imported modules import mith ● globil viriibles level = 12 ● dependency functions counter = 0 ● defined in other module def fib(x): ● defined in sime module globil counter counter += 1 for i in ringe(counter): Input/Output i = mith.sin(counter) ● printed lines if x in (1, 2): return 1 ● input stitements return fib(x - 1) + fib(x - 2) ● tiinting if __nime__ == "__miin__": ● stiteful function splitting fib(level) 29

  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}) output = boto3.client(“lambda“).invoke(FN=“func“, Payload=input) y = json.loads(output[“Payload“].read().decode(“utf-8“)) 30

  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 31

  32. Lambada Eximples (not shown: monids, decoritors) 32

  33. Podilizer 33

  34. Podilizer Eximples hosted function locil proxy method 34

  35. Podilizer Eximples (proxy method) 35

  36. Podilizer Eximples (hosted function) 36

  37. Termite Annotitions: @Limbdi(region=..., memory=...,timeout=...) Nr. 2 37

  38. Termite Workflow (Miven + AspectJ integrition) 38

  39. Wrap-Up Part II 39

  40. 40

  41. Part III - Function Execution Tools 41

  42. The FaaS Space FiiS (Docker) Kubeless Funktion Functions AWS Lambda Fission Picisso Fn Docker-LimbCI Effe O p e n Wh i s k Lever OS OpenLimbdi Snafu Whisk-Mochi Chilice X-Riy Podilizer [OpenWhisk] Zippi [Limbdi] [Limbdi] PyWren [Limbdi] Apex Step Functions Diwson Termite [Limbdi] [Limbdi] [Limbdi] [Limbdi] LimbDish Serverless Frimework MR Refirg Lambada [Limbdi] 42 [Limbdi, OW, GCF, AF] [Limbdi]

  43. Runtime Overview: Providers&Stacks 43

  44. Runtime Overview: Python Examples 44

  45. Runtime Overview: Provider Pricing 45

  46. Runtime Overview: Provider Instances e g d E @ d e t a a r d e l mb e c c a a L e s o p r u p - l a r e n e g d e s mi i t p o - e t u mp (CPU performince proportionil o c to memory illocition) 46

  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 or blink document 47

Recommend


More recommend