Self-organization of Wireless Networks Through Declarative Local Communication (Extended Abstract) St´ephane Grumbach1 , Jia-liang Lu2 , and Wenwu Qu3 1
INRIA-LIAMA Institute of Automation, Beijing, China
[email protected] 2 INRIA ARES, INSA Lyon, France
[email protected] 3 CAS USTC Beijing, China
[email protected]
Abstract. The use of declarative query languages has been proposed recently to express communication protocols. This approach, known as declarative networking, is very promising since it results in very simple programs, which are very easy to use. In this paper, we pursue this approach and show how to express the FISCO protocol using less than 40 simple declarative rules. FISCO was designed for self-configuration and self-organisation of large scale multi-hop wireless networks. The declarative modeling of FISCO has important practical and theoretical consequences. First of all, it results in an implementation much more compact than the initial one which used several thousands code lines, it is easy to use and modify, and enjoys verifiable properties, such as correctness and termination. Second, since FISCO targets large scale networks, its scalability is its first requirement. We show that the good scalability of this protocol follows from the fact that it relies mainly on local distributed processes, which can be expressed using first-order queries. Unlike previous proposals for declarative networking which rely on recursive query languages, we show that first-order queries thus offer a high potential for network protocols.
1
Introduction
The development of ever smaller devices with increased computational and storage capacity as well as the standardization of communication protocols and data format lead to the multiplication of applications supported by networks of often independent devices. Their ad hoc organization, where communication is carried on in a multi-hop manner, together with the limitation of the devices (memory, energy, CPU, etc.) constitute a real challenge for data intensive applications [PJFY04]. The classical client-server model is not adapted for such networks. New applications require highly distributed processes, sharing both their data and their computing power with other nodes. The first operations these systems have R. Meersman, Z. Tari, P. Herrero et al. (Eds.): OTM 2007 Ws, Part I, LNCS 4805, pp. 497–506, 2007. c Springer-Verlag Berlin Heidelberg 2007
498
S. Grumbach, J.-l. Lu, and W. Qu
to perform are their self-configuration and their self-organization. The former ensures that addresses are allocated to all nodes in the network. The selforganization results in the creation of a virtual backbone of the network for optimized communication. We are interested in this paper in a protocol that combines configuration and organization in a single framework, the FISCO protocol [LVBD07]. Once organized, the networks can support highly coordinated interactions based on their data. Sensor networks constitute a fundamental example of this type of networks with a wide range of applications. The evaluation of (mainly aggregation) queries in-network has gained a lot of interest in the database community [MFHH05, SMW05], taking into account the restrictions of the devices as well as the constraints on the communication. They are supporting an increasing variety of applications, in particular for environment monitoring, intelligent housing, interactive gaming, etc. Recently, the use of query languages was proposed to express network communication algorithms such as routing protocols [LHSR05] and declarative overlays [LCH+ 05]. This approach, known as declarative networking is extremely promising to ease the development and the deployment of networking protocols and ensure efficient communication in the network. Declarative query languages allow to express the intention of the protocol, without specifying how it is computed. The system will in a distributed manner, compute the intended protocol. This approach has been further pursued in [LCG+ 06], where execution techniques for Datalog have been proposed. It was also shown how to use recursive queries to perform diagnosis of asynchronous systems [AAHM05], or network monitoring [RH06]. Distributed query languages thus provide new means to express complex network problems such as node discovery [AKS+ 03], route finding, path maintenance with quality of service [BBO+ 05], topology discovery, including physical topology [BBGR03], etc. Previous work on declarative networking relied on recursive languages. Recursive queries are very natural means to express for instance a route from a node to another node. The nodes recursively evaluate the part of the route they are concerned with. We propose instead to consider first-order queries. Firstorder query languages constitute the foundations of most database systems, and most importantly of the relational model introduced by Codd, widely adopted in commercial DBMS. First-order queries are very promising in the distributed context. First-order queries express indeed local properties. The first-order queries considered here can be evaluated by a distributed cooperation of the nodes in bounded neighborhoods. The resulting locality of the algorithms, that is the possibility to evaluate them by using only data in bounded neighborhoods of the nodes, is essential to ensure scalability. In this paper we show that most of the FISCO protocol, in particular all the self-organization part, can be defined using first-order queries, and rely on local processes. The inter-organizational interaction of the nodes is fully distributed and results from the declarative expression of the protocol.
Self-organization of Wireless Networks
499
We use a language which is a variant of Datalog, and is easy to read. In the simplest case, we restrict ourselves to conjunctive queries (no recursion). Our language has a construct from linear logic [Gir87] to consume facts that have been used in deductions. The use of fragments of linear logic to generate plans, by considering proofs as actions had been first proposed in [MTV93]. The paper is organized as follows. In the next section, we recall the FISCO protocol. In Section 3, we present a relational modeling of the configurations of the network. In Section 4, we briefly present the query language derived from Datalog and illustrate the rules execution through a concrete example, we also show the correctness and termination of the protocol.
2
The FISCO Protocol
The FISCO protocol [LVBD07] achieves two fundamental tasks: (i) provide dynamic distributed address allocation in the network, and (ii) generate a virtual backbone of the internal organization. Nodes in the network are classified into four types : new node, leader, gateway and member. A new node is a node before configuration. A leader is in charge of all communication as well as address allocation in its 1-hop neighborhood. The network state information such as the address allocation information are stored only on leaders. Leaders are not directly connected in the network. Gateways interconnect leaders which are separated with 2-hop distance (see Fig. 2). Members are 1-hop neighbors of leaders. Once a member is configured, its incoming and outgoing communication is controlled by its leader. Only leaders send periodical messages to their 1-hop neighbors, while no periodic control traffic is created by other nodes. Leaders and gateways form a virtual backbone in the network. FISCO employs a two-level hierarchical address allocation scheme to guarantee the uniqueness of assigned addresses. On the lower level, a leader assigns an address to a newly arrived neighbor node which guarantees that no address conflict is possible within the 1-hop neighborhood of each leader. On the higher level, the address space in the network is distributed among all leaders. A full address space is divided into address pools. Each leader owns at least one address pool which is allocated when it becomes a leader. In case of network changes such as re-organization and partition merge, re-allocations and modifications of the address pools are adequate to maintain non-conflicting addresses in the network with reduced message overhead. The design of FISCO combines both high level and low level address allocation to ensure the uniqueness of addresses in a partition. Address allocation also takes advantage of existing self-organization structure (leader-gateway backbone). We focus on the node configuration procedure. A newly arrived node can follow three fundamental processes to be integrated into the network organization (see Fig. 1). Partition setup. If no neighbor is detected, the node assigns itself as the first leader with an address pool and an address. It generates a random partition identifier. Hence a new partition appears in the service area.
500
S. Grumbach, J.-l. Lu, and W. Qu
Joining as a member. The node waits a timeout for a Leader Broadcast Msg (LDBR). When detecting this message, it performs a 1-hop address allocation directly with the leader using unicast messages. The leader uses its stateful function to assign an address from its address pool to the node and requires an Address Ack (MBAA). The node becomes a member. Joining as a leader. If no leader is detected, the new node sends a 1-hop broadcast Member Solicitation Msg (MBNS). It is used to look for a configured node in its radio vicinity. Upon receiving of a Member Advertisement Msg (MBNA) from a neighbor, it enters into a 2-hop address allocation procedure with the leader. The leader will allocate a new address pool from the address space (shared by all leaders) to it. At the same time, the leader propagates the update information using the virtual backbone to other leaders in the partition. This node becomes a leader. The neighbor node changes itself to a gateway in order to connect them in the virtual backbone.
M
M
M
L
M
N
M
M
L
M
M
M
L
G
M
N
M
L
L
M
joining as a member
joining as a leader
Fig. 1. A configured network with new nodes joining
The design of this procedure in FISCO takes full advantage of the existing organization for newly arrived nodes. FISCO lets each node firstly discover the network structure within its neighborhood (i.e. the presence of 1-hop leaders and members). Then it achieves address allocation and integrates itself into the structure by using only unicast messages. In the sequel, we illustrate how the protocol can be fully described with a few dozen rules instead of several thousands code-lines.
3
Network Configuration Modeling
We now present the modeling of the network and its configuration using relations. The topology of the communication network is represented by a connected finite undirected graph. The graph is represented by a finite set of vertices V , and a set of edges Link ⊆ V × V . Each node has eventually an address (denoted by ADD ), which is a global identifier, once the self-configuration process is achieved. Before a node receives an address, it first has a location, denoted by L, which is a temporary and locally valid identifier. Locations are chosen in a finite set of character strings
Self-organization of Wireless Networks
Link(f,b) NewNode(f,S0) Link(b,a) Link(b,d) Link(b,e) Link(b,f) Leader(24,205,2,[20-29])
NewNode(h,S0)
h f
Link(g,d) NewNode(g,S0)
d/29 Partition ID :205
501
b/24 e/22
M L
g
M a/27 c/25 G L Link(a,b) Link(a,c) Gateway(27,2)
Link(e,b) Member(22,24)
Fig. 2. A configured network with new nodes joining
C = {a, b, c, ...}. Addresses, in unbounded numbers, are represented by natural numbers in N. Nodes also have states distinguish steps of the protocol. The Link relation is distributed extensionally on the nodes of the network. Each node stores its 1-hop neighbors as illustrated in Fig. 2. On the figure, each node is identified by its location and configured nodes also have their address. When configuring the network, the nodes are partitioned. Each partition has a unique identifier (ID), to which is associated the number of leaders in that partition, denoted by LC. We use three types of relations to model network configurations: configuration relations, message relations and temporary relations. The facts of message relations can be transmitted in the network; the facts of temporary relations are used for local computation. Configuration Relations. As we have seen, the nodes play different roles after their configuration depending upon their type: gateway, leader and member. Gateways are between leaders, and members are attached to leaders. The configuration relations are used to represent nodes: Leader(ADD, ID, LC, [P1 , P2 ]), N ewN ode(Loc, S), M ember(ADD, Leader), Gateway(ADD, LC). The different attributes of these relations are defined as follows. A node before configured has a state (S) and assigned with a location (Loc), while each configured node, has an address (ADD). A member node is attached to some leader. A leader node has a partition identifier (ID), the number of leaders of
502
S. Grumbach, J.-l. Lu, and W. Qu
this partition (LC), as well as an address pool ([P1 , P2 ]). A gateway node has a number of leaders it connects. In Fig. 2, the fact Leader(24, 205, 2, [20-29]) stored in node b, indicates that node b whose address is 24 is a leader in the partition 205 where the number of leaders is 2. The address pool [20-29] indicates the addresses that leader b can allocate to its members. N ewN ode(f, S0 ) stored in node f indicates that node f has not been configured; its location is f and the state is S0 . Message Relations. In the process of configuration, different types of messages are transmitted in the network. The message relations are used for that purpose, such as: LDBR(L, ADD, ID, LC), M BAR(L, L), LM AA(L, L, ADD), M BAA(L, ADD), etc. The semantics of these relations will become clear with their use in the rules. Message relations have an attribute L (the first attribute) for the location of the destination. – If the attribute is null, the fact should be broadcasted to all neighbors; – If the attribute is the address or location of a neighbor, the fact should be unicasted to this neighbor; When broadcasted, each message has the address (ADD ) or sometimes the location (L) of the emitting node. In Fig. 2, for instance, leader b broadcasts periodically the fact LDBR(null,24,205,2). When node f receives it, this fact will trigger the application of rules as we will see in the sequel. Temporary Relations. Some auxiliary relations are used during the computation, such as the facts: BiggestLeader(ID, LC), T empLeader(LD, ID, LC), BelongLeader(LD), InitialEvent, T imeEvent, etc; where the attribute LD is for the address of node.
4
Declarative Modeling
We have seen in the previous section how the configuration of the network can be modeled using relations. In the present section, we first briefly introduce the syntax and semantics of the query language which is derived from Datalog. Next, we show how the program works through a simple example. Results of the analysis of the declarative protocol are then presented. 4.1
Syntax and Semantics
We assume the existence of two countably infinite and pairwise disjoint sets of symbols the constants and the variables. A term is a constant or a variable. A positive (resp. consumption) literal is an expression of the form R(t1 , ..., tm ) (resp. !R(t1 , ..., tm )) where R is an m-ary relation symbol and the ti ’s are terms. A rule is an expression of the form A ← L1 , ..., Ln where the body L1 , ..., Ln is a sequence of literals and the head A is an positive literal. A program is a finite set of rules.
Self-organization of Wireless Networks
503
The semantics of a rule is defined as: if for some instantiation of the variables, the conjunction of the facts in the body L1 , ..., Ln are true, then the fact A can be derived. The semantics of a program, or set of rules, is defined by the iteration of the rules over the data stored in the local data store. The rules are evaluated in parallel, repeatedly till no new data are generated. Moreover, the consumption in the program can lead to infinite loops if the program cannot terminate. In the full paper, we introduce safety conditions, that ensure the termination of the programs. Consider the configuration of node f in Fig. 2 illustrated in the following tables, when node f is switched on at local time Tf , it initializes itself first. After initialization, the fact InitialEvent is consumed and the derived fact N ewN ode(f, S0 ) indicates that node f is in the state S0 . Node Time Rules executed f Tf InitialEvent ←;
New local data InitialEvent
N ewN ode(f, S0 ) ←!InitialEvent; N ewN ode(f, S0 ) InitialEvent (((( (
In the leader b the fact LDBR(null, 24, 205, 2) is broadcasted periodically through the fact (signal) T imeEvent from its local timer. The fact T imeEvent is consumed after the rule’s execution. In the new node f , two rules are activated by the fact LDBR(f, 24, 205, 2): N ewN ode(f, S1 ) ←!N ewN ode(f, S0 ), LDBR(f, 24, 205, 2); T empLeader(24, 205, 2) ← N ewN ode(f, S1 ), !LDBR(f, 24, 205, 2); In the execution of the first rule, the fact N ewN ode(f, S1 ) is generated and the fact N ewN ode(f, S0 ) is consumed which means the new node f switches to the state S1 from the state S0 . In the execution of the second rule, the fact T empLeader(24, 205, 2) is stored in local data store. Node Time Rules executed b Tb0 LDBR(null, 24, 205, 2) ←
New local data
Leader(24, 205, 2), !T imeEvent;
f
T f + t0
LDBR(f, 24, 205, 2) N ewN ode(f, S1 ) ←!N ewN ode(f, S0 ), LDBR(f, 24, 205, 2); T empLeader(24, 205, 2) ←
N ewN ode(f, S1 )
(
((S0 ) N ewN ode(f, (( (
T empLeader(24, 205, 2)
( (( ( Receiving the fact (signal) T imeEvent new node f switches to state S2 from S1 through the execution of the rule: (205, 2) N ewN ode(f, S1 ), !LDBR(f, 24, 205, 2); LDBR(f, (((24,
N ewN ode(f, S2 ) ←!N ewN ode(f, S1 ), !T imeEvevnt; Next, the fact N ewN ode(f, S2 ) activates another rules which is used to choose the biggest one (BelongLeader(24)) from all the T empLeader facts. Then the following rule activated by the fact BelongLeader(24):
504
S. Grumbach, J.-l. Lu, and W. Qu
M BAR(b, f ) ← N ewN ode(f, S2 ), !BelongLeader(24); is used to send an address requirement message to leader b. Node Time Rules executed New local data f Tf + τ N ewN ode(f, S2 ) ←!N ewN ode(f, S1 ), N ewN ode(f, S2 ) ((S( !T imeEvevnt; N ewN ode(f, 1) (( (
BiggestLC(choose,max) ← BiggestLC(205, 2) N ewN ode(f, S2 ), T empLeader(24, 205, 2); BelongLeader(choose) ← !BiggestLC(205, 2), !T empLeader(24, 205, 2); MBAR(b, f ) ← N ewN ode(f, S2 ), !BelongLeader(24);
BelongLeader(24)
(( ( (( T empLeader(24, 205, 2) (((( ((( ((( BelongLeader(24) ((( ( BiggestLC(205, (((( 2)
Leader b returns the address reply (LM AA(f, b, 28)) after it received the fact M BAR(b, f ). When the fact LM AA(f, b, 28) reaches node f , the activated rule: M ember(28, 24) ←!N ewN ode(f, S2 ), LM AA(f, b, 28); is used to configure the new node f to be a member of leader b. And then member f sends the acknowledge message (M BAA(b, 28)) to leader b. Node b
Time Tb1
Rules executed
New local data MBAR(b, f )
LMAA(f, b, 28) ←!MBAR(b, f );
MBAR(b, f) (((( (
Leader(24, 205, 2, [20-29]),
f
T f + τ + t1
LMAA(f, b, 28) Member(28, 24) ←!N ewN ode(f, S2 ), Member(28, 24) LMAA(f, b, 28); MBAA(b, 28) ← Member(28, 24),
((S( N ewN ode(f, 2) (( ( ( ( ( ( LMAA(f, b, 28) ((
!LMAA(f, b, 28);
The whole protocol can be expressed with such rules. The local configuration program (LCP ) is the set of 33 rules used to configure a new node. The partition information propagation program (PIPP ) is the set of 5 rules used to propagate partition information in the backbone. See [Net] for the complete set of rules. 4.2
Analysis
We first consider the termination of the program under the following assumptions: (i) the system is synchronous; (ii) there are no simultaneous switching on nodes; and (iii) the density of the nodes induces a bound on the degree. Theorem 1 (Termination). Under the previous assumptions, the configuration of a new node using the rules of the program LCP ∪ PIPP terminates.
Self-organization of Wireless Networks
505
In the full paper, we show that the LCP program terminates in at most 7 rounds. Next, we consider the correctness of the program. A configuration process is correct if: 1. After configuration each node has a unique address in each partition. 2. Each member is attached to a unique leader. 3. Each gateway interconnects at least two leaders and only leaders. 4. Leaders cannot be connected together. If two leaders are connected to the same gateway, they have the same partition information. Theorem 2 (Correction). The configuration process using the rules of LCP and PIPP is correct.
5
Conclusion
The main contribution of this paper is the modeling of a fundamental networking protocol, the FISCO protocol designed for self-configuration and selforganization of large scale multi-hop wireless networks, using essentially a firstorder local declarative query language. Our results demonstrate the importance of first-order logic for expressing coordination processes in a fully distributed environment, while maintaining scalability. We have shown how the use of declarative query languages simplifies greatly the programming of the protocols, compactifies the code, and allows the verification of formal properties of protocols. Fundamental applications of our results, follow from the possibility to develop adaptive methods that combine network management with data-intensive applications. Indeed, applications such as e-commerce, e-health, e-science, social networking among others rely on very large datasets that are manipulated through standard query languages. The expression of both the networking protocols and the data intensive applications in a combined framework relying on query languages, open new widely unexplored in-network adaptive optimization techniques. Such declarative protocols are under development on the Netquest system, which relies on a novel query engine for applications distributed over multihop networks, supporting both data intensive applications and networking. Acknowledgements. The authors wish to thank Huimin Lin, Fabrice Valois and St´ephane Ub´eda for fruitful discussions.
References [AAHM05] Abiteboul, S., Abrams, Z., Haar, S., Milo, T.: Diagnosis of asynchronous discrete event systems: datalog to the rescue! In: Proceedings of the Twenty-fourth ACM SIGACT-SIGMOD- SIGART Symposium on Principles of Database Systems, Baltimore, Maryland, USA, ACM Press, New York (2005)
506
S. Grumbach, J.-l. Lu, and W. Qu
[AKS+ 03]
Alonso, G., Kranakis, E., Sawchuk, C., Wattenhofer, R., Widmayer, P.: Probabilistic protocols for node discovery in ad hoc @multi-channel broadcast networks. In: Pierre, S., Barbeau, M., Kranakis, E. (eds.) ADHOCNOW 2003. LNCS, vol. 2865, Springer, Heidelberg (2003) [BBGR03] Bejerano, Y., Breitbart, Y., Garofalakis, M.N., Rastogi, R.: Physical topology discovery for large multi-subnet networks. In: INFOCOM (2003) [BBO+ 05] Bejerano, Y., Breitbart, Y., Orda, A., Rastogi, R., Sprintson, A.: Algorithms for computing qos paths with restoration. IEEE/ACM Trans. Netw. 13(3) (2005) [Gir87] Girard, J.-Y.: Linear logic. Theor. Comput. Sci. 50, 1–102 (1987) [LCG+ 06] Loo, B.T., Condie, T., Garofalakis, M.N., Gay, D.E., Hellerstein, J.M., Maniatis, P., Ramakrishnan, R., Roscoe, T., Stoica, I.: Declarative networking: language, execution and optimization. In: Proceedings of the ACM SIGMOD International Conference on Management of Data, Chicago, Illinois, USA, June 27-29, ACM Press, New York (2006) [LCH+ 05] Loo, B.T., Condie, T., Hellerstein, J.M., Maniatis, P., Roscoe, T., Stoica, I.: Implementing declarative overlays. In: Proceedings of the 20th ACM Symposium on Operating Systems Principles 2005, SOSP 2005, Brighton, UK, ACM Press, New York (2005) [LHSR05] Loo, B.T., Hellerstein, J.M., Stoica, I., Ramakrishnan, R.: Declarative routing: extensible routing with declarative queries. In: Proceedings of the ACM SIGCOMM 2005 Conference on Applications, Technologies, Architectures, and Protocols for Computer Communications, Philadelphia, Pennsylvania, USA, ACM Press, New York (2005) [LVBD07] Lu, J.-L., Valois, F., Barthel, D., Dohler, M.: Fisco: A fully integrated scheme of self-configuration and self-organization for wsn. In: IEEE/WCNC (2007) [MFHH05] Madden, S., Franklin, M.J., Hellerstein, J.M., Hong, W.: Tinydb: an acquisitional query processing system for sensor networks. ACM Trans. Database Syst 30(1) (2005) [MTV93] Masseron, M., Tollu, C., Vauzeilles, J.: Generating plans in linear logic i. actions as proofs. Theor. Comput. Sci. 113(2), 349–370 (1993) [Net] Netquest. liama.ia.ac.cn/wiki/doku.php?id=projects:network query processing:home [PJFY04] Perich, F., Joshi, A., Finin, T.W., Yesha, Y.: On data management in pervasive computing environments. IEEE Trans. Knowl. Data Eng. 16(5), 621–634 (2004) [RH06] Reiss, F., Hellerstein, J.M.: Declarative network monitoring with an underprovisioned query processor. In: ICDE (2006) [SMW05] Srivastava, U., Munagala, K., Widom, J.: Operator placement for innetwork stream query processing. In: PODS 2005, pp. 250–258 (2005)