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

Serverless Containers with Cloud Run

Ce3e7802c882fca3f9160768f57ae116?s=47 Mete Atamel
November 07, 2019

Serverless Containers with Cloud Run


Mete Atamel

November 07, 2019


  1. Serverless Containers with Cloud Run Mete Atamel Developer Advocate at

    Google @meteatamel
  2. Intro

  3. Operational Model Programming Model No Infra Management Managed Security Pay

    only for usage Service-based Event-driven Stateless Serverless
  4. Containers Any language Any library Any binary Ecosystem of base

    images .js .rb .go .py .sh … 0 1 0 1 0 0 1 1 1
  5. Containers Flexibility Serverless Velocity

  6. Container to production in seconds Natively Serverless One experience, where

    you want it Cloud Run Bringing serverless to containers
  7. Container to production in seconds Just ‘deploy’ Any stateless container

    Any language, any library URL in seconds
  8. Natively serverless Focus on writing code Scale up fast Scale

    down to zero Pay for exact usage No servers to manage
  9. Cloud Run Fully managed, deploy your workloads and don’t see

    the cluster. Cloud Run on Anthos Deploy into Anthos, run serverless side-by-side with your existing workloads. Knative Everywhere Use the same APIs and tooling anywhere you run Kubernetes with Knative. One experience, where you want it
  10. Basics

  11. HTTPS Endpoint Public • Website • API endpoint Private •

    Internal services • Async tasks • Mobile backend • Webhook
  12. Container contract Listen on on port $PORT (default 8080)

    HTTP server must start < 4 min (timeout → 504) Request time < 15 min (default → 5 min) Stateless (in-memory file system, doesn’t persist) Computation only within request (No background activity)
  13. Container resources 1 vCPU per container instance (non-configurable) 256 MiB

    of memory up to a max of 2 GiB (configurable) 80 concurrent requests per container (configurable 1-80) 1000 max containers by default (configurable 1-1000) Access to a Metadata Server Sandboxed by gVisor
  14. Pay per use CPU / Memory / Requests 100ms

  15. Concurrency: up to 80 concurrent requests concurrency = 1 concurrency

    = 80
  16. Billable time Instance Billable Time Request 1 Start Request 1

    End Request 2 Start Request 2 End Instance Time Billable Non-billable
  17. Other use cases

  18. Pub/Sub triggered internal services Cloud Run Cloud Pub/Sub Queue Queue

  19. Scheduled services Command Line Interface (CLI) User Interface (UI) Scheduler

    API Cloud Run Cloud Scheduler
  20. Services part of async tasks Cloud Tasks user_registration user_levelcompleted user_inapppurchase

    user_statechange Daily activity metrics service User profile service Payment processing service Game state service
  21. Confidential & Proprietary Cloud Storage to Cloud Run via Cloud

    PubSub Cloud Storage Bucket Cloud PubSub Topic Cloud Run
  22. @meteatamel cloud.google.com/run github.com/ahmetb/cloud-run-faq github.com/steren/awesome-cloudrun knative.dev Thank you!