Slide 1

Slide 1 text

WHALELESS!
 AMIR CHAUDHRY DOING SERVERLESS WITH DOCKER GlueCon
 25 May 2017 @amirmc

Slide 2

Slide 2 text

WHALELESS! OVERVIEW ▸ What is Serverless, anyway? ▸ Frameworks available ▸ Docker, Docker, Docker! ▸ Why this matters ▸ Questions?

Slide 3

Slide 3 text

SERVERLESS?

Slide 4

Slide 4 text

SERVERLESS SERVERLESS? CODE THAT MATTERS.
 ONLY ON DEMAND.

Slide 5

Slide 5 text

SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND

Slide 6

Slide 6 text

SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND !

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

SERVERLESS ONLY THE CODE THAT MATTERS … TRIGGERED ON DEMAND ! " HARDWARE OS RUNTIME LIBS

Slide 9

Slide 9 text

Monolith Microservices Functions

Slide 10

Slide 10 text

Monolith Microservices Functions Real hardware Cloud deployment

Slide 11

Slide 11 text

FRAMEWORKS

Slide 12

Slide 12 text

▸ 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…

Slide 13

Slide 13 text

▸ 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

Slide 14

Slide 14 text

▸ 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

Slide 15

Slide 15 text

▸ 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

Slide 16

Slide 16 text

▸ Straightforward to create new functions ▸ Autoscaling is built in ▸ Enables new interaction models (IoT, Voice, etc) FRAMEWORKS BENEFITS

Slide 17

Slide 17 text

CAVEATS

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

CAVEATS IF IT’S ALL CONTAINERS?

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

FaaS github.com/alexellis/faas @alexellisuk

Slide 22

Slide 22 text

FAAS FRAMEWORK ARCHITECTURE

Slide 23

Slide 23 text

FAAS FRAMEWORK ARCHITECTURE ▸ Built on Swarm Mode ▸ Uses STDIN and STDOUT ▸ Metrics baked in ▸ Deploy a demo stack in 60s

Slide 24

Slide 24 text

FAAS FRAMEWORK WATCHDOG

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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"]

Slide 28

Slide 28 text

DEMO TIME! DEPLOY!

Slide 29

Slide 29 text

FAAS FRAMEWORK WHAT YOU SAW ▸ Play with Docker ▸ Quick to deploy ▸ Simple UI ▸ Sample functions

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

DEMO TIME! AUTOSCALING

Slide 32

Slide 32 text

FAAS FRAMEWORK WHAT YOU SAW ▸ Load created ▸ Replica count increased ▸ Replica returned

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

FAAS FRAMEWORK NEW INTERACTION MODELS

Slide 35

Slide 35 text

DEMO TIME! CHAT OPS

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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)

Slide 38

Slide 38 text

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)

Slide 39

Slide 39 text

SO WHAT?

Slide 40

Slide 40 text

SO WHAT? NEW PATTERN.
 HERE TO STAY.

Slide 41

Slide 41 text

NEW PATTERN TRY IT WITH DOCKER!

Slide 42

Slide 42 text

THANK YOU!
 @amirmc

Slide 43

Slide 43 text

THANK YOU!
 QUESTIONS? @amirmc