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

Next 19 Serveless App and Run

Next 19 Serveless App and Run

sakajunquality

May 15, 2019
Tweet

More Decks by sakajunquality

Other Decks in Technology

Transcript

  1. About me - Jun Sakata - @sakajunquality - Google Developers

    Expert, Cloud - Working at Ubie, Inc. - #PubSub #CloudBuild #DarkTheme
  2. Compute Products - Cloud Functions - App Engine - Cloud

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

    Cloud Run - Kubernetes Engine - Compute Engine
  4. It depends Brian Dorsey - Where Should I Run My

    Code? https://www.youtube.com/watch?v=wzPmgWJ5fpU
  5. 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
  6. 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
  7. 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 }
  8. Cloud Functions example: HTTP w/ node exports.helloWorld = (req, res)

    => { let message = 'Hello World!'; res.status(200).send(message); };
  9. 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…!
  10. AppEngine - Developers focus on app code - No servers

    to manage - No Patches / updates - Versioning / Traffic Splitting
  11. 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)
  12. Flexible Environment and Languages - Python - Java - PHP

    - Go - .NET - Ruby - and custom containers
  13. AppEngine: Sweet Spot and Constraints Sweet Spot - HTTP request-response

    - Stateless serving Applications - Scaling to high traffic Constrains - Languages - HTTP only - Scaling (FE)
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. Why Cloud Run - Serverless developer experience - Fully managed

    or on the top of kubernetes - Run anything with http - Open source
  21. Developer Experience Container to production in seconds - Just deploy

    - Any stateless containers - Any languages and library - URL in seconds
  22. One experience in Multi-Cloud - Managed or GKE or other

    environment - Portable with Knative - No vendor lock
  23. Knative in GCP - Serving => Cloud Run - Build

    => Cloud Build - Events => maybe
  24. - Abstraction Level and Technical Requirements - Ease of Use

    / Controllability and Team and Org - Billing Model Serverless Decision Makings
  25. Abstraction Level and Technical Requirements Cloud Functions App Engine Cloud

    Run Events HTTP Requests HTTP Requests HTTP Requests
  26. 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
  27. Ease of Use / Controllability and Team and Org Cloud

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

    Functions App Engine Cloud Run Ease of Use * depends Controllability *depends
  29. 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
  30. No Worries Brian Dorsey - Where Should I Run My

    Code? https://www.youtube.com/watch?v=wzPmgWJ5fpU
  31. Fireside Chat with Serverless PM / PMM / DA /

    SWE - At Next 19 SF Community Corner - Googler answered questions about Serverless matters
  32. 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
  33. 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
  34. - Because CloudBuild requires billing account Why does AppEngine SE

    Java (8) do not require "Enabling Billing" and AppEngine SE NodeJS do need "Enabling Billing"?
  35. - Definitely it’s coming - matter of couple month, or

    weeks Why does Cloud Run (w/GKE) not support VPC?
  36. How to versioning GCF? - Not in the plan now

    - If this is for Cloud Pub/Sub, New Beta Pub/Sub to Cloud Run
  37. Are Cloud Run and Function compatible with IAP? - Not

    Yet - If use Cloud Load Balancing with Cloud Run w/ GKE
  38. - 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?
  39. 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…
  40. 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
  41. 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
  42. What's your favorite serverless service on GCP? with reasons -

    Cloud Scheduler - Cloud Tasks - Cloud Build - App Engine - Cloud Functions - Cloud Run - ...
  43. Cloud NAT coming to Cloud Run? - Cloud Functions soon

    - Cloud Run Yes but no ETA - GAE not sure
  44. - 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
  45. 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