$30 off During Our Annual Pro Sale. View Details »

Searching for the Server in Serverless

Searching for the Server in Serverless

Function as a Service (FaaS) products like AWS Lambda are more popular than ever. How do we measure and design for performance and learn more about how these services are built?

Presented at dotScale Paris 4/24/17.

Clay Smith

April 24, 2017
Tweet

More Decks by Clay Smith

Other Decks in Programming

Transcript

  1. Searching for the Server
    in Serverless
    @smithclay
    New Relic
    dotScale April 24, 2017

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  7. λ Discovery v2 with SSH Server
    λ
    ssh process

    View Slide

  8. 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 (?)

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  12. Cold starts, visually
    ~7 hrs ~8 hrs

    View Slide

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

    View Slide

  14. Design Your Own FAAS
    High availability (multi-AZ or region)
    Elastic VMs and Automagic Freezing Containers
    Really good scheduling algorithm

    View Slide

  15. FaaS: No 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

    View Slide

  16. Thanks.
    @smithclay
    New Relic
    dotScale April 24, 2017

    View Slide