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. View Slide

  2. View Slide

  3. CONTAINERS VS SERVERLESS
    and

    View Slide

  4. Donna Malayeri
    Product Manager, Google Cloud
    @lindydonna
    Ahmet Alp Balkan
    Developer Advocate, Google Cloud
    @ahmetb

    View Slide

  5. What do we agree on

    View Slide

  6. SERVERLESS > FUNCTIONS
    no ops
    fast autoscaling
    pay-per-use
    built-in security

    View Slide

  7. 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

    View Slide

  8. There are serverless containers.
    Google Cloud Run, Knative, AWS Fargate ...

    View Slide

  9. Functions vs Containers

    View Slide

  10. 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

    View Slide

  11. 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

    View Slide

  12. 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

    View Slide

  13. 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

    View Slide

  14. But I hate docker and
    don't want to learn containers

    View Slide

  15. 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

    View Slide

  16. 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

    View Slide

  17. 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, …)

    View Slide

  18. Containers can be serverless,
    but there are tradeoffs.
    control
    simplicity

    View Slide

  19. @ahmetb @lindydonna

    View Slide