the design of an acquisitional query processor for sensor networks

28
The Design of an The Design of an Acquisitional Query Acquisitional Query Processor For Sensor Processor For Sensor Networks Networks Samuel Madden, Michael J. Samuel Madden, Michael J. Franklin, Joseph M. Franklin, Joseph M. Hellerstein, and Wei Hong Hellerstein, and Wei Hong Presentation by John Lynn Presentation by John Lynn

Upload: wesley

Post on 19-Mar-2016

23 views

Category:

Documents


0 download

DESCRIPTION

The Design of an Acquisitional Query Processor For Sensor Networks. Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei Hong Presentation by John Lynn. Overview. Goals Acquisitional Query Language Optimizations Future Work Conclusions Discussion. Goals. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Design of an Acquisitional Query Processor For Sensor Networks

The Design of an The Design of an Acquisitional Query Acquisitional Query

Processor For Sensor Processor For Sensor NetworksNetworks

Samuel Madden, Michael J. Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, Franklin, Joseph M. Hellerstein,

and Wei Hongand Wei Hong

Presentation by John LynnPresentation by John Lynn

Page 2: The Design of an Acquisitional Query Processor For Sensor Networks

OverviewOverview GoalsGoals Acquisitional Query LanguageAcquisitional Query Language OptimizationsOptimizations Future WorkFuture Work ConclusionsConclusions DiscussionDiscussion

Page 3: The Design of an Acquisitional Query Processor For Sensor Networks

GoalsGoals Provide a query processor-like Provide a query processor-like

interface to sensor networksinterface to sensor networks Use acquisitional techniques to Use acquisitional techniques to

reduce power consumption reduce power consumption compared to traditional passive compared to traditional passive systemssystems

Page 4: The Design of an Acquisitional Query Processor For Sensor Networks

How?How? What is meant by acquisitional What is meant by acquisitional

techniques?techniques? Where, when, and how often.Where, when, and how often.

Four related questionsFour related questions When should samples be taken?When should samples be taken? What sensors have relevant data?What sensors have relevant data? In what order should samples be taken?In what order should samples be taken? Is it worth it?Is it worth it?

Page 5: The Design of an Acquisitional Query Processor For Sensor Networks

What’s the big deal?What’s the big deal? Radio consumes as much power as Radio consumes as much power as

the CPUthe CPU Transmitting one bit of data Transmitting one bit of data

consumes as much energy as 1000 consumes as much energy as 1000 CPU instructions!CPU instructions!

Message sizes in TinyDB are by Message sizes in TinyDB are by default 48 bytesdefault 48 bytes

Sensing takes significant energySensing takes significant energy

Page 6: The Design of an Acquisitional Query Processor For Sensor Networks

An Acquisitional Query An Acquisitional Query LanguageLanguage

SQL-like queries in the form of SQL-like queries in the form of SELECT-FROM-WHERESELECT-FROM-WHERE

Support for selection, join, Support for selection, join, projection, and aggregationprojection, and aggregation

Also support for sampling, Also support for sampling, windowing, and sub-querieswindowing, and sub-queries

Not mentioned is the ability to log Not mentioned is the ability to log data and actuate physical hardwaredata and actuate physical hardware

Page 7: The Design of an Acquisitional Query Processor For Sensor Networks

An Acquisitional Query An Acquisitional Query LanguageLanguage

Example:Example:SELECT nodeid, light, tempSELECT nodeid, light, temp

FROM sensorsFROM sensorsSAMPLE INTERVAL 1s FOR 10sSAMPLE INTERVAL 1s FOR 10s

Sensors viewed as a single tableSensors viewed as a single table Columns are sensor dataColumns are sensor data Rows are individual sensorsRows are individual sensors

Page 8: The Design of an Acquisitional Query Processor For Sensor Networks

Queries as a StreamQueries as a Stream Sensors table is an unbounded, Sensors table is an unbounded,

continuous data streamcontinuous data stream Operations such as sort and Operations such as sort and

symmetric join are not allowed on symmetric join are not allowed on streamsstreams

They are allowed on bounded They are allowed on bounded subsets of the stream (windows)subsets of the stream (windows)

Page 9: The Design of an Acquisitional Query Processor For Sensor Networks

WindowsWindows Windows in TinyDB are fixed-size Windows in TinyDB are fixed-size

materialization pointsmaterialization points Materialization points can be used in Materialization points can be used in

queriesqueries ExampleExample

CREATECREATESTORAGE POINT recentlight SIZE 8STORAGE POINT recentlight SIZE 8AS (SELECT nodeid, light FROM sensorsAS (SELECT nodeid, light FROM sensorsSAMPLE INTERVAL 10s)SAMPLE INTERVAL 10s)

SELECT COUNT(*)SELECT COUNT(*)FROM sensors AS s, recentlight AS r1FROM sensors AS s, recentlight AS r1WHERE r.nodeid = s.nodeidWHERE r.nodeid = s.nodeidAND s.light < r1.lightAND s.light < r1.lightSAMPLE INTERVAL 10sSAMPLE INTERVAL 10s

Page 10: The Design of an Acquisitional Query Processor For Sensor Networks

Temporal AggregationTemporal Aggregation ExampleExample

SELECT WINAVG(volume, 30s, 5s)SELECT WINAVG(volume, 30s, 5s)FROM sensorsFROM sensorsSAMPLE INTERVAL 1sSAMPLE INTERVAL 1s

Receive only 6 results from each Receive only 6 results from each sensor instead of 30sensor instead of 30

Page 11: The Design of an Acquisitional Query Processor For Sensor Networks

Event-Based QueriesEvent-Based Queries An alternative to continuous polling for dataAn alternative to continuous polling for data ExampleExample

ON EVENT bird-detector(loc):ON EVENT bird-detector(loc):SELECT AVG(light), AVG(temp), event.locSELECT AVG(light), AVG(temp), event.locFROM sensors AS sFROM sensors AS sWHERE dist(s.loc, event.loc) < 10mWHERE dist(s.loc, event.loc) < 10mSAMPLE INTERVAL 2s FOR 30sSAMPLE INTERVAL 2s FOR 30s

Page 12: The Design of an Acquisitional Query Processor For Sensor Networks

Lifetime-Based QueriesLifetime-Based Queries ExampleExample

SELECT nodeid, accelSELECT nodeid, accelFROM sensorsFROM sensorsLIFETIME 30 daysLIFETIME 30 days

Nodes perform cost-based analysis Nodes perform cost-based analysis in order to determine data ratein order to determine data rate

Nodes must transmit at the root’s Nodes must transmit at the root’s rate or at an integral divisor of itrate or at an integral divisor of it

Page 13: The Design of an Acquisitional Query Processor For Sensor Networks

Lifetime-Based QueriesLifetime-Based Queries Tested a mote with a 24 week queryTested a mote with a 24 week query Sample rate was 15.2 seconds per sampleSample rate was 15.2 seconds per sample Took 9 voltage readings over 12 daysTook 9 voltage readings over 12 days

Page 14: The Design of an Acquisitional Query Processor For Sensor Networks

OptimizationOptimization Three phases to queriesThree phases to queries

Creation of queryCreation of query Dissemination of queryDissemination of query Execution of queryExecution of query

TinyDB makes optimizations at each TinyDB makes optimizations at each stepstep

Page 15: The Design of an Acquisitional Query Processor For Sensor Networks

Power-Based Power-Based OptimizationOptimization

Queries optimized by base station Queries optimized by base station before disseminationbefore dissemination

Cost-based optimization to yield lowest Cost-based optimization to yield lowest overall power consumptionoverall power consumption

Cost dominated by sampling and Cost dominated by sampling and transmittingtransmitting

Optimizer focuses on ordering joins, Optimizer focuses on ordering joins, selections, and sampling on individual selections, and sampling on individual nodesnodes

Page 16: The Design of an Acquisitional Query Processor For Sensor Networks

MetadataMetadata Each node contains Each node contains

metadata about its metadata about its attributesattributes

Nodes periodically send Nodes periodically send metadata to rootmetadata to root

Metadata also contains Metadata also contains information about information about aggregate functionsaggregate functions

Information about cost, Information about cost, time to fetch, and range time to fetch, and range is used in query is used in query optimizationoptimization

Page 17: The Design of an Acquisitional Query Processor For Sensor Networks

Using MetadataUsing Metadata Consider the queryConsider the query

SELECT accel, magSELECT accel, magFROM sensorsFROM sensorsWHERE accel > c1WHERE accel > c1AND mag > c2AND mag > c2SAMPLE INTERVAL 1sSAMPLE INTERVAL 1s

Order of magnitude difference between sample costsOrder of magnitude difference between sample costs Three optionsThree options

Measure accel and mag, then process selectMeasure accel and mag, then process select Measure mag, filter, then measure accelMeasure mag, filter, then measure accel Measure accel, filter, then measure magMeasure accel, filter, then measure mag

First option always more expensive. Second option First option always more expensive. Second option an order of magnitude more expensive than thirdan order of magnitude more expensive than third

Second option can be cheaper if the predicate is Second option can be cheaper if the predicate is highly selective highly selective

Page 18: The Design of an Acquisitional Query Processor For Sensor Networks

Using MetadataUsing Metadata Another exampleAnother example

SELECT WINMAX(light, 8s, 8s)SELECT WINMAX(light, 8s, 8s)FROM sensorsFROM sensorsWHERE mag > xWHERE mag > xSAMPLE INTERVAL 1sSAMPLE INTERVAL 1s

Unless mag > x is very selective, it is Unless mag > x is very selective, it is cheaper to check if current light is cheaper to check if current light is greater than maxgreater than max

Reordering is called exemplary Reordering is called exemplary aggregate pushdownaggregate pushdown

Page 19: The Design of an Acquisitional Query Processor For Sensor Networks

Dissemination Dissemination OptimizationOptimization

Build semantic Build semantic routing tree (SRT)routing tree (SRT)

SRT nodes choose SRT nodes choose parents based on parents based on semantic properties semantic properties as well as link as well as link qualityquality

Parent nodes keep Parent nodes keep track of the ranges track of the ranges of values for childrenof values for children

Page 20: The Design of an Acquisitional Query Processor For Sensor Networks

Evaluation of SRTEvaluation of SRT SRT are limited to constant SRT are limited to constant

attributesattributes Even so, maintenance is requiredEven so, maintenance is required Possible to use for non-constant Possible to use for non-constant

attributes but cost can be prohibitiveattributes but cost can be prohibitive

Page 21: The Design of an Acquisitional Query Processor For Sensor Networks

Evaulation of SRTEvaulation of SRT Compared three different strategies Compared three different strategies

for building tree, random, closest, for building tree, random, closest, and clusterand cluster

Report results for two different Report results for two different sensor value distributions, random sensor value distributions, random and geographicand geographic

Page 22: The Design of an Acquisitional Query Processor For Sensor Networks

SRT ResultsSRT Results

Page 23: The Design of an Acquisitional Query Processor For Sensor Networks

Query ExecutionQuery Execution Queries have been optimized and Queries have been optimized and

distributed, what more can we do?distributed, what more can we do? Aggregate data that is sent back to the Aggregate data that is sent back to the

rootroot Prioritize data that needs to be sentPrioritize data that needs to be sent

Naïve - FIFONaïve - FIFO Winavg – Average top queue entriesWinavg – Average top queue entries Delta – Send result with most changeDelta – Send result with most change

Adapt data rates and power consumptionAdapt data rates and power consumption

Page 24: The Design of an Acquisitional Query Processor For Sensor Networks

Prioritization Prioritization ComparisonComparison

Sample rate was K Sample rate was K times faster than times faster than delivery rate.delivery rate.

Readings Readings generated by generated by shaking the sensorshaking the sensor

In this example, K In this example, K = 4= 4

Page 25: The Design of an Acquisitional Query Processor For Sensor Networks

AdaptationAdaptation Not safe to Not safe to

assume that assume that network channel network channel is uncontestedis uncontested

TinyDB reduces TinyDB reduces packets sent as packets sent as channel channel contention risescontention rises

Page 26: The Design of an Acquisitional Query Processor For Sensor Networks

Future WorkFuture Work Selectivity of operators based upon Selectivity of operators based upon

range of sensorrange of sensor Exemplary aggregate pushdownExemplary aggregate pushdown More sophisticated prioritization More sophisticated prioritization

schemesschemes Better re-optimization of sample rate Better re-optimization of sample rate

based upon acquired databased upon acquired data

Page 27: The Design of an Acquisitional Query Processor For Sensor Networks

EvaluationEvaluation TinyDB provides a simple yet TinyDB provides a simple yet

powerful interface to sensor powerful interface to sensor networksnetworks

TinyDB takes measures to conserve TinyDB takes measures to conserve power at all phases of query power at all phases of query processingprocessing

Page 28: The Design of an Acquisitional Query Processor For Sensor Networks

DiscussionDiscussion Is this the best way (right way?) to Is this the best way (right way?) to

look at a sensor network?look at a sensor network? Is their approximation of battery Is their approximation of battery

lifetime sufficient?lifetime sufficient? Was their evaluation of SRT good Was their evaluation of SRT good

enough?enough?