System Design Issues In Sensor Databases Qiong Luo
System Design Issues In Sensor Databases Qiong Luo and Hejun Wu Department of Computer Science and Engineering The Hong Kong University of Science & Technology http: //www. cse. ust. hk/
Wireless Sensor Networks (WSNs) Limited on-node resource Multi-hop communication Energy efficiency is the most crucial performance factor. SIGMOD 07 Tutorial Sensor. DB System Design Issues 2
In-Network Sensor Query Processing (Sensor Databases, Sensor. DBs) σ, π, α Scheduler Networking SELECT temperature FROM sensors WHERE temperature > 900 SELECT avg (light) FROM sensors SAMPLE INTERVAL 60 s sink SAMPLE INTERVAL 60 s Avg light: (1000+500)/2 σ, π, α Scheduler Sensing & Networking Avg light: 300/1 light: 500 σ, π, α Scheduler Sensing & Networking light: 300 SIGMOD 07 Tutorial Avg light: 1000/1 σ, π, α Scheduler Sensing & Networking light: 1000 Sensor. DB System Design Issues 3
Two Representative Sensor. DBs n Cougar [BGS 01, YG 03] n n Model sensor network data as sequences Declarative query interface with UDFs Cross-layer optimization in later versions Tiny. DB [MF+02, 03] n n n Declarative query interface Efficient and extensible framework Open-source implementation on real nodes SIGMOD 07 Tutorial Sensor. DB System Design Issues 4
Advantages of Sensor Databases n Flexibility n n n Declarative SQL style queries Dynamic query injection and removal Efficiency n Cross-layer optimization n E. g. , in-network filtering and aggregation SIGMOD 07 Tutorial Sensor. DB System Design Issues 5
Challenges in Sensor Databases n n Dynamic data streams Hardware resource limitations n n Limited per-node computing power and storage Unreliable wireless communication Battery power supply Complex, networked, embedded software n n Blurred boundaries between components Plenty of cross-layer optimization opportunities SIGMOD 07 Tutorial Sensor. DB System Design Issues 6
Focus of this Tutorial n System design issues in sensor databases n n n Software architecture Operating system support Media Access Control (MAC) Routing Scheduling These issues often dominate the overall performance. SIGMOD 07 Tutorial Sensor. DB System Design Issues 7
Outline n n Introduction WSN hardware n n n n Computing, sensing, communication, and power supply Software architecture Operating system support MAC protocols Routing Scheduling Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 8
Current Sensor Node Hardware: Computing and Storage n Low-power microcontroller (CPU of a node) n n E. g. , Atmega 128 (MICA series), MSP 430 (Telos series), ARM/THUMB (XYZ sensor), and the latest 180 MHz ARM 920 (Sun. Spot). Limited memory n RAM n n ≤ 10 KB SRAM (Static RAM) ROM n Usually ≤ 1 MB flash memory Sensor. DB System Design Issues SIGMOD 07 Tutorial 9
Current Sensor Node Hardware: Sensing and Radio n Sensing devices n n Electronic, mechanic, bio-chemical, … Radio transceiver n n Fixed radio frequency Omni-direction radio signal Transmission rate ≤ 200 kbps Transmission range ≤ 50 meters SIGMOD 07 Tutorial Sensor. DB System Design Issues 10
Current Sensor Node Hardware: Power Supply and Consumption n Power supply n n Batteries, usually <= 2000 m. Ah Electric currents in a node n n Sleep 15 -20 µA Radio on n n Idle 20 -25 m. A, compute 25 -30 m. A Radio off n Idle 1 -5 m. A, compute 5 -10 m. A Sleeping is the most effective means to save energy. SIGMOD 07 Tutorial Sensor. DB System Design Issues 11
Outline n n n n Introduction WSN hardware Software architecture Operating system support MAC protocols Routing Scheduling Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 12
Common Software Architecture of Sensor Databases Scheduling Operating System Kernel Boundaries between components in a sensor. DB are blurred. SIGMOD 07 Tutorial Sensor. DB System Design Issues 13
Outline n n Introduction WSN hardware Common Sensor. DB software architecture Operating system support n n n Hardware management Application code development and deployment MAC protocols Routing Scheduling Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 14
Tiny. OS (http: //www. tinyos. net/) n De facto OS for sensor nodes n n Early research effort Open source development Wide presence in commercial products Component-based architecture n n n Adaptive to hardware changes Lightweight for various applications Event-driven processing n Responsive to sensor signals and radio messages SIGMOD 07 Tutorial Sensor. DB System Design Issues 15
Tiny. OS Application Tiny. OS startup (“Main”) Runable image of a Tiny. OS application Application Commands Lib components Kernel: Tiny. OS interface components Core system components Hardware manipulation components Abstraction: Hardware: Events Mote main board Sensor devices A Tiny. OS application is compiled with Tiny. OS components. SIGMOD 07 Tutorial Sensor. DB System Design Issues 16
Some Limitations of Tiny. OS n Static code and memory n n n No virtual memory No dynamic memory allocation No dynamic code update Task execution without priorities Tiny. OS memory allocation Stack Free Global Single thread SIGMOD 07 Tutorial Sensor. DB System Design Issues 17
Contiki [DGV 04] n n n Multi-threading Lightweight program loading Lightweight communication stacks n core #2 #3 u. IP n n #1 A micro-version of RFCcompliant TCP/IP Rime n A lightweight communication stack for low-power radio SIGMOD 07 Tutorial #n … Multi-threading in Contiki Sensor. DB System Design Issues 18
SOS [HK+05] n Dynamic module loading n n Jump table System function call Allows incremental update of binary code Module #1 Module #2 n … Runtime safety mechanisms n Memory monitoring Watchdog n Restart when system hangs SIGMOD 07 Tutorial 1 2 Module #N SOS Kernel Actual function to call Sensor. DB System Design Issues 19
MANTIS [BC+05] User threads n n Multi-threading Remote testing Scheduler for dutycycle sleeping Small code size n Uses less than 500 B RAM and 14 KB flash memory SIGMOD 07 Tutorial Network Stack Command Server #1 … #n MANTIS System API Kernel / Scheduler Communication Device Layer driver Sensor Node Hardware Sensor. DB System Design Issues 20
t-kernel [GS 06] n n n Load Extends the limited SRAM Preemptive scheduling n n Separates OS/app space Virtual memory n n Application binary code OS protection Naturalization Allows priorities Fault tolerance n Prevents system hang-up from application errors Running an app. in t-kernel SIGMOD 07 Tutorial Sensor. DB System Design Issues 21
On-Node Virtual Machines n Sun. SPOT n n n A compact Java language Java VM directly runs in on-node flash memory Swiss. QM [MAK 07] n Combines a powerful gateway with a virtual machine at the sensors n http: //www. sunspotworld. com/ Query synopsis QM programs Transmission buffer Bytecode interpreter Operand stack Query Machine (QM) Sensors SIGMOD 07 Tutorial Sensor. DB System Design Issues 22
Declarative Sensor Networks [CP+07] n Snlog language n n Snlog compiler n n Datalog-like, declarative Suitable for polynomial-time programs Useful in a variety of apps Translate Snlog into Nes. C Runtime system n n Components of user provided rules No on-node interpreter SIGMOD 07 Tutorial Snlog compiler Snlog program Snlog front-end Execution planner nes. C Templates DSN runtime components Binary code to be executed Sensor. DB System Design Issues Nes. C backend Generated Nes. C program Nes. C Compiler 23
Summary on OS Support n Support app. development and deployment n n Programming interfaces Code compilation and generation Runtime loading and modification Provide hardware resource management n n n Sensor signals, radio messages Memory allocation and virtualization Scheduling and system safety SIGMOD 07 Tutorial Sensor. DB System Design Issues 24
OS and Sensor Databases n Desirable OS features for sensor databases n n n Multiple applications Multi-threading Virtual memory Priority scheduling Reliability and fault tolerance SIGMOD 07 Tutorial Sensor. DB System Design Issues 25
Outline n n n Introduction WSN hardware Common Sensor. DB software architecture Operating system support MAC protocols n n CSMA, STEM, S-MAC, and T-MAC Routing Scheduling Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 26
CSMA (Carrier Sense Multiple Access) n n n Random delay before transmission attempt Node needs to keep idle listening before its communication done Wireless collision remains a major problem n Reason: no effective coordination between nodes transmitting Collision Sender 1 transmitting Sender 2 SIGMOD 07 Tutorial Sensor. DB System Design Issues 27
Sparse Topology and Energy Management (STEM) [STS 02] n n Periodic wake up and listen Sleep when no packet to send and receive Power Transmit Listening Sleep time SIGMOD 07 Tutorial Sensor. DB System Design Issues 28
S-MAC (Sensor-MAC) [YHE 02] n n Schedules nodes to periodically sleep Coordinates the sleeping time of neighbors for reliable transmission Listen Receiver Sleep SYNC RTS Sender SIGMOD 07 Tutorial Sensor. DB System Design Issues 29
T-MAC [DL 03] n n Contention based protocol Dynamically ends an active period n Adapts to the needs for computation and communication S-MAC Active time Sleep time T-MAC TA SIGMOD 07 Tutorial Aha, no more to do!, zzz~ Sensor. DB System Design Issues 30
Summary on MAC n Important for performance n Communication quality n n n Communication energy n n n Signal errors Noise Sleeping nodes Retransmission Communication delay n n Negotiation for channels Wireless signal transmission delay Significant to data quality, energy efficiency and response time in query processing! SIGMOD 07 Tutorial Sensor. DB System Design Issues 31
MAC and Sensor Databases n MAC behavior of sensor databases n n n Mostly converge-cast Periodic data flows Opportunities of sensor databases for MAC n Sleep scheduling that suits the data flows SIGMOD 07 Tutorial Sensor. DB System Design Issues 32
Outline n n n Introduction WSN hardware Common Sensor. DB software architecture Operating system support MAC protocols Routing n n n Mint. Route, Tiny. AODV, and Directed Diffusion Scheduling Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 33
Location-Based Routing n Requires location information n Usually finds the shortest, reliable path using location information of each node n n Energy aware Suitable for queries with spatial predicates n Can route queries to some specific regions D Transmission range of S SIGMOD 07 Tutorial S Sensor. DB System Design Issues Shortest path 34
Flooding n Every node broadcasts received data n n Advantage n n Broadcast can be reduced by hop count Simple Problems n Message implosion n n Many duplicates Resource inefficiency n n Most nodes busy No sleeping SIGMOD 07 Tutorial Sensor. DB System Design Issues 35
Directed Diffusion [IG+00] n n Queries are defined as interests. Sink nodes post interests. Source nodes generate sensory data. Source nodes select reliable and efficient routes to the sink nodes to forward data. SIGMOD 07 Tutorial Sensor. DB System Design Issues 36
Illustration of Directed Diffusion Step 1: Sink node propagates Interest (query) Sink node Step 2: Set up gradients Source node Step 3: Reinforce one path Sink node Source node SIGMOD 07 Tutorial Sensor. DB System Design Issues 37
Mint. Route [WTC 03] n Implemented in Tiny. OS n n Can be used in Tiny. DB More than simple shortest-path routing n n Monitors link connectivity Decides a route based on both link quality and distance 1 Unreliable, high loss rate 1 2 3 SIGMOD 07 Tutorial 2 3 Sensor. DB System Design Issues 38
Tiny. AODV (Tiny Ad-hoc On. Demand Distance Vector) n n Builds paths only when needed Uses sequence number in RREQ to avoid cycles Source Destination … RREQ: Route Request RREQ RREP: Route Reply RREP RERR: Route ERR DATA … X RERR SIGMOD 07 Tutorial Sensor. DB System Design Issues 39
Summary on Routing n Focus of current routing protocols n Efficient forwarding n n Load balancing n n Shortest path or least retransmission Avoid hot spots of heavy traffic Open issues n Reliability n n n Node failure Noise Communication delay n Find the path of the minimal delay SIGMOD 07 Tutorial Sensor. DB System Design Issues 40
Routing and Sensor Databases n Routing characteristics of sensor databases n n n Mainly converge-casting Not all nodes satisfy a query all the time. Opportunities of sensor. DBs for routing n Data flow aware routing n n n Busy nodes get better routes. Busy queries get better routes. Query type aware routing n Aggregation, duplicate-sensitivity, join SIGMOD 07 Tutorial Sensor. DB System Design Issues 41
Outline n n n n Introduction WSN hardware Common Sensor. DB software architecture Operating system support MAC protocols Routing Scheduling n n FPS, Sichitiu’s Scheme, and DCS Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 42
Goal of Scheduling n Communication efficiency and reliability n Coordinate nodes in communication n n Wireless collisions among neighbors No receiving on sleeping nodes Sending… zzz… Done! Lost! zzz… a at D SIGMOD 07 Tutorial Sensor. DB System Design Issues 43
Centralized Scheduling n The base station specifies schedules for all nodes. n n n The base station must be aware of the workload and the network topology Hard to scale Hard to adapt to changes SIGMOD 07 Tutorial Sensor. DB System Design Issues Sink … Schedule 44
Distributed Scheduling n Scheduling in Tiny. DB (query layer) n n A node keeps active for 4 seconds and sleeps in the remaining time in a sample interval. Sichitiu’s Scheduling Scheme [Sic 04] n Schedules at the MAC and routing layers n Sets up both routing paths and schedules n Schedule construction is time consuming and unreliable because it needs the sink to confirm. SIGMOD 07 Tutorial Sensor. DB System Design Issues 45
FPS (Flexible Power Scheduling) [HDB 04] n n n Routing-layer distributed scheduling A parent node assigns transmission slots to its children to avoid collision between siblings. Collisions among non-sibling neighbors are possible. Slots: sleep compute transmit … Time SIGMOD 07 Tutorial Sensor. DB System Design Issues 46
DCS (Distributed Cross-Layer Scheduling) [WLX 06] n n Slot based Takes query processing cycles into account n n Receiving, computing, transmission, and sleep Not only parents assign schedules to children, but neighbors also negotiate. n n Able to avoid the collisions at the receiving nodes Attempts to assign consecutive transmission slots to each node SIGMOD 07 Tutorial Sensor. DB System Design Issues 47
DCS Components Scheduling Module Query Scheduling Query Layer Selection / Projection / Join / Aggregation Schedule Execution Routing Layer Schedule Construction Route Selection Route Maintenance MAC Layer Time Synchronization SIGMOD 07 Tutorial Collision Detection Sensor. DB System Design Issues Transmission / Receiving 48
Slot in a Schedule n A slot is a time period of fixed length. n n Transmission, Sleeping, PL/R (Processing, Listening / Receiving), and Q/M (Query injection / route Maintenance) Slot number s at t: n n n The length of a slot is ls. The schedule start time is t 0. A sample interval has m slots. SIGMOD 07 Tutorial Sensor. DB System Design Issues 49
An Example Schedule Routing tree 0 Active (sink only) Q/M Sleeping PL/R Transmission 3 2 Sink Hop 0 Hop 1 Node 3 Hop 2 Node 2 Hop 2 Node 1 0 SIGMOD 07 Tutorial Leaf 1 Time Sensor. DB System Design Issues 50
Energy Efficiency DCS achieves 50 -60% energy saving. SIGMOD 07 Tutorial Sensor. DB System Design Issues 51
Summary on Scheduling n n Scheduling is done on one or more layers. Scheduling is crucial for performance. n Communication reliability n n Energy consumption n n Coordination of nodes Sleep scheduling Response time n Different transmission timings of neighboring nodes result in different delays. SIGMOD 07 Tutorial Sensor. DB System Design Issues 52
Scheduling and Sensor Databases n n Sensor. DBs are complex to schedule. Opportunities in scheduling for sensor. DBs n On-node multi-query scheduling n n Limited resources Changing sensor environments Query-aware transmission scheduling Interaction between scheduling and query execution SIGMOD 07 Tutorial Sensor. DB System Design Issues 53
Outline n n n n Introduction WSN hardware Common Sensor. DB software architecture Operating system support MAC protocols Routing Scheduling Summary and future directions SIGMOD 07 Tutorial Sensor. DB System Design Issues 54
Tutorial Summary n n n System design issues have a significant impact on the overall performance of sensor databases. A holistic sensor database system requires considerations on all layers – from OS kernel, MAC, routing to query processing. Cross-layer design is necessary, especially in scheduling. SIGMOD 07 Tutorial Sensor. DB System Design Issues 55
Future Directions n Multi-query processing in sensor networks n Query optimization n n Scheduling n n Queries, operators, and transmission In-network joins among different nodes n n Sharing, caching, and pipelining Fine-grained scheduling for node cooperation Query processing in multi-sink networks Cross-layer design is necessary for an efficient, holistic sensor database. SIGMOD 07 Tutorial Sensor. DB System Design Issues 56
References: Sensor Databases and Runtime Support [BGS 01] Philippe Bonnet, Johannes Gehrke, and Praveen Seshadri. Towards Sensor Database Systems. MDM, 2001. [MF+02] Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei Hong. TAG: a Tiny AGgregation Service for Ad-Hoc Sensor Networks. OSDI, 2002. [MF+03] Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei Hong. The Design of an Acquisitional Query Processor for Sensor Networks. SIGMOD, 2003. [YG 03] Yong Yao and Johannes Gehrke. Query Processing for Sensor Networks. CIDR, 2003. [MAK 07] Rene Muller, Gustavo Alonso, and Donald Kossman. Swiss. QM: Next Generation Data Processing in Sensor Networks. CIDR, 2007. [CP+07] David Chu, Lucian Popa, Arsalan Tavakoli, Joseph M. Hellerstein, Philip Levis, Scott Shenker, and Ion Stoica. The Design and Implementation of A Declarative Sensor Network System. Submitted for publication, 2007. SIGMOD 07 Tutorial Sensor. DB System Design Issues 57
References: OS Support [DGV 04] Adam Dunkels, Björn Grönvall, and Thiemo Voigt. Contiki - A Lightweight and Flexible Operating System for Tiny Networked Sensors. The 29 th Annual IEEE Conference on Local Computer Networks, 2004. [HK+05] Chih-Chieh Han, Ram Kumar, Roy Shea, Eddie Kohler and Mani Srivastava. A Dynamic Operating System for Sensor Nodes. International Conference on Mobile Systems, Applications, and Services, 2005. [BC+05] Shah Bhatti, James Carlson, Hui Dai, Jing Deng, Jeff Rose, Anmol Sheth, Brian Shucker, Charles Gruenwald, Adam Torgerson, and Richard Han. MANTIS OS: An Embedded Multithreaded Operating System For Wireless Micro Sensor Platforms. ACM/Kluwer Mobile Networks and Applications (MONET), Special Issue on Wireless Sensor Networks, vol. 10, no. 4, pp. 563– 579, Aug 2005. [GS 06] Lin Gu and John A. Stankovic. t-kernel: Providing Reliable OS Support for Wireless Sensor Networks. Sen. Sys, 2006. SIGMOD 07 Tutorial Sensor. DB System Design Issues 58
References: MAC and Routing [STS 02] Curt Schurgers, Vlasios Tsiatsis, and Mani B. Srivastava. STEM: Topology Management for Energy Efficient Sensor Networks. IEEE Aerospace Conference, 2002. [YHE 02] Wei Ye, John Heidemann, and Deborah Estrin. An Energy. Efficient MAC Protocol for Wireless Sensor Networks. INFOCOM, 2002. [DL 03] Tijs van Dam and Koen Langendoen. An Adaptive Energy. Efficient MAC Protocol for Wireless Sensor Networks. Sen. Sys, 2003. [IGE 00] Chalermek Intanagonwiwat, Ramesh Govindan, and Deborah Estrin. Directed Diffusion: A Scalable and Robust Communication Paradigm for Sensor Networks. Mobi. Com, 2000. [WTC 03] Alec Woo, Ternence Tony, and David Culler. Taming the Underlying Challenges of Reliable Multihop Routing in Sensor Networks. Sen. Sys, 2003. SIGMOD 07 Tutorial Sensor. DB System Design Issues 59
References: Scheduling [HDB 04] Barbara Hohlt, Lance Doherty, and Eric Brewer. Flexible Power Scheduling for Sensor Networks. IPSN, 2004. [Sic 04] Mihail L. Sichitiu. Cross-Layer Scheduling for Power Efficiency in Wireless Sensor Networks. INFOCOM, 2004. [WLX 06] Hejun Wu, Qiong Luo, and Wenwei Xue. Distributed Cross. Layer Scheduling for In-Network Sensor Query Processing. Per. Com, 2006. SIGMOD 07 Tutorial Sensor. DB System Design Issues 60
- Slides: 60