Not so FaaS...

What's under the Hood??

Linda Nichols

@lynnaloo

Norfolk.js

norfolkjs.org

norfolkjs.org/nodebots

Last year, at ServerlessConf...

@lynnaloo

But this year, it's all about the compute products!

@lynnaloo

And a little bit about

Vin Diesel.

@lynnaloo

Because the FaaS puns are not done yet.

@lynnaloo

What are

@lynnaloo

Functions-as-a-Service (FaaS)?

The FaaS and the Furious

@lynnaloo

 

  • Stateless and ephemeral functions

  • Run in fully-managed containers

2 FaaS 2 Furious

@lynnaloo
  • Developers focus on writing code

  • Easily deploy independent services

FaaS & Furious

 

  • You pay only while your code runs

  • You don't pay for idle services

@lynnaloo
@lynnaloo

But how does it really work?

@lynnaloo
  1. Interview people who definitely know how these systems work
  2. Interview people who think they know how they work
  3. Read a lot of blogs from people who spent a lot of time poking around in cloud services

My Approach:

@lynnaloo
  1. I do want to know what's in the secret sauce and how cloud providers stay competitive
  2. I do not necessarily want to know about the internals down to each Scala or Python utility

My Conclusion:

@lynnaloo

Warning: This is the part where it gets really opinionated.

@lynnaloo

The FaaS 4

IBM Functions (OpenWhisk)

@lynnaloo
@lynnaloo

Apache OpenWhisk

 

  • Open-source serverless compute platform

  • Executes functions with event triggers

@lynnaloo

They really mean Open

@lynnaloo

A Peek Inside

 

  • The containers are Docker

  • All of the runtimes are all in Docker Hub

  • If you don't like them, roll your own!

  • You can also install it on your Kubernetes cluster

@lynnaloo

Design Summary

 

  • Load Balancing: Nginx

  • Orchestration: Custom Scala controller

  • System State: CouchDB

  • Event Bus: Kafka and Zookeeper

  • All of the above run as a container

@lynnaloo

Notes on Speed

 

  • Node.js and Python are pre-warmed and reliably fast on IBM Cloud

  • Slowest runtime is Java, but only on cold start

Azure Functions

@lynnaloo

- Jeff Hollan, Senior Program Manager for Azure Functions

@lynnaloo

"Can I be Jason Statham?"

@lynnaloo

Basic Parts

 

  • Azure's Serverless compute service

  • Focus is developer satisfaction

  • Function runtimes are open-source

  • Infrastructure is closed-source

  • Easy integrations with services like Event Grid and Logic Apps

@lynnaloo

Noteworthy Bits

 

  • All GA runtimes are "pre-warmed"

  • Java runtime is in preview, but will be GA soon

  • First class support for CloudEvents as part of EventGrid

@lynnaloo

Secrets and Rumors

 

  • Runtimes for Go and Powershell are "coming soon"

  • Working internally on better/more tools to facilitate local development

  • Azure Function Apps can be used to make much less awkward "pingers"

Google Cloud Functions

@lynnaloo
@lynnaloo

 

Cloud Functions are finally out of Beta!

@lynnaloo

Basic Parts

 

  • Google Cloud Platform's "event-driven compute service"

  • Last of the major four platforms to release a FaaS service

  • Supports both Node 8 and Python (Beta) runtimes

@lynnaloo

Mostly Speculation

 

  • Cloud Functions probably are are definitely not using Kubernetes

  • Hot Take: Knative integration completes the circle for moving on-prem workloads directly into a serverless architecture

  • Another Hot Take: Serverless Containers is more interesting than Knative.   

Amazon Lambda

@lynnaloo
@lynnaloo

- Anonymous

"It's not using Kubernetes."

@lynnaloo

Actual photo of AWS Lambda architecture....

@lynnaloo
@lynnaloo

(just kidding)

The Basics

@lynnaloo

 

  • AWS Lambda was the first major FaaS service and is still the most widely used

  • There are more Lambdas in production than any other FaaS service

  • Has an execution environment of some sort that might be a is not a "container"

Interesting Bits

@lynnaloo

 

  • AWS operates internally less like a startup and more like a bank or trading floor

  • The future focus for Lambda is Enterprise support and adoption

  • Security and performance are key

  • AWS dogfoods Lambda internally and is supporting many services

In the Engine

@lynnaloo

 

  • Lambdas using Go are the fastest, followed by Java (not a cold start)

  • While C# is the slowest, it's a really tiny difference (sub-ms)

  • If you allocate more than 1.8GB of memory, it will get a multi-core CPU

All These Rumors

@lynnaloo

 

 

  • If a runtime needs patching, all containers will be updated within 12 hours

  • Amazon will make cold starts not a thing by the end of the year

  • While not the primary focus, a hybrid-cloud solution may be in the near future

So, which is the FaaStest?

@lynnaloo

It depends.

@lynnaloo
@lynnaloo

 

  • Don't create monolithic functions

  • Reduce unused dependencies

  • Minimize the code you write

  • Don't use Functions to replace other cloud services

  • Don't ping more than every 5 minutes

FaaS Racing Tips

'use strict';

const catNames = require('cat-names');

function getCatName(event, context, callback) {
    callback(null, { payload: `Your cat name is ${catNames.random()}.` });
}

module.exports = getCatName;
@lynnaloo

One Function, One Function

@lynnaloo

Thank You!

@lynnaloo

  • https://www.jeremydaly.com/15-key-takeaways-from-the-serverless-talk-at-aws-startup-day/

  • https://epsagon.com/blog/lambda-internals-exploring-aws-lambda

  • https://read.acloud.guru/comparing-aws-lambda-performance-when-using-node-js-java-c-or-python-281bef2c740f

  • https://functionmonkey.azurefromthetrenches.com/

 

 

  • https://medium.com/@PaulDJohnston/why-aws-lambda-and-zip-is-a-recipe-for-serverless-success-4f547a6e87c3

  • https://thenewstack.io/behind-scenes-apache-openwhisk-serverless-platform/

  • https://medium.com/openwhisk/uncovering-the-magic-how-serverless-platforms-really-work-3cb127b05f71

Credits:

Not so FaaS... what's under the hood?

By Linda Nichols

Not so FaaS... what's under the hood?

ServerlessConf 2018: What if I really do want to know about the servers that run my code? How are the containers built? What makes one service faster or more efficient than another? Is it worth losing the transparency and going with a popular cloud provider service, or do you want to retain some control and use a 3rd party service? If we take a peek into the magic behind these managed services, what would we find? What is under the hood of Functions as a Service?

  • 2,295