1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael...
-
Upload
alexina-chase -
Category
Documents
-
view
213 -
download
0
Transcript of 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael...
![Page 1: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/1.jpg)
1
TAG: A Tiny Aggregation Service for Ad-Hoc Sensor
Networks
Samuel MaddenUC Berkeley
withMichael Franklin, Joseph Hellerstein, and Wei
Hong
December 9th, 2002 @ OSDI
![Page 2: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/2.jpg)
2
TAG Introduction
• What is a sensor network?• Programming sensor nets is hard!• Declarative queries are easy
– Tiny Aggregation (TAG): In-network processing via declarative queries
• Example: » Vehicle tracking application: 2
weeks for 2 students» Vehicle tracking query: took 2
minutes to write, worked just as well!
SELECT MAX(mag) FROM sensors WHERE mag > threshEPOCH DURATION 64ms
![Page 3: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/3.jpg)
3
Overview
• Sensor Networks• Queries in Sensor Nets• Tiny Aggregation
– Overview– Simulation & Results
![Page 4: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/4.jpg)
4
Overview
• Sensor Networks• Queries in Sensor Nets• Tiny Aggregation
– Overview– Simulation & Results
![Page 5: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/5.jpg)
5
Device Capabilities
• “Mica Motes”– 8bit, 4Mhz processor
» Roughly a PC AT
– 40kbit CSMA radio– 4KB RAM, 128KB flash, 512KB EEPROM– TinyOS based
• Variety of other, similar platforms exist– UCLA WINS, Medusa, Princeton ZebraNet,
SmartIts
![Page 6: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/6.jpg)
6
Sensor Net Sample Apps
Habitat Monitoring: Storm petrels on great duck island, microclimates on James Reserve.
Traditional monitoring apparatus.
Earthquake monitoring in shake-test sites.
Vehicle detection: sensors along a road, collect data about passing vehicles.
![Page 7: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/7.jpg)
7
Metric: Communication• Lifetime from one
pair of AA batteries – 2-3 days at full
power– 6 months at 2%
duty cycle
• Communication dominates cost– < few mS to
compute– 30mS to send
message
• Our metric: communication!
Time v. Current Draw During Query Processing
0
5
10
15
20
0 0.5 1 1.5 2 2.5 3Time (s)
Cu
rre
nt
(mA
) Snoozing
Processing
Processingand Listening
Transmitting
![Page 8: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/8.jpg)
8
Communication In Sensor Nets
• Radio communication has high link-level losses– typically about 20%
@ 5m
• Ad-hoc neighbor discovery
• Tree-based routing
A
B C
D
FE
![Page 9: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/9.jpg)
9
Overview
• Sensor Networks• Queries in Sensor Nets• Tiny Aggregation
– Overview– Optimizations & Results
![Page 10: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/10.jpg)
10
Declarative Queries for Sensor Networks
• Examples:SELECT nodeid, lightFROM sensorsWHERE light > 400EPOCH DURATION 1s
1 EpocEpochh
NodeiNodeidd
LightLight TemTempp
AccelAccel SounSoundd
0 1 455 x x x
0 2 389 x x x
1 1 422 x x x
1 2 405 x x x
Sensors
![Page 11: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/11.jpg)
11
Aggregation Queries
SELECT roomNo, AVG(sound)
FROM sensors
GROUP BY roomNo
HAVING AVG(sound) > 200
EPOCH DURATION 10sRooms w/ sound > 200
3
2SELECT AVG(sound)
FROM sensors
EPOCH DURATION 10s
Epoch AVG(sound)
0 440
1 445
Epoch
roomNo
AVG(sound)
0 1 360
0 2 520
1 1 370
1 2 520
![Page 12: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/12.jpg)
12
Overview
• Sensor Networks• Queries in Sensor Nets• Tiny Aggregation
– Overview– Optimizations & Results
![Page 13: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/13.jpg)
13
TAG
• In-network processing of aggregates– Common data analysis operation
» Aka gather operation or reduction in || programming
– Communication reducing» Operator dependent benefit
– Across nodes during same epoch
• Exploit semantics improve efficiency!
![Page 14: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/14.jpg)
14
Query PropagationSELECT SELECT COUNT(*)…COUNT(*)…
1
2 3
4
5
Epoch
Comm. Slot
![Page 15: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/15.jpg)
15
Basic Aggregation• In each epoch:
– Each node samples local sensors once– Generates partial state record (PSR)
» local readings » readings from children
– Outputs PSR during its comm. slot.
• At end of epoch, PSR for whole network output at root
• (In paper: pipelining, grouping)
1
2 3
4
5
![Page 16: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/16.jpg)
16
Illustration: Aggregation
1 2 3 4 5
1 1
2
3
4
1
1
2 3
4
5
1
Sensor #
Slo
t #
Slot 1SELECT COUNT(*) FROM sensors
![Page 17: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/17.jpg)
17
Illustration: Aggregation
1 2 3 4 5
1 1
2 2
3
4
1
1
2 3
4
5
2
Sensor #
Slo
t #
Slot 2SELECT COUNT(*) FROM sensors
![Page 18: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/18.jpg)
18
Illustration: Aggregation
1 2 3 4 5
1 1
2 2
3 1 3
4
1
1
2 3
4
5
31
Sensor #
Slo
t #
Slot 3SELECT COUNT(*) FROM sensors
![Page 19: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/19.jpg)
19
Illustration: Aggregation
1 2 3 4 5
1 1
2 2
3 1 3
4 5
1
1
2 3
4
5
5
Sensor #
Slo
t #
Slot 4SELECT COUNT(*) FROM sensors
![Page 20: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/20.jpg)
20
Illustration: Aggregation
1 2 3 4 5
1 1
2 2
3 1 3
4 5
1 1
1
2 3
4
5
1
Sensor #
Slo
t #
Slot 1SELECT COUNT(*) FROM sensors
![Page 21: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/21.jpg)
21
Aggregation Framework
• As in extensible databases, we support any aggregation function conforming to:
Aggn={finit, fmerge, fevaluate}
finit{a0} <a0>
Fmerge{<a1>,<a2>} <a12>
Fevaluate{<a1>} aggregate value
(Merge associative, commutative!)Example: Average
AVGinit {v} <v,1>
AVGmerge {<S1, C1>, <S2, C2>} < S1 + S2 , C1 + C2>
AVGevaluate{<S, C>} S/C
Partial State Record (PSR)
![Page 22: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/22.jpg)
22
Types of Aggregates
• SQL supports MIN, MAX, SUM, COUNT, AVERAGE
• Any function can be computed via TAG
• In network benefit for many operations– E.g. Standard deviation, top/bottom N,
spatial union/intersection, histograms, etc. – Compactness of PSR
![Page 23: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/23.jpg)
23
Taxonomy of Aggregates• TAG insight: classify aggregates according to
various functional properties– Yields a general set of optimizations that can
automatically be appliedProperty Examples Affects
Partial State MEDIAN : unbounded, MAX : 1 record
Effectiveness of TAG
Duplicate Sensitivity
MIN : dup. insensitive,AVG : dup. sensitive
Routing Redundancy
Exemplary vs. Summary
MAX : exemplaryCOUNT: summary
Applicability of Sampling, Effect of Loss
Monotonic COUNT : monotonicAVG : non-monotonic
Hypothesis Testing, Snooping
![Page 24: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/24.jpg)
24
TAG Advantages
• Communication Reduction– Important for power and contention
• Continuous stream of results– Smooth transient faults across epochs
• Lots of optimizations– Via operator semantics
![Page 25: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/25.jpg)
25
Simulation Environment
• Evaluated via simulation
• Coarse grained event based simulator– Sensors arranged on a grid– Two communication models
»Lossless: All neighbors hear all messages»Lossy: Messages lost with probability that
increases with distance
![Page 26: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/26.jpg)
26
Benefit of In-Network Processing
Total Bytes Xmitted vs. Aggregation Function
0
10000
20000
30000
40000
50000
60000
70000
80000
90000
100000
EXTERNAL MAX AVERAGE COUNT MEDIANAggregation Function
Tota
l Byt
es X
mitt
ed
Simulation Results
2500 Nodes
50x50 Grid
Depth = ~10
Neighbors = ~20
Some aggregates require dramatically more state!
![Page 27: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/27.jpg)
27
Optimization: Channel Sharing (“Snooping”)
• Insight: Shared channel enables optimizations
• Suppress messages that won’t affect aggregate– E.g., MAX– Applies to all exemplary, monotonic
aggregates
![Page 28: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/28.jpg)
28
Optimization: Hypothesis Testing
• Insight: Guess from root can be used for suppression– E.g. ‘MIN < 50’– Works for monotonic & exemplary aggregates
»Also summary, if imprecision allowed
• How is hypothesis computed?– Blind or statistically informed guess– Observation over network subset
![Page 29: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/29.jpg)
29
Experiment: Hypothesis Testing
•Uniform Value Distribution•Dense Packing •Ideal Communication
Messages/ Epoch vs. Network Diameter(SELECT MAX(attr), R(attr) = [0,100])
0
500
1000
1500
2000
2500
3000
10 20 30 40 50
Network Diameter
Messages /
Epoch
No Guess
Guess = 50
Guess = 90
Snooping
![Page 30: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/30.jpg)
30
Optimization: Use Multiple Parents
• For duplicate insensitive aggregates• Or aggregates that can be expressed as a linear
combination of parts– Send (part of) aggregate to all parents
» In just one message, via broadcast
– Decreases variance
A
B C
A
B C
A
B C
1
A
B C
A
B C
1/2 1/2
![Page 31: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/31.jpg)
31
Multiple Parents Results
• Better than previous analysis expected!
• Losses aren’t independent!
• Insight: spreads data over many links
Benefit of Result Splitting (COUNT query)
0
200
400
600
800
1000
1200
1400
(2500 nodes, lossy radio model, 6 parents per node)
Avg
. C
OU
NT Splitting
No Splitting
Critical Link!
No Splitting With Splitting
![Page 32: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/32.jpg)
32
Summary
• TAG enables in-network declarative query processing – State dependent communication benefit– Transparent optimization via taxonomy
» Hypothesis Testing, Parent Sharing
• Declarative queries are the right interface for data collection in sensor nets!– Easier to program and more efficient for vast
majority of users
TinyDB Release Available - TinyDB Release Available - http://telegraph.cs.berkeley.edu/tinydb
![Page 33: 1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.](https://reader035.fdocuments.us/reader035/viewer/2022070410/56649ebe5503460f94bc784b/html5/thumbnails/33.jpg)
33
Questions?
TinyDB Demo After The Session…