Slide 1

Slide 1 text

SERVERLESS MEASUREMENT LIMITS @smithclay New Relic Based on my dotScale 2017 talk: "Searching for the Server in Serverless"

Slide 2

Slide 2 text

λ HTTP Requests Client App App Architecture with FaaS Functions + API Gateway Is this going to (not) work for me? Managed Infrastructure λ λ λ

Slide 3

Slide 3 text

Crazy idea: Let's run SSH in a λ λ ssh process

Slide 4

Slide 4 text

FaaS: Typical Metrics Error Count Function Invocation Count Function Duration (ms)

Slide 5

Slide 5 text

Event Trigger 1. Invoke λ 2. Run 3. End Result Error Timeout or or

Slide 6

Slide 6 text

Why does my function invocation time vary so much? Extremely common question with FaaS...

Slide 7

Slide 7 text

Is your λ triggered by user interaction? Yes No Monitor & make it fast (> 100ms) Monitor & still make it fast-ish

Slide 8

Slide 8 text

Cold Start vs Warm Start Event Trigger Handler Warm Function Invocation Time Create Initialize Handler Cold

Slide 9

Slide 9 text

λ Running Commands const exec = require('child_process').exec; exports.handler = (trigger, cb) => { exec('whoami', (err, stdout) => { console.log(stdout); return cb(null); }); } [LOG TIME] sbxuser_1066

Slide 10

Slide 10 text

λ is a UNIX system?! I know this!

Slide 11

Slide 11 text

Interacting this way is slow.

Slide 12

Slide 12 text

Go as a SSH Server + Tunnel-er Copy and paste Go SSH server + tunnel code (no inbound connections allowed) Execute binary on trigger Max(λ timeout)

Slide 13

Slide 13 text

Aside: Old But Still Good Advice λ Cloud vendor code "Secret Sauce Library" Keep it portable Write short handlers

Slide 14

Slide 14 text

https://github.com/smithclay/faassh

Slide 15

Slide 15 text

Info from /proc 2x Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz cat /proc/cpuinfo 3857664 kB cat /proc/meminfo ixgbevf (EC2 10Gbps Network Driver) cat /proc/modules c4.large EC2 Compute-Optimized Instance (?)

Slide 16

Slide 16 text

c4.large instance λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λs in theory on a VM 10 Gbps λ = 128 MB Function λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ λ

Slide 17

Slide 17 text

Cold Start Discovery in Code var SO_SO_COLD = true; exports.handler = function(trigger, cb) { console.log('Cold? %s', SO_SO_COLD); SO_SO_COLD = false; return callback(cb) } https://github.com/smithclay/lambda-proc-info

Slide 18

Slide 18 text

How are functions frozen? https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt cgroup freezer!

Slide 19

Slide 19 text

Warming methodology Scheduled Event λ Only effective for non- concurrent execution! 4 minute interval

Slide 20

Slide 20 text

Data collection from event-driven logs λ console.log(data) Logs λ POST to Metrics DB (Insights) Log Filter Trigger

Slide 21

Slide 21 text

Cold Starts Visualized ~7 hrs ~8 hrs

Slide 22

Slide 22 text

λ Host Hopping 10.13 10.12 10.11 10.13 10.12 10.12 10.12 10. 11 # of AZs in us-west-2: 3

Slide 23

Slide 23 text

Serverless, in brief High availability (multi-AZ or region) Elastic VMs and Automagic Freezing Containers Really good scheduling algorithm

Slide 24

Slide 24 text

4. Better utilization @ cloud scale... for the environment?

Slide 25

Slide 25 text

Measure Your Own FAAS Cost, Worst-case perf Ops/dev benefits Easier to measure Harder to measure tech people

Slide 26

Slide 26 text

FaaS Production Reality λ λ Dev Prod Orchestration (!?) Version/Deploy Monitoring Security Cold Start Mgmt The "learning cliff" Great tweet from @mfdii

Slide 27

Slide 27 text

FaaS Isn't a Silver Bullet "I've got a quick, computationally-intensive task that I need to perform occasionally in response to a well-defined event that isn't that sensitive to latency." —The Ideal FaaS Developer // TO DO: measure && share

Slide 28

Slide 28 text

Thanks. @smithclay New Relic