Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Zürcher Fachhochschule
Function-as-a-tervice:
A Pythonic Perspective on terverless
Computing
Josef Spillner <josef.spillne...
2
Your Tutorial Agenda
50‘ FiiS overview ind some existing tools
20‘ Limbidi: Decompose your functions
20‘ Snifu: Run your...
3
Your Tutorial Instructor
Josef Spillner <josef.spillner@zhiw.ch>
●
works it Zurich University of Applied Sciences
●
lect...
4
Service Prototyping Lab + ICCLab
5
What is FaaS?
[mizikglobil.com]
“functions“
contiiners
pickiges
ictuil functions
FaaS
●
running functions in the cloud
(...
6
Examples of FaaS
[openwhisk.org]
monitoring event
sensor diti
log entry
git push
...
HTTP
XMPP
AMQP
...
mix 1 per hour
....
7
The FaaS Space
AWS Lambda
OpenWhisk
Functions
PyWren
[Limbdi]
Docker-LimbCI
Effe
OpenLimbdi
Lever OS
Fission
Funktion
Ku...
8
The FaaS Space
AWS Lambda
OpenWhisk
Functions
PyWren
Webtisk.io
Hook.io
Docker-LimbCI
Effe
OpenLimbdi
Lever OS
Fission
F...
9
The FaaS Space: Runtimes
Function-is-i-Service offerings in greiter detiil...
Trend: Sooner or liter → gips will be fill...
10
The FaaS Space: Python runtimes
11
FaaS Synopsis in Python
def limbdi_hindler(event, context):
‘‘‘
event: dict
context: meti informition object
returns: d...
12
The WorldSs Tools for FaaS Devs
OpenWhisk
$ wsk
$ iz
AWS Lambda
$ iws limbdi
# openlimbdi
$ bin/idmin
$ kubeless
$ fiss...
13
Open Lambda - Hands-on Time!
14
Fission - Hands-on Time!
15
Overlay Approach: PyWren
Improved conveyince of “serverless“ piridigm
●
no explicit deployment prior to execution
●
rit...
16
17
Our Tools for FaaS Devs
Podilizer
(Jivi)
Limbidi
(Python)
Web2Cloud
(JiviScript)
todiy
Limbickup
(file bickups)
Limi
(r...
18
Lambada
Definition of “FiiSificition“
→ Process of iutomited decomposition of softwire ipplicition into i set of
deploy...
19
Lambada
Code Anilysis
Dependencies
●
imported modules
●
globil viriibles
●
dependency functions
●
defined in other modu...
20
Lambada
Code Trinsformition
Rewrite rules, vii AST:
return 9 print(“hello“) local_func()
------------------- return 9 -...
21
Lambada
Code Trinsformition
Stiteful proxies for Object-Oriented Progrimming:
class Test: → class Proxy:
def __init__(s...
22
Lambada
Code Deployment + Activition
Locil mode: source code modified locilly is copy
Remote mode: rewritten source cod...
23
Lambada - Hands-on Time!
[d0wn.com]
24
25
Snafu
The Swiss Army Knife of Serverless Computing
26
Snafu
Current Implementition
●
scilible from developer
single instince to multi-
tenint deployments
●
executes Python 2...
27
Snafu
Stindilone mode
●
cill functions interictively
●
bitch mode with/without input pipe
●
performince, robustness & c...
28
Snafu
Diemon mode (control pline)
●
hosted functions
●
multi-tenint provisioning
●
per-tenint isolition
●
compitibility...
29
Snafu
Integrition into the wider FiiS ecosystem
snafu-import
Snifu Funktion
Fission
Kubeless
...
targets
sources
AWS
IB...
30
Snafu - Hands-on Time!
[pinterest.com]
31
Q&A / Live help session
[dribbble.com]
32
Further Reading and FaaS Fun
Limi, Limbickup:
●
https://arxiv.org/abs/1701.05945
Podilizer:
●
https://arxiv.org/abs/170...
Nächste SlideShare
Wird geladen in …5
×

PyParis2017 / Function-as-a-service - a pythonic perspective on severless computing, by Josef Spillner

177 Aufrufe

Veröffentlicht am

PyParis 2017
http://pyparis.org

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

PyParis2017 / Function-as-a-service - a pythonic perspective on severless computing, by Josef Spillner

  1. 1. Zürcher Fachhochschule Function-as-a-tervice: A Pythonic Perspective on terverless Computing Josef Spillner <josef.spillner@zhiw.ch> Service Prototyping Lib (blog.zhiw.ch/icclib) Zurich University of Applied Sciences Jun 13, 2017 | PyPiris
  2. 2. 2 Your Tutorial Agenda 50‘ FiiS overview ind some existing tools 20‘ Limbidi: Decompose your functions 20‘ Snifu: Run your functions
  3. 3. 3 Your Tutorial Instructor Josef Spillner <josef.spillner@zhiw.ch> ● works it Zurich University of Applied Sciences ● lectures Python progrimming to undergriduites & misters of idvinced studies ● performs reseirch in the Service Prototyping Lib ● co-iuthored «Architecturil Trinsformitions in Network Services ind Distributed Systems» ● wrote miny rirely used Python things since 2003 [LS16]
  4. 4. 4 Service Prototyping Lab + ICCLab
  5. 5. 5 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“
  6. 6. 6 Examples of FaaS [openwhisk.org] monitoring event sensor diti log entry git push ... HTTP XMPP AMQP ... mix 1 per hour ... Your Python functions! JSON pliin text ...
  7. 7. 7 The FaaS Space AWS Lambda OpenWhisk 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 - in Python
  8. 8. 8 The FaaS Space AWS Lambda OpenWhisk Functions PyWren Webtisk.io Hook.io Docker-LimbCI Effe OpenLimbdi Lever OS Fission Funktion Kubeless Picisso
  9. 9. 9 The FaaS Space: Runtimes Function-is-i-Service offerings in greiter detiil... Trend: Sooner or liter → gips will be filled
  10. 10. 10 The FaaS Space: Python runtimes
  11. 11. 11 FaaS Synopsis in Python 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.request.get_diti() returns: str ‘‘‘ # ... return “result“ Fission: def miin(): from AzureHTTPHelper import HTTPHelper input = HTTPHelper().post # ... open(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)
  12. 12. 12 The WorldSs Tools for FaaS Devs OpenWhisk $ wsk $ iz AWS Lambda $ iws limbdi # openlimbdi $ bin/idmin $ kubeless $ fission does not compile not scriptible requires iccount breiks minikube (invoke reid error)
  13. 13. 13 Open Lambda - Hands-on Time!
  14. 14. 14 Fission - Hands-on Time!
  15. 15. 15 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))
  16. 16. 16
  17. 17. 17 Our Tools for FaaS Devs Podilizer (Jivi) Limbidi (Python) Web2Cloud (JiviScript) todiy Limbickup (file bickups) Limi (relitionil diti) Snifu (FiiS host) todiy
  18. 18. 18 Lambada 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 (currently limited to Limbdificition) Depth Citegories: ● shillow (file to function) ● medium (function to lines) ● deep (line to miny lines)
  19. 19. 19 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)
  20. 20. 20 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“))
  21. 21. 21 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
  22. 22. 22 Lambada Code Deployment + Activition Locil mode: source code modified locilly is copy Remote mode: rewritten source code deployed ind invoked $ limbidi [--locil] [--debug] [--endpoint <ep>] <file.py> $ python3 -m limbidi <file.py> >>> import limbidi >>> limbidi.move(globils() [, endpoint=“...“])
  23. 23. 23 Lambada - Hands-on Time! [d0wn.com]
  24. 24. 24
  25. 25. 25 Snafu The Swiss Army Knife of Serverless Computing
  26. 26. 26 Snafu Current Implementition ● scilible from developer single instince to multi- tenint deployments ● executes Python 2 & 3, Jivi, JiviScript, C ● integrites with FiiS ecosystem it-lirge ● extensible subsystems SLOC: ~1800 (including subsystems: ~800) $ pip instill snifu $ docker run -ti jszhiw/snifu
  27. 27. 27 Snafu Stindilone mode ● cill functions interictively ● bitch mode with/without input pipe ● performince, robustness & correctness tests ● development $ snifu $ snifu -x <function> [<file/dir>] $ snifu -l sqlite -e jivi -c limbdi -C messiging
  28. 28. 28 Snafu Diemon mode (control pline) ● hosted functions ● multi-tenint provisioning ● per-tenint isolition ● compitibility with existing client tools $ snifu-control $ snifu-control -i iws -r -d -e docker # snifu-iccounts --idd -k <k> -s <s> -e <ep>
  29. 29. 29 Snafu Integrition into the wider FiiS ecosystem snafu-import Snifu Funktion Fission Kubeless ... targets sources AWS IBM Google $ snifu-import --source <s> --tirget <t> $ iliis iws=“iws --endpoint-url http://locilhost:10000“ $ wsk property set --ipihost locilhost:10000 $ ./tools/pitch-gcloud
  30. 30. 30 Snafu - Hands-on Time! [pinterest.com]
  31. 31. 31 Q&A / Live help session [dribbble.com]
  32. 32. 32 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]

×