Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker Cambridge: Serverless Functions Made Simple with OpenFaaS

1,031 views

Published on

My deck from Docker Cambridge Meetup on OpenFaaS - Serverless Functions Made Simple.

Published in: Internet
  • Be the first to comment

Docker Cambridge: Serverless Functions Made Simple with OpenFaaS

  1. 1. Serverless Functions Made Simple OpenFaaS DOCKER CAMBRIDGE @alexellisuk
  2. 2. What is Serverless? MicroserviceMicroserviceMicroservice Monolith Microservice Function Serverless evolu*on
  3. 3. OpenFaaS DRIVING FACTORS
  4. 4. “Alexa, how’s the weather?” { “intent”: “FindWeather” } { “speech”: “It’s 70 degrees” } Lambda Function
  5. 5. “Alexa, how’s the weather?” { “intent”: “FindWeather” } { “speech”: “It’s 70 degrees” } +
  6. 6. What are serverless use-cases? ANYTHING - WINDOWS/LINUX Image/Video conversion Machine Learning Mobile Back- ends / IoT HTTP API / Integrations Chat Bots Batch Jobs
  7. 7. How did OpenFaaS come about? STORY SO FAR • “Lambda but with containers for Alexa” • Dockercon Cool Hacks - “push Docker beyond what it was designed to do” • Since May • Top trending Open Source project overall • > 8k stars • Industry Award • Production users • Kubernetes, Nomad, Hyper.sh, Cattle Commits: 876, Forks: 372 Stars: 6589
  8. 8. OpenFaaS top contributors and influencers You.. 1.3k commits, 60+ contributors, 533 forks
  9. 9. Comes in one flavor: Cloud Native API Gateway Function Watchdog Prometheus Swarm Kubernetes
  10. 10. HTTP body stdinrequest stdoutresponse “python3
 main.py” headers body headers Forked process Function watchdog
  11. 11. Performance - fork vs After Burn HELLO-WORLD & APACHE-BENCH
  12. 12. OpenFaaS values Portable Developer- First Unsurprising UNIX-like Operator- Friendly Community- Centric Framework Developer Love Mobilized Cloud Native
  13. 13. Building a Twitter bot
  14. 14. Building a Twitter bot @COLORISEBOT Gateway Colorise Tweet-pic Normalise-color Minio Tweet-listener
  15. 15. Deployed in 60 seconds
  16. 16. How do I write a function? WRITE A HANDLER def handler(req): r = requests.get(req) print(r.status_code) handler.py requirements.txt Python Template Docker Image requests $ faas-cli new dockercon --lang python Container Registry
  17. 17. How do I arrange functions? provider: name: faas url-ping: lang: python handler: ./sample/url-ping image: of/url-ping environment: http_proxy: http://corp1.com notify-slack: lang: python handler: ./sample/notify-slack image: of/notify-slack $ faas-cli build -f ./sample.yml $ faas-cli deploy -f ./sample.yml YAML STACK $ faas-cli new url-ping --lang python
  18. 18. Synchronous invocation IN STORE RETURNS marshal request Gateway Func: resizer HTTP
 200 Resize
 Image
  19. 19. Asynchronous invocation RETURN A PRODUCT BY MAIL NATS Queue marshal request Gateway Queue-worker dequeue Func: resizer HTTP
 200 HTTP
 200 Resize
 Image
  20. 20. Asynchronous invocation WITH A CALLBACK-URL Gateway Func: resizer HTTP
 200 http://x.y.z X-Callback-Url: hFp://x.y.z X-Callback-Url Resize
 Image Queue etc
  21. 21. github.com/openfaas/faas Chaining demo
  22. 22. FanClub GetAvatar hFps:// Twitter Chaining demo - Fanclub HOW IT WORKS Polaroid
  23. 23. Chaining / workflows AS FUNCTIONS • Should be a function • A can call B directly • A can call B via gateway • Async • Director pattern (in documentation) • Helper library available
  24. 24. Providers, integrations and users DON’T TAKE MY WORD FOR IT
  25. 25. Follow @openfaas for more https://www.openfaas.com

×