Replica-aware, multi-dimensional range queries in Distributed Hash Tables Antony Chazapis * , Athanasia Asiki, Georgios Tsoukalas, Dimitrios Tsoumakos, Nectarios Koziris Computing Systems Laboratory, School of Electrical and Computer Engineering, National Technical University of Athens, Greece article info Article history: Received 7 May 2009 Received in revised form 4 September 2009 Accepted 26 January 2010 Available online 1 February 2010 Keywords: Peer-to-peer systems Distributed Hash Tables Replication Multi-dimensional data Range queries abstract In this paper, we present and evaluate a protocol that enables fast and accurate range-query execution in Distributed Hash Tables (DHTs). Range queries are of particular importance when the network is popu- lated with groups or collections of data items, whose respective identifiers are generated in a way that encodes semantic relationships into key distances. Contrary to related work in the same direction, our proposed query engine is aware of data replicas at the DHT level and by grouping related nodes into rep- lica neighborhoods, resolves queries with the minimum amount of messaging overhead. Moreover, we suggest pairing respective operations with the core DHT routing mechanics, which allows for reusing existing management and monitoring structures and automatically adapting the query path to the dynamic characteristics of the overlay. We also present an application scenario and the respective deployment details of a prototype implementation in the context of the Gredia project. Ó 2010 Elsevier B.V. All rights reserved. 1. Introduction Peer-to-peer computing has been widely accepted as a robust, easily deployable paradigm on which fully distributed, scalable applications can be built. Respective protocols focus on defining the transactions between autonomous network endpoints that col- lectively form an extensible and resilient substrate – a network overlay, which can operate unsupervised and dynamically adjust it- self to unadvertised node arrivals and departures, or sudden net- work black-outs. Structured systems, also commonly known as Distributed Hash Tables (DHTs), represent a major class of peer- to-peer arrangements that abstract the aggregate network as a key-value based indexing and storage facility. All available designs, share the common concept of hashing both peers and data values to identifiers that represent slots of a pre-defined virtual fabric. In the identifier space, each node takes on the responsibility of storing values and managing operations that refer to data with IDs ‘‘close” to its own. DHT implementations are designated by the shape of the identifier space used and consequently the corresponding dis- tance function [1]. Kademlia [2] uses an XOR metric, which implies placement at the leaves of a binary tree, while Chord [3] organizes all IDs clockwise around a circle. DHTs pose as perfect candidates for replacing ‘‘traditional” cen- tralized or layered global-scale databases of information that can be easily transformed to a key-value form (i.e. DNS records [4]). Their simple put/get interface allows the direct application of tradi- tional programming models to a global scale. Nevertheless, their applicability is limited, due to the lack of inherent support for pro- cessing related subsets, or ranges of data identifiers. Expressing range queries in multiple simpler primitive lookups for all interme- diate IDs is not scalable. Ideally, such operations should be inter- nally handled by the overlay, while both respecting and sustaining the scalability and fault-tolerance mechanics that have made DHTs a prominent platform for supporting distributed applications. This also reflects a common focus of many recent research ini- tiatives, that propose advanced or complex DHT lookup functions – functions which exploit semantic relationships between data items, including similar or nearest neighbor searching or process- ing aggregate sets of closely related items. As group operations re- quire data ordering, the hash function for placing values into the identifier space is usually replaced with a locality-preserving map- ping scheme. When the data to be distributed is already tied to one or more indices, such a scheme can transform their numeric repre- sentations to a single identifier, while maintaining their original organizational and clustering properties. Example mapping func- tions for multi-dimensional values may be based on the Z or Hilbert space-filling curves (SFCs). Motivated to implement a DHT capable of performing range queries on multi-dimensional data, we have investigated numer- ous systems presented in related work and found that most exhibit shortcomings that originate from their two-level architecture, choice of range-query resolution algorithms, or both. Using sepa- rate layers for query handling and routing complicates operations, 0140-3664/$ - see front matter Ó 2010 Elsevier B.V. All rights reserved. doi:10.1016/j.comcom.2010.01.024 * Corresponding author. Tel.: +30 210 7722867; fax: +30 210 7721292. E-mail addresses: chazapis@cslab.ece.ntua.gr (A. Chazapis), nasia@cslab.ece. ntua.gr (A. Asiki), gtsouk@cslab.ece.ntua.gr (G. Tsoukalas), dtsouma@cslab.ece. ntua.gr (D. Tsoumakos), nkoziris@cslab.ece.ntua.gr (N. Koziris). Computer Communications 33 (2010) 984–996 Contents lists available at ScienceDirect Computer Communications journal homepage: www.elsevier.com/locate/comcom