Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Whaleless! Doing serverless with Docker

A93b8ed15efe8a33d4045befbed219c2?s=47 Amir
May 25, 2017

Whaleless! Doing serverless with Docker

Talk given at GlueCon 2017 on 25 May 2017

A93b8ed15efe8a33d4045befbed219c2?s=128

Amir

May 25, 2017
Tweet

Transcript

  1. WHALELESS!
 AMIR CHAUDHRY DOING SERVERLESS WITH DOCKER GlueCon
 25 May

    2017 @amirmc
  2. WHALELESS! OVERVIEW ▸ What is Serverless, anyway? ▸ Frameworks available

    ▸ Docker, Docker, Docker! ▸ Why this matters ▸ Questions?
  3. SERVERLESS?

  4. SERVERLESS SERVERLESS? CODE THAT MATTERS.
 ONLY ON DEMAND.

  5. SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND

  6. SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND

    !
  7. SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND

    ! "
  8. SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND

    ! " HARDWARE OS RUNTIME LIBS
  9. Monolith Microservices Functions

  10. Monolith Microservices Functions Real hardware Cloud deployment

  11. FRAMEWORKS

  12. ▸ Many to choose from! ▸ Main ones tied to

    specific infrastructure providers ▸ A few try to abstract across providers ▸ A few are ‘bring your own cloud’ FRAMEWORKS A FRAMEWORK A DAY…
  13. ▸ NodeJS, Python, Java, C# ▸ Seamless AWS integration ▸

    Free tier:
 1M free req per month
 400k GB-sec compute ▸ 20¢ per 1M req
 $0.00001667 per GB-s FRAMEWORKS AWS LAMBDA
  14. ▸ JS, C#, F#
 Also scripting in many others ▸

    Free tier:
 1M free req per month
 400k GB-sec compute ▸ 20¢ per 1M req
 $0.000016 per GB-s FRAMEWORKS AZURE FUNCTIONS
  15. ▸ NodeJS ▸ Free tier:
 2M free req per month


    400k GB-sec and
 200k GHz-sec compute
 5GB (egress) ▸ 40¢ per 1M req
 $0.0000025 per GB-s
 $0.0000100 per GHz-s
 $0.12/GB outside Google FRAMEWORKS GOOGLE CLOUD FUNCTIONS
  16. ▸ Straightforward to create new functions ▸ Autoscaling is built

    in ▸ Enables new interaction models (IoT, Voice, etc) FRAMEWORKS BENEFITS
  17. CAVEATS

  18. CAVEATS BALANCE OF CONCERNS ▸ Devs: love the idea of

    serverless! ▸ Ops: still need oversight for monitoring and control ▸ Finance: still cares about spending and forecasting ▸ Business: needs to maintain flexibility
  19. CAVEATS IF IT’S ALL CONTAINERS?

  20. CAVEATS IF IT’S ALL CONTAINERS? SERVERLESS WITH DOCKER?

  21. FaaS github.com/alexellis/faas @alexellisuk

  22. FAAS FRAMEWORK ARCHITECTURE

  23. FAAS FRAMEWORK ARCHITECTURE ▸ Built on Swarm Mode ▸ Uses

    STDIN and STDOUT ▸ Metrics baked in ▸ Deploy a demo stack in 60s
  24. FAAS FRAMEWORK WATCHDOG

  25. FAAS FRAMEWORK SERVERLESS BENEFITS ▸ Straightforward to create new functions

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  26. FAAS FRAMEWORK SERVERLESS BENEFITS ▸ Straightforward to create new functions

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  27. FAAS FRAMEWORK EXAMPLE - IMAGE RESIZING FROM v4tech/imagemagick ADD https://github.com/alexellis/faas/releases/

    download/0.5.2-alpha/fwatchdog /usr/bin RUN chmod +x /usr/bin/fwatchdog ENV fprocess "convert - -resize 50% fd:1" EXPOSE 8080 CMD [ "/usr/bin/fwatchdog"]
  28. DEMO TIME! DEPLOY!

  29. FAAS FRAMEWORK WHAT YOU SAW ▸ Play with Docker ▸

    Quick to deploy ▸ Simple UI ▸ Sample functions
  30. FAAS FRAMEWORK SERVERLESS BENEFITS ▸ Straightforward to create new functions

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  31. DEMO TIME! AUTOSCALING

  32. FAAS FRAMEWORK WHAT YOU SAW ▸ Load created ▸ Replica

    count increased ▸ Replica returned
  33. FAAS FRAMEWORK SERVERLESS BENEFITS ▸ Straightforward to create new functions

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  34. FAAS FRAMEWORK NEW INTERACTION MODELS

  35. DEMO TIME! CHAT OPS

  36. FAAS FRAMEWORK WHAT YOU SAW ▸ Example of chat ops

    ▸ Swapped AWS Lambda for FaaS ▸ Code ran real-time, on private infrastructure, next to data ▸ Used YAML stack format and handers to quickly template app
 (NodeJS, Python) code: github.com/alexellis/journey-expert code: github.com/alexellis/faas-cli
  37. FAAS FRAMEWORK WHAT YOU SAW code: github.com/alexellis/journey-expert provider: name: faas

    gateway: http://localhost:8080 functions: incoming: lang: python handler: ./incoming image: alexellis2/incoming environment: es_url: "http://elasticsearch:9200/t alexa_query: lang: node handler: ./alexa_query image: alexellis2/alexa_query environment: term: "gluecon" es_url: "http://elasticsearch:9200/" filter_url: “http://gateway:8080/fun filter_string: lang: python handler: ./filter_string image: alexellis2/filter_string code: github.com/alexellis/faas-cli ▸ Example of chat ops ▸ Swapped AWS Lambda for FaaS ▸ Code ran real-time, on private infrastructure, next to data ▸ Used YAML stack format and handers to quickly template app
 (NodeJS, Python)
  38. FAAS FRAMEWORK WHAT YOU SAW code: github.com/alexellis/journey-expert from urlparse import

    urlparse import string def handle(st): val = st parts = val.split(" ") bits = [part for part in parts if not urlparse(part).scheme and part != "&" ] val = string.join(bits, " ") print(val) code: github.com/alexellis/faas-cli ▸ Example of chat ops ▸ Swapped AWS Lambda for FaaS ▸ Code ran real-time, on private infrastructure, next to data ▸ Used YAML stack format and handers to quickly template app
 (NodeJS, Python)
  39. SO WHAT?

  40. SO WHAT? NEW PATTERN.
 HERE TO STAY.

  41. NEW PATTERN TRY IT WITH DOCKER!

  42. THANK YOU!
 @amirmc

  43. THANK YOU!
 QUESTIONS? @amirmc