Peer-to-Peer Spatial Queries in Sensor Networks Murat Demirbas Hakan Ferhatosmanoglu The Ohio State University Sensor networks • A sensor node: 8K RAM, 4Mhz processor magnetism, heat, sound, vibration, infrared wireless communication up to 200 feet costs ~$10 (right now costs $100) • Applications include: ecology monitoring, precision agriculture military and surveillance • In OSU, we developed a tracking service for DARPA-NEST classify trespassers as car, soldier, civilian report the tracking information to a base-station (laptop) for visualization Spatial queries in sensor networks • The primary goal of sensor networks is to monitor spatial information about a region of interest Nearest neighbor (NN) queries are essential : What is the location of the nearest data object to (x,y) ? • Database systems R-tree for efficient execution of nearest neighbor queries Challenges in sensor networks • energy constrained nodes, network contention : programs should avoid excessive communication centralized programs are not suitable work in database systems not readily applicable • faults : data is noisy nodes fail in complex ways on site maintenance is not feasible self-healing programs are needed P2P spatial queries in sensor networks • Pursuer- evader tracking • A pursuer should be able to query a node for the location of the closest evader • Every node is a peer : – each node (not only the basestation) can insert a query – each node can participate in the processing of the query • query is processed as local as possible Our contributions We present a peer-to-peer query processing system where only the relevant nodes for the correct execution of the query are involved in the query execution (for minimizing energy and response time) the indexing structure, peer-tree, is self-stabilizing (for achieving eventually correct answers in the presence of faults) Outline • Model • Peer-tree structure • P2P nearest neighbor queries • Pursuer – evader tracking revisited • Conclusions Model Geometric network model (2-D) Connected graph; duplex links Transient faults Maximal parallelism in node actions Outline • Model • Peer-tree structure • P2P nearest neighbor queries • Pursuer – evader tracking revisited • Conclusions R-tree structure A . • Approximately balanced tree • A node holds n to 2n (c,mbr) pairs : B C F E D y G H D F B E – c is the child pointer – mbr is the minimum bounding rectangle (MBR) of all rectangles at c A • Rectangles at any level may be overlapping G C H x • Every descending path in the tree is a sequence of nested rectangles with the last one containing the actual data Peer-tree construction • Hierarchical partitioning of a sensor network based on the number of nodes (n to 2n) contained at each cluster every node cooperates at level 1 of the partitioning only clusterheads of level i cooperate for level i+1 • Every node v maintains l.v : highest level of construction v has cooperated p.v(i), 0<i=<l.v : parent of v at level i c.v(i), 0<i=<l.v : children of v at level i mbr.v(i) : MBR of v(i) calculated using c.v(i) Peer-tree is the tree that c pointers embed over the network • Two actions Join/form cluster Split a cluster Join/form a cluster v executes a join/form cluster action if l.v=i yet p.v(i)=nil • v searches for a node with l= i+1, at increasingly larger radii : if such a node is encountered v joins that node’s cluster • Else, if v encounters n nodes with l=i during its search : v waits for a random time (to avoid formation of multiple clusters that are concurrently started by multiple nearby nodes) if v is not contacted within this wait, v forms a cluster p.v(i)=v, l.v=i+1, c.v(i+1) is set, mbr.v(i+1) is calculated Split cluster • During concurrent executions of join/form cluster action by multiple nodes, a level i clusterhead v may end up with > 2n children • v assigns extra level i clusterheads among its children and ensures that each cluster has n to 2n nodes Peer-tree Self-stabilization of peer-tree • v’s i’th level cluster is collapsed if: c.v(i)<n, or there is a node u in c.v(i) s.t., mbr.v(i), or p.u v u • the nodes in the collapsed cluster join neighboring clusterheads or form their clusters Outline • Model • Peer-tree structure • P2P nearest neighbor queries • Pursuer – evader tracking revisited • Conclusions NN queries over traditional R-tree The search starts from the root (highest) level, and performs a traversal of the relevant MBRs • The MBRs that are guaranteed not to have the closest data point are pruned e.g., MINDIST, the shortest possible distance from a point in an MBR to (x,y), is larger than the current candidate for NN • At every iteration, the algorithm sorts the MBRs with respect to their MINDIST, considers the first item in the list, expands its children, and inserts them to the list for processing P2P NN queries over Peer-tree Any node in the network can submit an NN query concerning any coordinate (x,y) • If the query can be answered locally, there is no need to propagate it till the root (highest) level : query is propagated up if (x,y) is not enclosed within current MBR • At some level a clusterhead that contains (x,y) is reached : from this point on, the query is sent to children children are ordered with respect to MINDIST this way only the most relevant children are queried NN query execution (x,y) query NN query execution (x,y) query P2P NN queries • If (x,y) is not within MBR of v at level i, mbr.v(i), then forward query to p.v(i) • let u be the first encountered clusterhead that contains (x,y) u forwards query to relevant children in c.u • While the query is traveling downwards, each clusterhead sorts the children wrt MINDIST prunes list using the replies from queried children • A level 0 node returns its nearest distance NN, reply is propagated up • u aggregates the replies if (x,y) is encapsulated by c.u, the reply is sent to querying node else, u punts the query to its clusterhead NN query execution (x’,y’) query Tradeoff : time vs. energy • Minimal response time The clusterhead forwards the query to its relevant children in parallel (concurrent execution) • Minimal energy consumption The clusterhead forwards the query to its relevant children sequentially (to maximize pruning) • Optimizing both Hybrid of the above Outline • Model • Peer-tree structure • P2P nearest neighbor queries • Pursuer – evader tracking revisited • Conclusions Pursuer-evader problem • Evader is omniscient; Strategy of evader is unknown • Pursuer can only see state of nearest node; Pursuer moves faster than evader • Required is to design a program for nodes and pursuer so that pursuer can catch evader (despite the occurrence of faults) [Demirbas, Arora, Gouda] Evader-centric program (cont.) • Tracking tree is dynamically rooted at the evader • Parent of a node is closer to the evader Evader-centric program (cont.) • Tracking tree is dynamically rooted at the evader • Parent of a node is closer to the evader Evader-centric program (cont.) • Tracking tree is dynamically rooted at the evader • Parent of a node is closer to the evader Pursuer-evader tracking via P2P spatial queries • The pursuer submits an NN query with its own location to find out the location of the nearest evader to itself On demand approach No tracking tree is maintained, a clusterhead is only aware of the existence of an evader in its region, but does not know where it is Conclusions • We have presented for the first time a peer-to-peer spatial query processing system for sensor networks • We are implementing this system in the context of our work on tracking services for sensor network (LITS) • Indexing in database systems, peer-to-peer systems, sensor networks have a lot of similarities (as well as distinctions) peer-tree is based on R-tree concept in database systems possible to extend peer-tree for wired systems since energy is no longer an issue, scalability and load balancing can be improved by inserting long links