Top Banner
DIY IoT Backend Voon Siong WONG
30

DIY IoT Backend

Feb 11, 2017

Download

Technology

DiUS
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DIY IoT Backend

DIYIoTBackendVoonSiongWONG

Page 2: DIY IoT Backend

greenfields

Page 3: DIY IoT Backend

greenfields4yearsago,wantedIoTplatform

noclearrequirementsgreworganicallyflawsinhindsightneverinproduction,neverfixedhobbyproject

Page 4: DIY IoT Backend

revisitedtheprojectmadelistofgood,bad,andhowitcanbebetter

development~2weeks,~800LOCRubyrunson1xt2.smallinstanceresponsetimeaverage50ms,95%<80ms

learntfromalotofbadexperiences

Page 5: DIY IoT Backend

disclaimernotnecessarilyadvocatingDIY

outsourcingto3rdpartyvendorscanbecheaper

dependsonin-housecapabilities

Page 6: DIY IoT Backend

Let'sGetStarted

Page 7: DIY IoT Backend

item1:timeseriesdon'tDIYtimeseries

v1hadtodoit,notmanyopensource

v2usedopensourcedatabase,threwoutatonofcode

Page 8: DIY IoT Backend

read/writeoptimisationishard

use1-Dsortforindexoptimisationusuallytimeasprimaryindexoverwriteorappendforsametimestamp?aggregatingacrossmultipletables?

geo-spatialcapabilities

eg.measurementsinthisareaatthistime4-D"sort"

Page 9: DIY IoT Backend

wetriedbuildingonebasedon

carefulplanningofRow-key&Column-key

onlysupportedoverwrite,noappends

fixedtimeintervals

aggregationwerescheduledtasks,ratherthanqueries

poorperformance

HBase

Page 10: DIY IoT Backend

unlessyourjobistobuilddatabases,don't

outsideofyourcontrolifyou'reusingvendor

Page 11: DIY IoT Backend

item2:authenticationtreatbrowsersandiotdevicesequallyasfirstclasscitizens

accessiblewithfixedorvariableAPIkeys

optionallywithusername/password

Page 12: DIY IoT Backend

avoidclientSSL

cumbersometogenerate/manageimpracticaltoinstallonbrowsersthusrequiresproxyserver

useAPIKeys

fixedAPIkeysvariableAPIkey,HMACrequestandtimedeploywithenvironmentvariables

interactivelogins

username/passwordoauth

Page 13: DIY IoT Backend

item3:expectchangeplanforit

veryrelevantwhenDIY

butuseascriteriaforjudgingvendors

manyvendorsarestillyoung

Page 14: DIY IoT Backend

ensureAPIsareversioned

usingpath,headers,requestparams,etc.

deprecations

devicesdon't/can'tunderstandwarningmessageswarndevelopersdirectly

returnsuccessondeadAPIs

don'tcareabouttheirbehaviouranymoreavoidolddevices'sretrylogicfromhammeringit

Page 15: DIY IoT Backend

APIownershipAPIscanmakeorbreakyourapplication

oneofstrongestreasonstoDIY

don'tforgetthatitchanges!

Page 16: DIY IoT Backend

Item4:modelassociationsdon'tenforceaschemaformodelrelationships

embraceschema-less,becausesensorsare

Page 17: DIY IoT Backend

schema/syntactic

fixedassociations,inflexibleneedtoknow"position"inhierarchy/groupingconflictswhenreusingnames

schema-less/semantic

uniquenessbycredentialsandnamehierarchiesorgroupingstoredintext,eg."state/suburb/street",arbitrarilydelimited

Page 18: DIY IoT Backend

item5:dataflowstricklesfromdevicetoserver

streamsfromservertoadvancedclients

Page 19: DIY IoT Backend

useregularsession-lessHTTPforsmallvolumes

forgreatervolume,useapub-submechanism

,subscribetodesiredchannels

modernclientsuse(uni-directional)websockets,resumeonconnectionfailuresolderclientsfallbacktolong-polling

firehoseserver

Page 20: DIY IoT Backend

item*:nuts&boltsmeasurementunits

overwritevsappend

don'trequireSNI

prefertimesinceepoch

textoverbinary

Page 21: DIY IoT Backend

IoTBackend:SolvedProblem?

Page 23: DIY IoT Backend

focusonvaluethislistapplywhetheryou'reDIYbackend,orevaluatingvendors

notsuggestingoneortheother,that'suptoyou

suggestyouthinkaboutvalue,ratherthantechnicalcapability

Ican,shouldI?

Page 24: DIY IoT Backend

worthit?inourcase,DIYwasworthit

(re)developmenteffortwassmall

lessonsfrompreviousgeneration

in-houseknowledgeonhowtofixthings

Page 25: DIY IoT Backend

LiveVu

Realtimeenergymonitoring

Page 26: DIY IoT Backend

Real-time Energy Monitor

Your Energy Use

CONSUMPTION

6.06kW

COST

$1.51per hour

HISTORY

kW

6

5.8

6.2

6.4

10:40 10:45

Last 10 mins

2015 DiUS Computing Inc.

Page 27: DIY IoT Backend

SmokeAlert

AirQualityMonitoring

Page 28: DIY IoT Backend

22/09/2015@10:00

22-September-2015

+-

SmokeAlert Enter a location Legend About Privacy Terms

Page 29: DIY IoT Backend

disclaimer(repeat)notnecessarilyadvocatingDIY

outsourcingto3rdpartyvendorscanbecheaper

dependsonin-housecapabilities

Page 30: DIY IoT Backend

Thanks!