220 likes | 353 Views
OnTheMove - OTM 2005 Federated Conferences. Agia Napa, Cyprus. 2 November 2005. Efficient processing of XPath queries with structured overlay networks. Gleb Skobeltsyn, Manfred Hauswirth, Karl Aberer. Presenter: Gleb Skobeltsyn.
E N D
OnTheMove- OTM 2005 Federated Conferences Agia Napa, Cyprus. 2 November 2005. Efficient processing of XPath queries with structured overlay networks Gleb Skobeltsyn, Manfred Hauswirth, Karl Aberer Presenter: Gleb Skobeltsyn This work was (partially) funded by the EU project BRICKShttp://www.brickscommunity.org Ecole Polytechnique Fédérale de Lausanne, Switzerland
Contents • Motivation & Problem statement • P-Grid short overview • Indexing strategy • Basic Index • Caching strategy • Simulation results • Conclusions Efficient processing of XPath queries with structured overlay networks
Motivation • Complex queries are easy to answer in unstructured P2P networks, e.g., edutella. • But the approach doesn’t scale because of the high bandwidth consumption. • Structured P2P networks typically offer logarithmic search complexity, but require a special index. • Indexing structure to support XPath queries over a distributed XML warehouse??? Efficient processing of XPath queries with structured overlay networks
Problem statement (1/2) • Problem: To be able to answer structured queries (e.g. XPath) in a XML warehouse distributed in a structured P2P network. • We assume using 2 different indices: • For indexing structure(e.g. pure XML path); • For indexing values. • In this paper we concentrate on the first issue. Efficient processing of XPath queries with structured overlay networks
Problem statement (2/2) • We support XPath{*,//}queries, i.e. queries containing: • Child axes (“/”); • Descendant axis (“//”); • Wildcards (“*”). • Example: //A/B/*/C • We propose an indexing structure to answer such queries in a large distributed P2P XML warehouse • We try to minimize the consumed bandwidth measured in P2P overlay hops Efficient processing of XPath queries with structured overlay networks
0* 1* 00* 01* 10* 11* B 1* : E 01* : B 0* : B, F 10* : D 0* : A, F 11* : E 1* : C, D 00* : F P-Grid (1/3): introduction • P-Grid is a trie based DHT P2P, similar to Chord, Pastry, etc… (more info at http://www.p-grid.org/). • In P-Grid each peer is responsible for a set of binary keys which start from the peer’s prefix. • Routing is based on longest prefix matching (log search cost for skewed trees): P-Grid queryfor ‘100’ found A C D Efficient processing of XPath queries with structured overlay networks
11000 110010 0* 1* 11* 01* 00* 010* 011* 10* 111* 11000 110010 00001 data1 0011 data2 01001 011011 10100 10 1111 … … … … … … P-Grid (2/3): storing indexing information • Information is stored in data items. • Data item is a {key,data}tuple. • Each peer in P-Grid network stores data items whose keys start from the peer’s prefix 1100* 1101* 110* 11011 11011 Efficient processing of XPath queries with structured overlay networks
1. The peer responsible forh(comp) 2. The sub-tree responsible forh(comp) h(compl)* h(compu)* h(co)* … … h(complexity) h(computer) h(corporation) h(complexity) h(computer) … … … P-Grid (3/3): order preserving hash function • Keys are generated using a P-Grid order preserving hash function h( ): • Example: the key h(“comp”) is a prefix for keys: h(“computer”), h(“complexity”), h(“comp*”). • Routing to the key h(“comp”) may lead to two cases: Efficient processing of XPath queries with structured overlay networks
Basic Index (1/4): introduction • We index XML paths found in the document. • Given a path P = l1/../lm, m data items are stored in P-Grid, using the following sub-paths (suffixes) as keys: { l1/l2/.../lm, l2/.../lm, …, lm } • Each data item storespath and URI. • Example: given a path P = “store/book/title”, 3 data items are created: Basic index Efficient processing of XPath queries with structured overlay networks
Basic Index (2/4): search • Given a XPath query Q=l1s1l2..sk-1lk, where si: {/,//,*}. • The first longest sequence of labels divided by“/” is defined as qB. • Example: for“A//C/D//E”:qB=“C/D” • The query is answered by routing to the peer responsible for h(qB). • There are 2 cases: • There is one peer responsible for h(qB) – answer the query, • There is a set (sub-tree) of peers responsible for h(qB) – a shower broadcast is executed over this set. Efficient processing of XPath queries with structured overlay networks
Basic index (3/4): shower broadcast • Shower broadcast – propagates a message (query) among all peers in the sub-tree: • Recursive algorithm, works in parallel fashion; • Each peer in the sub-tree is visited only once. * 1* 0* 00* 10* 01* 11* 010* 011* 110* 111* 1100* 1101* Efficient processing of XPath queries with structured overlay networks
Basic Index (4/4): properties • Basic index is sufficient to answer XPath{*,//} queries. • The shower broadcast consumes bandwidth, though efficient in time and distributes the computing. • The improvement is to cache the most frequent queries locally and avoid shower broadcasts for them. Efficient processing of XPath queries with structured overlay networks
Caching strategy (1/4): introduction • Types of queries: • Queries that can be answered by one peer locally. Example: “A/B/C//E” at the peer responsible for h(“A/B”). • Queries that require additional broadcast and contain only one sub-path (q=qB). Example: “A” at the peer responsible for h(“A/B”). • Queries that require additional broadcast and contain more than one sub-path (q≠qB). Example: “A//C//E” at the peer responsible for h(“A/C”). • We suggest caching the most popular queries of the type 3 to reduce the number of shower broadcasts. Caching strategy Efficient processing of XPath queries with structured overlay networks
A // C / D // E Caching strategy (2/4): search • The key used for routing is no longer h(qB), but qC=concat(Pl1, Pl2 …Plk), where qB=Pl1 • Example: A C D E P= qC= • The query is routed to a relevant peer which may (or may not) answer the query form cache. • If the query is of the type 3 and cannot be answered locally, its result can be cached. • Similarly, the existing cache can be deleted. Efficient processing of XPath queries with structured overlay networks
Caching strategy (3/4): example … A//C/D//E … Efficient processing of XPath queries with structured overlay networks
Caching strategy (4/4): analysis • A query is profitable to cache if: UpdateCost*UpdateRate(subtree)<SearchCost(subtree)*SearchRate(query) • Where: • UpdateCost – the cost of one cache update (log N) • UpdateRate – average update rate in the sub-tree • SearchCost – the cost of search (routing+broadcast) • SearchRate – the query’s frequency (estimated locally) • The indexing strategy is adaptive to search/update ratio and tries to keep the messaging costs optimal. gathered from neighbours Efficient processing of XPath queries with structured overlay networks
Simulations (1/4): testbed • Java application, stores data locally in a DBMS. • 50 XML documents, >5k unique paths • ~20k data items • In each experiment we used 10k queries randomly generated from the paths Simulations Efficient processing of XPath queries with structured overlay networks
Simulations (2/4): search cost • Parameter t – fraction of “cachable” queries • All “cachable” queries are cached Efficient processing of XPath queries with structured overlay networks
Simulations (3/4): search cost • 1000 peers • t=0.5 (50% of queries can be cached) Efficient processing of XPath queries with structured overlay networks
Simulations (4/4): average costs • 1000 peers, t=0.5, Zipf s=1.2. • For a given search/update ratio there is an optimal point Efficient processing of XPath queries with structured overlay networks
Conclusions • The efficient solution for indexing XML structure in structured overlay networks is proposed. • The presented solution can be used in a P2P XML querying engine for answering structural (sub) queries. Efficient processing of XPath queries with structured overlay networks
Last slide Thank you for your attention! Questions? Efficient processing of XPath queries with structured overlay networks