Next 19 Serveless App and Run

Next 19 Serveless App and Run

923237754890d536819892ad42451555?s=128

sakajunquality

May 15, 2019
Tweet

Transcript

  1. Serverless App and Run on Google Cloud Platform #gcpug #next19extended

    #ServerlessDay 19.05.15 @sakajunquality
  2. About me - Jun Sakata - @sakajunquality - Google Developers

    Expert, Cloud - Working at Ubie, Inc. - #PubSub #CloudBuild #DarkTheme
  3. None
  4. Agenda - Serverless Decision Making on GCP - Serverless Talk

    at Next 19
  5. Compute Products - Cloud Functions - App Engine - Cloud

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

    Cloud Run - Kubernetes Engine - Compute Engine
  7. Where Should I Run My Code?

  8. It depends Brian Dorsey - Where Should I Run My

    Code? https://www.youtube.com/watch?v=wzPmgWJ5fpU
  9. @briandorsey

  10. Let’s look at the each product first

  11. Seveless Products Cloud Functions AppEngine Cloud Run Cloud Functions App

    Engine Cloud Run
  12. None
  13. Compute Engine Before getting into serverless… - VMs - 416

    vCPU and 12TB RAM… - Start quickly
  14. None
  15. Kubernetes Engine One more non-serverless product - Fully Managed Kubernetes

    - Not cover much here...
  16. None
  17. 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
  18. 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
  19. 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 }
  20. Cloud Functions example: HTTP w/ node exports.helloWorld = (req, res)

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

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

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

    - Stateless serving Applications - Scaling to high traffic Constrains - Languages - HTTP only - Scaling (FE)
  27. Why AppEngine? - More Focus on Codes - For Web

    serving - For Vertical Load
  28. None
  29. At the Day1 Keynote

  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. Why Cloud Run - Serverless developer experience - Fully managed

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

    - Any stateless containers - Any languages and library - URL in seconds
  38. Natively Serverless - No manage servers - Focus on code

    - Scale up fast - Scale to zero
  39. One experience in Multi-Cloud - Managed or GKE or other

    environment - Portable with Knative - No vendor lock
  40. Knative - OSS by Google, Pivotal and more - Extends

    Kubernetes Components
  41. Knative - Serving - Building - Events

  42. Knative in GCP - Serving => Cloud Run - Build

    => Cloud Build - Events => maybe
  43. Serverless Decision Makings Which product to use Cloud Functions App

    Engine Cloud Run
  44. Choosing a Serverless Option https://cloud.google.com/serverless-options/

  45. - Abstraction Level and Technical Requirements - Ease of Use

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

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

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

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

    Functions App Engine Cloud Run Ease of Use * depends Controllability *depends
  51. 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
  52. Billing Model Cloud Functions App Engine Cloud Run Usage Usage

    Usage Resources (w/ GKE)
  53. Operating? Cloud Functions App Engine Cloud Run - Metadata server

    - Stackdriver - Serverless VPC access
  54. Making “the right” decision?

  55. No Worries Brian Dorsey - Where Should I Run My

    Code? https://www.youtube.com/watch?v=wzPmgWJ5fpU
  56. Cloud Functions App Engine Cloud Run Might be hard Easy

    Migrating Services
  57. Serverless Fireside Chat at Next ’19

  58. None
  59. None
  60. We did GCPUG there!

  61. Fireside Chat with Serverless PM / PMM / DA /

    SWE - At Next 19 SF Community Corner - Googler answered questions about Serverless matters
  62. https://twitter.com/sakajunquality/status/11164213527291 12576

  63. 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
  64. 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
  65. - Because CloudBuild requires billing account Why does AppEngine SE

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

    weeks Why does Cloud Run (w/GKE) not support VPC?
  67. How to versioning in Cloud Run? - Like AppEngine’s versioning

    - That’s coming / No ETA
  68. How to versioning GCF? - Not in the plan now

    - If this is for Cloud Pub/Sub, New Beta Pub/Sub to Cloud Run
  69. Does Cloud Service Mesh have a plan to support seveless

    services? - In the Long term yes
  70. Are Cloud Run and Function compatible with IAP? - Not

    Yet - If use Cloud Load Balancing with Cloud Run w/ GKE
  71. - 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?
  72. 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…
  73. 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
  74. 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
  75. What's your favorite serverless service on GCP? with reasons -

    Cloud Scheduler - Cloud Tasks - Cloud Build - App Engine - Cloud Functions - Cloud Run - ...
  76. More samples on GAE FE websocket? - Beta and coming

    soon
  77. Cloud NAT coming to Cloud Run? - Cloud Functions soon

    - Cloud Run Yes but no ETA - GAE not sure
  78. Takeaways Cloud Functions App Engine Cloud Run

  79. - 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
  80. None
  81. 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