Slide 1

Slide 1 text

Serverless App and Run on Google Cloud Platform #gcpug #next19extended #ServerlessDay 19.05.15 @sakajunquality

Slide 2

Slide 2 text

About me - Jun Sakata - @sakajunquality - Google Developers Expert, Cloud - Working at Ubie, Inc. - #PubSub #CloudBuild #DarkTheme

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Agenda - Serverless Decision Making on GCP - Serverless Talk at Next 19

Slide 5

Slide 5 text

Compute Products - Cloud Functions - App Engine - Cloud Run - Kubernetes Engine - Compute Engine

Slide 6

Slide 6 text

Compute Products (Serverless) - Cloud Functions - App Engine - Cloud Run - Kubernetes Engine - Compute Engine

Slide 7

Slide 7 text

Where Should I Run My Code?

Slide 8

Slide 8 text

It depends Brian Dorsey - Where Should I Run My Code? https://www.youtube.com/watch?v=wzPmgWJ5fpU

Slide 9

Slide 9 text

@briandorsey

Slide 10

Slide 10 text

Let’s look at the each product first

Slide 11

Slide 11 text

Seveless Products Cloud Functions AppEngine Cloud Run Cloud Functions App Engine Cloud Run

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Compute Engine Before getting into serverless… - VMs - 416 vCPU and 12TB RAM… - Start quickly

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Kubernetes Engine One more non-serverless product - Fully Managed Kubernetes - Not cover much here...

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Cloud Functions - Functions as a service - Write an function - Event Driven - via Cloud Pub/Sub, GCS, HTTP... - Fully Managed Env - Including http endpoint - Scales with usage

Slide 18

Slide 18 text

Cloud Functions: Sweet Spot and Constraints Sweet Spot - Cloud Pub/Sub and GCS - Don’t care about runtime env - ETL - HTTP Constraints - Specific Languages - Interact with specific event - Function level - Duration - Max function duration: 540 s

Slide 19

Slide 19 text

Cloud Functions example: Cloud Pub/Sub with Go func Hello(ctx context.Context, m PubSubMessage) error { log.Println(string(m.Data)) // Your Logic Here... return nil }

Slide 20

Slide 20 text

Cloud Functions example: HTTP w/ node exports.helloWorld = (req, res) => { let message = 'Hello World!'; res.status(200).send(message); };

Slide 21

Slide 21 text

Cloud Functions: Supported Languages - Go 1.11 (GA) / 1.12(alpha) - Node 8(GA) / 10(beta) - Python 3.7(GA) - Java 8 (alpha) - and more…!

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

AppEngine - Developers focus on app code - No servers to manage - No Patches / updates - Versioning / Traffic Splitting

Slide 24

Slide 24 text

Standard Environment and Languages 1st generation - Python 2.7 - Java 8 - PHP 5.5 - Go 1.9 / 1.11 2nd generation - Python 3.7 - PHP 7.2 - Node.js 10 - Go 1.12 (beta) - Java 11 (alpha) - Ruby 2.5 (alpha)

Slide 25

Slide 25 text

Flexible Environment and Languages - Python - Java - PHP - Go - .NET - Ruby - and custom containers

Slide 26

Slide 26 text

AppEngine: Sweet Spot and Constraints Sweet Spot - HTTP request-response - Stateless serving Applications - Scaling to high traffic Constrains - Languages - HTTP only - Scaling (FE)

Slide 27

Slide 27 text

Why AppEngine? - More Focus on Codes - For Web serving - For Vertical Load

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

At the Day1 Keynote

Slide 30

Slide 30 text

Cloud Run - Container image with code listening on $PORT for HTTP - Managed Endpoint - SSL Termination - 1-80 concurrent requests - Timeout: 15min - Zero to 1000 instances scale - Pay for CPU and memory @100ms

Slide 31

Slide 31 text

Cloud Run on GKE - The same dev experience on Kubernetes - More flexibility control - Custom nodes / hardwares / VPC - Build on the top of existing Kubernetes - Pay for cluster

Slide 32

Slide 32 text

Cloud Run example: Go package main import ( "fmt" "log" "net/http" "os" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, os.Getenv("HELLO_MESSAGE" )) } func main() { http.HandleFunc("/", handler) log.Fatal(http.ListenAndServe (":8080", nil)) } Normal Application

Slide 33

Slide 33 text

FROM golang:1.12-alpine as build RUN apk add alpine-sdk WORKDIR $GOPATH/src/github.com/sakajunquality/hello COPY . . RUN go get -d -v ./... RUN go install -v ./... FROM alpine RUN apk add --no-cache ca-certificates COPY --from=build /go/bin/hello /usr/local/bin/hello Cloud Run example: Go Dockerfile Normal Container Image

Slide 34

Slide 34 text

Cloud Run and Cloud Run on GKE Without GKE - Fully serverless - No cluster to manage - Pay for what you use With GKE - Serverless developer experience - Run in GKE - Pay for the Cluster

Slide 35

Slide 35 text

Cloud Run: Sweet Spot and Constraints Sweet Spot - Serverless - HTTP req workload - Scale from zero to way up - No specific runtime requirements Constraints - Must be containers

Slide 36

Slide 36 text

Why Cloud Run - Serverless developer experience - Fully managed or on the top of kubernetes - Run anything with http - Open source

Slide 37

Slide 37 text

Developer Experience Container to production in seconds - Just deploy - Any stateless containers - Any languages and library - URL in seconds

Slide 38

Slide 38 text

Natively Serverless - No manage servers - Focus on code - Scale up fast - Scale to zero

Slide 39

Slide 39 text

One experience in Multi-Cloud - Managed or GKE or other environment - Portable with Knative - No vendor lock

Slide 40

Slide 40 text

Knative - OSS by Google, Pivotal and more - Extends Kubernetes Components

Slide 41

Slide 41 text

Knative - Serving - Building - Events

Slide 42

Slide 42 text

Knative in GCP - Serving => Cloud Run - Build => Cloud Build - Events => maybe

Slide 43

Slide 43 text

Serverless Decision Makings Which product to use Cloud Functions App Engine Cloud Run

Slide 44

Slide 44 text

Choosing a Serverless Option https://cloud.google.com/serverless-options/

Slide 45

Slide 45 text

- Abstraction Level and Technical Requirements - Ease of Use / Controllability and Team and Org - Billing Model Serverless Decision Makings

Slide 46

Slide 46 text

Abstraction Level and Technical Requirements Cloud Functions App Engine Cloud Run Function Code Container Runtime

Slide 47

Slide 47 text

Abstraction Level and Technical Requirements Cloud Functions App Engine Cloud Run Events HTTP Requests HTTP Requests HTTP Requests

Slide 48

Slide 48 text

Abstraction Level and Technical Requirements Cloud Functions App Engine Cloud Run Single Endpoint URL Routing App Versioning and Traffic Splitting App Versioning Support Any Languages

Slide 49

Slide 49 text

Ease of Use / Controllability and Team and Org Cloud Functions App Engine Cloud Run Events HTTP Requests HTTP Requests HTTP Requests

Slide 50

Slide 50 text

Ease of Use / Controllability and Team and Org Cloud Functions App Engine Cloud Run Ease of Use * depends Controllability *depends

Slide 51

Slide 51 text

Ease of Use / Controllability and Team and Org Cloud Functions App Engine Cloud Run More Dev Focused More Dev Focused More Dev Focused Build Tools / Cluster Management

Slide 52

Slide 52 text

Billing Model Cloud Functions App Engine Cloud Run Usage Usage Usage Resources (w/ GKE)

Slide 53

Slide 53 text

Operating? Cloud Functions App Engine Cloud Run - Metadata server - Stackdriver - Serverless VPC access

Slide 54

Slide 54 text

Making “the right” decision?

Slide 55

Slide 55 text

No Worries Brian Dorsey - Where Should I Run My Code? https://www.youtube.com/watch?v=wzPmgWJ5fpU

Slide 56

Slide 56 text

Cloud Functions App Engine Cloud Run Might be hard Easy Migrating Services

Slide 57

Slide 57 text

Serverless Fireside Chat at Next ’19

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

We did GCPUG there!

Slide 61

Slide 61 text

Fireside Chat with Serverless PM / PMM / DA / SWE - At Next 19 SF Community Corner - Googler answered questions about Serverless matters

Slide 62

Slide 62 text

https://twitter.com/sakajunquality/status/11164213527291 12576

Slide 63

Slide 63 text

Googlers - Facilitator - Martin Omander: DA, Serverless - Panel Members - Donna Malayeri : PM, GAE FE and Knative Eventing - Matt Soldo: PM, GAE SE and Migration strategy between products - Guillaume Laforge: DA, Java - Karolína Netolická: PM, Networking for serverless products - Steren Giannini - PM, Cloud Run - Filip Knapik - PM, Cloud Functions, Cloud Run - Adam - SWE, Serverless, Cloud Run

Slide 64

Slide 64 text

When will Cloud Functions properly support C# / .NET? - Will be but No ETA - Cloud Run does not support C# as gVisor has bug - Currently works on CloudRun with GKE

Slide 65

Slide 65 text

- Because CloudBuild requires billing account Why does AppEngine SE Java (8) do not require "Enabling Billing" and AppEngine SE NodeJS do need "Enabling Billing"?

Slide 66

Slide 66 text

- Definitely it’s coming - matter of couple month, or weeks Why does Cloud Run (w/GKE) not support VPC?

Slide 67

Slide 67 text

How to versioning in Cloud Run? - Like AppEngine’s versioning - That’s coming / No ETA

Slide 68

Slide 68 text

How to versioning GCF? - Not in the plan now - If this is for Cloud Pub/Sub, New Beta Pub/Sub to Cloud Run

Slide 69

Slide 69 text

Does Cloud Service Mesh have a plan to support seveless services? - In the Long term yes

Slide 70

Slide 70 text

Are Cloud Run and Function compatible with IAP? - Not Yet - If use Cloud Load Balancing with Cloud Run w/ GKE

Slide 71

Slide 71 text

- Easily move one to the other - Consistency Cloud Functions Node.js 10 now uses the same environment variable name as Knative Serving, what does this mean?

Slide 72

Slide 72 text

Cloud Run currently provides an API for Knative Serving, but how is it related to Knative Build and Knative Eventing? - Knative Build => Not in the plan - Cloud Build - Tekton - Install Knative Build CRD - Knative Eventing - working on…

Slide 73

Slide 73 text

Are there any cross-service transactions, such as data store and task queue, provided by appengine api, to be provided by gen2? - Leaving the old services for 1st Gen - Replacing as Cloud Scheduler / Cloud Task for gen 2 - Cloud Client Library

Slide 74

Slide 74 text

Deprecation Plans for Gen 1? - Active and keep supporting many years - Even if languages are no longer supported at community - Like Python 2.7 or PHP5 - Google add patches for securities

Slide 75

Slide 75 text

What's your favorite serverless service on GCP? with reasons - Cloud Scheduler - Cloud Tasks - Cloud Build - App Engine - Cloud Functions - Cloud Run - ...

Slide 76

Slide 76 text

More samples on GAE FE websocket? - Beta and coming soon

Slide 77

Slide 77 text

Cloud NAT coming to Cloud Run? - Cloud Functions soon - Cloud Run Yes but no ETA - GAE not sure

Slide 78

Slide 78 text

Takeaways Cloud Functions App Engine Cloud Run

Slide 79

Slide 79 text

- Several Choices are available for Compute Serverless on GCP - Cloud Functions / App Engine / Cloud Run - Find the sweet spot and Care about Constraints - More Languages and Runtimes are coming - More Features are coming Takeaways

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

Next and I/O videos 2019 - https://www.youtube.com/watch?v=wzPmgWJ5fpU - https://www.youtube.com/watch?v=Zfnhg1wneiA - https://www.youtube.com/watch?v=0ZCcKTlcjgE - https://www.youtube.com/watch?v=nPfsMKeBzJU - https://www.youtube.com/watch?v=7fcpwM-8qPo - https://www.youtube.com/watch?v=Jn2sKJX1NHE