DIY IoT Backend Voon Siong WONG greenfields greenfields 4 years - - PowerPoint PPT Presentation

diy iot backend
SMART_READER_LITE
LIVE PREVIEW

DIY IoT Backend Voon Siong WONG greenfields greenfields 4 years - - PowerPoint PPT Presentation

DIY IoT Backend Voon Siong WONG greenfields greenfields 4 years ago, wanted IoT platform no clear requirements grew organically flaws in hindsight never in production, never fixed hobby project revisited the project made list of good,


slide-1
SLIDE 1

DIY IoT Backend

Voon Siong WONG

slide-2
SLIDE 2

greenfields

slide-3
SLIDE 3

greenfields

4 years ago, wanted IoT platform no clear requirements grew organically flaws in hindsight never in production, never fixed hobby project

slide-4
SLIDE 4

revisited the project

made list of good, bad, and how it can be better development ~2 weeks, ~800 LOC Ruby runs on 1x t2.small instance response time average 50ms, 95% < 80ms learnt from a lot of bad experiences

slide-5
SLIDE 5

disclaimer

not necessarily advocating DIY

  • utsourcing to 3rd party vendors can be cheaper

depends on in-house capabilities

slide-6
SLIDE 6

Let's Get Started

slide-7
SLIDE 7

item 1: time series

don't DIY time series v1 had to do it, not many open source v2 used open source database, threw out a ton of code

slide-8
SLIDE 8

read/write optimisation is hard use 1-D sort for index optimisation usually time as primary index

  • verwrite or append for same timestamp?

aggregating across multiple tables? geo-spatial capabilities

  • eg. measurements in this area at this time

4-D "sort"

slide-9
SLIDE 9

we tried building one based on HBase careful planning of Row-key & Column-key

  • nly supported overwrite, no appends

fixed time intervals aggregation were scheduled tasks, rather than queries poor performance

slide-10
SLIDE 10

unless your job is to build databases, don't

  • utside of your control if you're using vendor
slide-11
SLIDE 11

item 2: authentication

treat browsers and iot devices equally as first class citizens accessible with fixed or variable API keys

  • ptionally with username/password
slide-12
SLIDE 12

avoid client SSL cumbersome to generate/manage impractical to install on browsers thus requires proxy server use API Keys fixed API keys variable API key, HMAC request and time deploy with environment variables interactive logins username/password

  • auth
slide-13
SLIDE 13

item 3: expect change

plan for it very relevant when DIY but use as criteria for judging vendors many vendors are still young

slide-14
SLIDE 14

ensure APIs are versioned using path, headers, request params, etc. deprecations devices don't / can't understand warning messages warn developers directly return success on dead APIs don't care about their behaviour any more avoid old devices's retry logic from hammering it

slide-15
SLIDE 15

API ownership

APIs can make or break your application

  • ne of strongest reasons to DIY

don't forget that it changes!

slide-16
SLIDE 16

Item 4: model associations

don't enforce a schema for model relationships embrace schema-less, because sensors are

slide-17
SLIDE 17

schema / syntactic fixed associations, inflexible need to know "position" in hierarchy / grouping conflicts when reusing names schema-less / semantic uniqueness by credentials and name hierarchies or grouping stored in text, eg. "state/suburb/street", arbitrarily delimited

slide-18
SLIDE 18

item 5: data flows

trickles from device to server streams from server to advanced clients

slide-19
SLIDE 19

use regular session-less HTTP for small volumes for greater volume, use a pub-sub mechanism , subscribe to desired channels modern clients use (uni-directional) websockets, resume on connection failures

  • lder clients fallback to long-polling

firehose server

slide-20
SLIDE 20

item *: nuts & bolts

measurement units

  • verwrite vs append

don't require SNI prefer time since epoch text over binary

slide-21
SLIDE 21
slide-22
SLIDE 22

IoT Backend: Solved Problem?

slide-23
SLIDE 23

IoT for hire

authentication, data aggregation, remote control, etc. for hire still maturing sector...

slide-24
SLIDE 24

focus on value

this list apply whether you're DIY backend, or evaluating vendors not suggesting one or the other, that's up to you suggest you think about value, rather than technical capability I can, should I?

slide-25
SLIDE 25

worth it?

in our case, DIY was worth it (re)development effort was small lessons from previous generation in-house knowledge on how to fix things

slide-26
SLIDE 26

LiveVu

Realtime energy monitoring

slide-27
SLIDE 27
slide-28
SLIDE 28

SmokeAlert

Air Quality Monitoring

slide-29
SLIDE 29
slide-30
SLIDE 30

disclaimer (repeat)

not necessarily advocating DIY

  • utsourcing to 3rd party vendors can be cheaper

depends on in-house capabilities

slide-31
SLIDE 31

Thanks!