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

Whaleless! Doing serverless with Docker

Amir
May 25, 2017

Whaleless! Doing serverless with Docker

Talk given at GlueCon 2017 on 25 May 2017

Amir

May 25, 2017
Tweet

More Decks by Amir

Other Decks in Technology

Transcript

  1. WHALELESS! OVERVIEW ▸ What is Serverless, anyway? ▸ Frameworks available

    ▸ Docker, Docker, Docker! ▸ Why this matters ▸ Questions?
  2. ▸ 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…
  3. ▸ 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
  4. ▸ 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
  5. ▸ 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
  6. ▸ Straightforward to create new functions ▸ Autoscaling is built

    in ▸ Enables new interaction models (IoT, Voice, etc) FRAMEWORKS BENEFITS
  7. 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
  8. FAAS FRAMEWORK ARCHITECTURE ▸ Built on Swarm Mode ▸ Uses

    STDIN and STDOUT ▸ Metrics baked in ▸ Deploy a demo stack in 60s
  9. FAAS FRAMEWORK SERVERLESS BENEFITS ▸ Straightforward to create new functions

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

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  11. 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"]
  12. FAAS FRAMEWORK WHAT YOU SAW ▸ Play with Docker ▸

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

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  14. FAAS FRAMEWORK WHAT YOU SAW ▸ Load created ▸ Replica

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

    ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) ▸ Low cost
  16. 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
  17. 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)
  18. 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)