Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What We Learned from Building Edge Compute

What We Learned from Building Edge Compute

In this presentation, I explain what we have learned from building compute services at the edge by diving into three engineering different projects.

This version of the talk was given at the 2023 Edition of Open Source Summit North America as part of the "Cloud Open" track.

Kerim Satirli
PRO

May 11, 2023
Tweet

More Decks by Kerim Satirli

Other Decks in Programming

Transcript

  1. What We Learned From
    Building Edge Compute

    View Slide

  2. Sr. Developer Advocate at HashiCorp
    he / him
    @ksatirli
    Kerim
    Satirli

    View Slide

  3. edge com·put·ing
    noun
    computing that takes place at or
    near the physical location of the
    producer or consumer of data.
    point of presence mobile datacenter
    Similar:

    View Slide

  4. 01
    The Airport
    Over-engineering a thermostat

    View Slide

  5. "pnr": "RMT33W",

    "action": "boarding"

    View Slide

  6. Challenge:
    understand an area's pulse

    View Slide

  7. Solution:
    deploy wireless IoT network

    View Slide

  8. var C // capacity (mAh)
    var I // current when in sleep mode (mA)
    var Imeas // current in measurement mode (mA)
    var Irx // current in Rx mode (mA)
    var Itx // current in Tx mode (mA)
    var N // measurements (count)
    var T // milliseconds per hour (3.6M)
    var Tmeas // duration of measurement mode (ms)
    var Trx // duration of Rx mode (ms)
    var Ttx // duration of Tx mode (ms)
    var U // usable capacity incl. self-discharge (percentage)
    Projecting Battery Capacity

    View Slide

  9. // active capacity usage / day
    var cA = ((N * ((Ttx * Itx) + (Trx * Irx) + (Tmeas * Imeas))) / T)
    // sleep capacity usage / day
    var cS = I * (24 - ((Ttx + Trx + Tmeas) * N) / T)
    // total capacity consumed / day
    var cT = cA + cS
    // projected battery life
    var Bd = (cU / cT) / 24 // in days
    var By = Bd / 365.25 // in years
    Projecting Battery Capacity

    View Slide

  10. = 7.6 years
    !

    View Slide

  11. Occupancy Sensor
    0
    20
    40
    60
    80
    100
    Q4 2018 Q2 Q3 Q4 2019 2022 2023
    "
    #
    $
    Graphing Battery Capacity

    View Slide

  12. // assembled and decoded payload (via webhook)
    var payload
    // remaining battery capacity (0...254)
    var capacity = var.payload.capacity
    // remaining battery capacity (0...254)
    var capacity_in_percent = (var.capacity / 254) * 100
    // overwrite capacity value with percentage-based one
    payload.capacity = var.capacity_in_percent
    Calculating Battery Capacity

    View Slide

  13. Learning:
    go beyond the software

    View Slide

  14. 02
    The Grocer
    Orchestrating a DDoS from within

    View Slide

  15. 150 x
    hypermarkets
    63 x
    supermarkets
    1000 x
    minimarkets

    View Slide

  16. + 37 points

    View Slide

  17. {
    "id": "5d1caf08-4235-451d-9fac-4f8d56e89e2e",
    "timestamp": "2023-01-01T05:01:57Z",
    "card": "966255423827",
    "amount": "37.26"
    }
    Customer Transaction Data

    View Slide

  18. single transaction size 200 Bytes
    envelopes and overages + 1.25 x
    per-store transactions 2500
    per-store transaction size 610 Kilobytes
    total transaction size 723 Megabytes
    total transaction count 3.032.500
    Customer Transaction Data

    View Slide

  19. Challenge:
    don't DDoS ourselves

    View Slide

  20. Solution:
    build a local "cache"

    View Slide

  21. SQLite packages the entire
    database into a single,
    cross-platform compatible file.
    - SQLite documentation

    View Slide

  22. Learning:
    develop with constraints

    View Slide

  23. Learning:
    build for offline-first

    View Slide

  24. 03
    The Farm
    Feeding without the Frenzy

    View Slide

  25. 2 out of 3 farms use IIoT
    but farmers aren't SW engs

    View Slide

  26. View Slide

  27. View Slide

  28. Learning:
    optimize generously

    View Slide

  29. Learning:
    use boring hardware

    View Slide

  30. edge compute nodes 115
    containerized workloads 900
    data transfer / month 80 Terabytes
    combined memory 115 Gigabytes
    combined CPU 103 GHz
    Boring Hardware?

    View Slide

  31. Powerful Food
    arstechnica.com/science/2023/05/researchers-craft-a-fully-edible-battery

    View Slide

  32. Thank you
    speakerdeck.com/ksatirli

    View Slide