![Page 1: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/1.jpg)
Functional Programming in Serverless World
Lambda Days 2018 - Cracow (23.02.2018)
![Page 2: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/2.jpg)
~ # whoami (afronski)
✓ Software and Operations EngineerAppliscale
Erlang, Elixir, Node.js AWS (2 certificates)
✓ Functional Miners co-organizer
P.S. Appliscale is hiring!
![Page 3: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/3.jpg)
What is serverless?
![Page 4: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/4.jpg)
http://celiacandthebeast.com/wp-content/uploads/2014/08/SRSLY.jpg
![Page 5: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/5.jpg)
There are servers
![Page 6: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/6.jpg)
There are ops
![Page 7: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/7.jpg)
read.acloud.guru/iaas-paas-serverless-the-next-big-deal-in-cloud-computing
![Page 8: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/8.jpg)
Serverless
Back-end as a Service (BaaS)
Function as a Service (FaaS)
![Page 9: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/9.jpg)
Incoming Event
Source Code Package Configuration
Function (Execution Unit)
RAM: 512 MB
RAM: 512 MB 0.5 GB
Real time: 120 msBill time: 200 ms (buckets by 100 ms)
Price: 0.00001667 GB * seconds
Cost: 0.00001667 * 0.5 GB * 0.2 s = 0.000001667 USD = 1.7 μUSD
Response
![Page 10: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/10.jpg)
Whyserverless?
![Page 11: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/11.jpg)
http://www.doc.ic.ac.uk/~rbc/papers/fse-serverless-17.pdf
Gojko Adzic - Designing for the Serverless Age (GOTO 2017)
![Page 12: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/12.jpg)
Costs
![Page 13: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/13.jpg)
Architecture[...] breaking the monolith into functions that could be independently deployed, meant that they were better able to split the team up to work on more things in parallel, and to deploy each feature separately.
![Page 14: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/14.jpg)
Operations[…] so their estimate is that moving to Lambda gave an operational cost reduction of greater than 95% for a comparable amount of compute.
![Page 15: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/15.jpg)
![Page 16: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/16.jpg)
Technology
![Page 17: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/17.jpg)
![Page 18: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/18.jpg)
![Page 19: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/19.jpg)
Shims
Using Node.js process API to spawn an
executable
Handling events reported by subprocess and passing results to
the AWS Lambda handler
Sending input arguments to the
spawned subprocess
![Page 20: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/20.jpg)
![Page 21: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/21.jpg)
Measurements
![Page 22: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/22.jpg)
Test Scenarios1. Two endpoints:
a. Echoing incoming body.b. Sieve of Eranthoses (naive implementation).
2. Package Size.3. Memory Usage (dependent on input argument).4. Execution Time (dependent on input argument).5. Startup Time (cold start, no work done).
![Page 23: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/23.jpg)
![Page 24: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/24.jpg)
![Page 25: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/25.jpg)
"Situated" Programs (from Rich Hickey's keynote at Clojure/Conj 2017)
![Page 26: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/26.jpg)
How long does AWS Lambda keep your idle functions around before a cold start?
![Page 27: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/27.jpg)
Constraints
![Page 28: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/28.jpg)
Constraints1. No knowledge about container and its reuse.2. New approach requires new paths.3. Limits everywhere!4. Provider limitations.5. VM optimizations required from the get go.6. Beware the toolchain!
![Page 29: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/29.jpg)
Let’s recap!
![Page 30: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/30.jpg)
Safe default:F# on Azure or AWS
(.NET Core 2.0)
![Page 31: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/31.jpg)
http://www.doc.ic.ac.uk/~rbc/papers/fse-serverless-17.pdf
Gojko Adzic - Designing for the Serverless Age (GOTO 2017)
![Page 32: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/32.jpg)
Context is King
![Page 33: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/33.jpg)
λThank you!
Questions?
![Page 34: in Serverless World Functional Programming · Functional Programming in Serverless World Lambda Days 2018 - Cracow (23.02.2018) ... breaking the monolith into functions that could](https://reader030.vdocument.in/reader030/viewer/2022040617/5f2141e9f950296b4e57116d/html5/thumbnails/34.jpg)
References
1. Our company - Appliscale and job offers.2. Me - afronski.pl and my talks.3. Functional Miners meetup (facebook, twitter, github, email).4. Serverless Architecture, Serverless (Martin Fowler’s articles).5. AWS Lambda, Google Cloud Functions, Azure Functions.6. Container Reuse in AWS Lambda.7. Running Executables in AWS Lambda.8. Serverless Computing: Economic and Architectural Impact.9. Why the JVM is a Good Choice for Serverless Computing.
10. Droplr Serverless Revolution.11. Optimizing Enterprise Economics with Serverless.12. Should I use AWS Lambda or EC2?13. AWS Lambda support for .NET Core 2.0.14. Repository with examples, scripts, and measurements.