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

Serverless AND Containers

Serverless AND Containers

Presented at Serverlessconf 2019 New York City by Ahmet Alp Balkan (Developer Advocate, Google Cloud) and Donna Malayeri (Product Manager, Google Cloud)

Ahmet Alp Balkan

October 09, 2019
Tweet

More Decks by Ahmet Alp Balkan

Other Decks in Technology

Transcript

  1. When we say "serverless," we're referring to services that run

    without the need for infrastructure provisioning and scaling, have built-in availability and security, and use a pay-for-valuebilling model. Serverless isn't just Lambda—it's the entire application stack. -Werner Vogels, CTO Amazon.com
  2. ABSTRACTION LAYER Runtime+infrastructure as commodity. Write snippets of code. Give

    up control over low-level details in favor of simplicity. Infrastructure as commodity. Write complete programs, packaged as "images" • HTTP server • Graceful termination, signal handling • Concurrency control Access to low-level properties: • OS/kernel options, network protocols • build/compilation/runtime options FUNCTIONS CONTAINERS
  3. DEPENDENCIES & PATCHING Container images are: • highly customizable •

    hermetic and reproducible OS is patched by the platform Runtime patches require rebuild/redeploy. OS/Runtime patches provided by the platform. Can be customizable, if you can maintain a custom runtime. FUNCTIONS CONTAINERS
  4. LANGUAGE SUPPORT Supported language/versions are often limited. Maintain your custom

    runtime to have more languages/frameworks. FUNCTIONS Run any language/framework. (x86 application binary interface) Bring custom dependencies/libs, existing apps. CONTAINERS
  5. Method signature Invoked with a "harness" added by the platform.

    • Payload: in-memory event object (event payload is already parsed) • Response: in-memory object INVOCATION CONTRACT Fully executable program Invoked via proxy/load balancer. • Payload: HTTP request (doesn't need an API Gateway) • Response: HTTP response FUNCTIONS CONTAINERS
  6. Debunking Container image myths 1. You need to learn docker

    and write Dockerfiles to build container images → CNCF Buildpacks → Language-specific builders: ko (Go), Jib (Java), … 2. Container images contain libraries/binaries you need to patch. → You can build minimal container images → static compilation, distroless
  7. VENDOR PORTABILITY Event objects are cloud/vendor specific Move horizontally or

    down. functions → functions functions → containers (Google functions-framework) Events are standardized via CloudEvents (a CNCF sandbox project). Hybrid-cloud: bare metal ⇔ VMs ⇔ Kubernetes ⇔ serverless FUNCTIONS CONTAINERS
  8. LOCAL TEST/DEV/DEBUG Write a test harness to invoke it locally.

    Learn and use serverless frameworks/SDKs FUNCTIONS CONTAINERS You write complete programs, which you can run locally. Use existing developer tools. (IDEs, profilers, debuggers, …)