63
@ewindisch @IOpipes The Truth Behind Serverless CTO & Co-founder, IOpipe Erica Windisch

The Truth Behind Serverless

Embed Size (px)

Citation preview

@ewindisch @IOpipes

The Truth Behind Serverless

CTO & Co-founder, IOpipe

Erica Windisch

@ewindisch @IOpipes

What-a-less?

@ewindisch @IOpipes

ServerlessCultureDon’t build, when you can buy. Build as little as necessary.

Build with the minimum operational complexity.

Maybe all you need are some circles

@ewindisch @IOpipes

@ewindisch @IOpipes

@ewindisch @IOpipes

@ewindisch @IOpipes

@ewindisch @IOpipes

The 12 Factor AppI. Codebase One codebase tracked in revision control, many deploys II. Dependencies Explicitly declare and isolate dependencies III. Config Store config in the environment IV. Backing services Treat backing services as attached resources V. Build, release, run Strictly separate build and run stages VI. Processes Execute the app as one or more stateless processes

VII. Port binding Export services via port binding VIII. Concurrency Scale out via the process model IX. Disposability Maximize robustness with fast startup and graceful shutdown X. Dev/prod parity Keep development, staging, and production as similar as possible XI. Logs Treat logs as event streams XII. Admin processes Run admin/management tasks as one-off processes

@ewindisch @IOpipes

Amazon’s “Serverless (functions) Manifesto”✤ Function are the unit of deployment and scaling. ✤ No machines, VMs, or containers visible in the programming model. ✤ Permanent storage lives elsewhere. ✤ Scales per request; Users cannot over- or under-provision capacity. ✤ Never pay for idle (no cold servers/containers or their costs). ✤ Implicitly fault-tolerant because functions can run anywhere. ✤ BYOC - Bring Your Own Code. ✤ Metrics and logging are a universal right.

@ewindisch @IOpipes

@ewindisch @IOpipes

Platforms- AWS Lambda - Azure Functions - Google Cloud

Functions - Oracle’s fn() - IBM Bluemix

Functions - OpenWhisk - Spring Functions

- Galactic Fog - Stdlib - Now.sh - Auth0 Webtasks &

Extend - AppEngine Classic - Heroku - Parse - Firebase

- Google PubSub - Google BigQuery - AWS S3 - AWS SNS - AWS Athena - AWS Kinesis - AWS DynamoDB & more

@ewindisch @IOpipes

Platforms - FaaS providers- AWS Lambda - Azure Functions - Google Cloud

Functions - Oracle’s fn() - IBM Bluemix

Functions - OpenWhisk - Spring Functions

- Galactic Fog - Stdlib - Now.sh - Auth0 Webtasks &

Extend - AppEngine Classic - Heroku - Parse - Firebase

- Google PubSub - Google BigQuery - AWS S3 - AWS SNS - AWS Athena - AWS Kinesis - AWS DynamoDB & more

@ewindisch @IOpipes

Platforms - Event sources- AWS Lambda - Azure Functions - Google Cloud

Functions - Oracle’s fn() - IBM Bluemix

Functions - OpenWhisk - Spring Functions

- Galactic Fog - Stdlib - Now.sh - Auth0 Webtasks &

Extend - AppEngine Classic - Heroku - Parse - Firebase

- Google PubSub - Google BigQuery - AWS S3 - AWS SNS - AWS Athena - AWS Kinesis - AWS DynamoDB & more

@ewindisch @IOpipes

75 GB storage limit for all functions

@ewindisch @IOpipes

5 minute maximum duration

@ewindisch @IOpipes

~20ms for “hello world”

@ewindisch @IOpipes

128MB to 1.5GB memory

@ewindisch @IOpipes

1000 containers max (by default)

@ewindisch @IOpipes

Functions lazy-loaded from s3

@ewindisch @IOpipes

Containers + processes long-lived, automatically scaled and garbage-collected.

4.5 minutes to 4.5 hours

@ewindisch @IOpipes

Pauses / unpauses containers between events

@ewindisch @IOpipes

non-root user

@ewindisch @IOpipes

/ read-only /tmp 512MB max

function mounted to /var/task

@ewindisch @IOpipes

Amazon’s “Serverless (functions) Manifesto”✤ Function are the unit of deployment and scaling. ✤ No machines, VMs, or containers visible in the programming model. ✤ Permanent storage lives elsewhere. ✤ Scales per request; Users cannot over- or under-provision capacity. ✤ Never pay for idle (no cold servers/containers or their costs). ✤ Implicitly fault-tolerant because functions can run anywhere. ✤ BYOC - Bring Your Own Code. ✤ Metrics and logging are a universal right.

@ewindisch @IOpipes

Demo Slide

Click to add text

@ewindisch @IOpipes

App CreationUpload to S3

CreateFunction API call pointing to S3 resource

@ewindisch @IOpipes

WarmingAmazon automatically scales VMs & allocates to users. They do not warm processes/containers

@ewindisch @IOpipes

Triggers & Events- Invoke functions via API

- Configure event source to function mappings

@ewindisch @IOpipes

ScheduleEvents are mapped to running containers first,

Or new containers are spawned to process events.

@ewindisch @IOpipes

InvokeSynchronous HTTP API Container is spawned, if not existing.

Existing container is unpaused, fed event, then paused.

@ewindisch @IOpipes

VisibilityLogs and metrics are sent to Cloudwatch.

@ewindisch @IOpipes

Garbage Collection- Reap containers when they're no longer active

- Reap VMs when they’re no longer active

@ewindisch @IOpipes

Orchestration Challenges

@ewindisch @IOpipes

Scaling VMs and scaling containers

@ewindisch @IOpipes

Each tenant needs a container cluster?

@ewindisch @IOpipes

Are Kubernetes or Swarm fast enough?

@ewindisch @IOpipes

HTTP + serialization/deserializationfor series of events are SLOW

@ewindisch @IOpipes

Implementation Details

@ewindisch @IOpipes

How to minimize latency of API processing & response?

@ewindisch @IOpipes

how do we do messaging / communication?

@ewindisch @IOpipes

How do we manage state?

@ewindisch @IOpipes

How do we orchestrate containers?

@ewindisch @IOpipes

Which language?

@ewindisch @IOpipes

Putting it back togetherhttps://prezi.com/view/K5Xz8xT6BoTYbx2EgGk1/

@ewindisch @IOpipes

Finally…

@ewindisch @IOpipes

Remember…

@ewindisch @IOpipes

It’s all about the events.

@ewindisch @IOpipes

Events are always immutable.

@ewindisch @IOpipes

Event processing can and should be immutable.

@ewindisch @IOpipes

Event processing should be fast & low-latency.

@ewindisch @IOpipes

Events generate events.(it’s turtles all the way down)

@ewindisch @IOpipes

FaaS architecture should be designed for performance and immutability

@ewindisch @IOpipes

Don’t build when you can buy(you probably shouldn’t build anything I just showed you!)

Erica Windisch CTO & Founder IOpipe, Inc.

@ewindisch

www.iopipe.com