Declarative Routing:
Extensible Routing with Declarative Queries
Boon Thau Loo1
Joseph M. Hellerstein1,2, Ion Stoica1
, Raghu Ramakrishnan3,
1University of California at Berkeley, 2Intel Research Berkeley, 3University of Wisconsin-Madison
Declarative Routing: Extensible Routing with Declarative Queries - - PowerPoint PPT Presentation
Declarative Routing: Extensible Routing with Declarative Queries Boon Thau Loo 1 Joseph M. Hellerstein 1,2 , Ion Stoica 1 , Raghu Ramakrishnan 3 , 1 University of California at Berkeley, 2 Intel Research Berkeley, 3 University of Wisconsin-Madison
Joseph M. Hellerstein1,2, Ion Stoica1
, Raghu Ramakrishnan3,
1University of California at Berkeley, 2Intel Research Berkeley, 3University of Wisconsin-Madison
Restricted instantiation of Active Networks for the control plane
Datalog: a declarative recursive query
Well-researched in the database community Well-suited for querying properties of
Run different protocols for different nodes Modify existing protocols in routers
Set up customized routes for different
Expressiveness Safety Efficiency
Routing Infrastructure Node Routing Infrastructure
Neighbor Table Forwarding Table
Result Tuples Derived Tuples
Input Tables Output Tables
Datalog Queries Query Processor
Neighbor Table updates Forwarding Table updates
<head> ← <precondition1>, <precondition2>, … , <preconditionN>.
R2: reachable(S,D) ← link(S,Z), reachable(Z,D) R1: reachable(S,D) ← link(S,D)
“For all S,D, If link(S,D) exists, generate reachable(S,D)” “For all nodes S,D, If there is a link from S to D, then S can reach D”. link(a,b) – “there is a link from node a to node b” reachable(a,b) – “node a can reach node b”
R2: reachable(S,D) ← link(S,Z), reachable(Z,D) R1: reachable(S,D) ← link(S,D)
“For all nodes S,D and Z, If there is a link from S to Z, AND Z can reach D, then S can reach D”. “For all S, D and Z, If link(S,Z) exists AND reachable(Z,D) exists, generate reachable(S,D).”
R2: reachable(S,D) ← link(S,Z), reachable(Z,D) R1: reachable(S,D) ← link(S,D) Query: reachable(M,N)
b a D S
reachable Output table (Round 1):
c b D S
reachable
d c D S
reachable Input table:
d c D S
link
c b D S
link
b a D S
link
E.g. R1: reachable(b,c) ← link(b,c)
R2: reachable(S,D) ← link(S,Z), reachable(Z,D) R1: reachable(S,D) ← link(S,D) Query: reachable(M,N)
c a b a D S
reachable Output table (Round 2):
d b c b D S
reachable
d c D S
reachable Input table:
d c D S
link
c b D S
link
b a D S
link
R2: reachable(b,d) ← link(b,c), reachable(c,d)
R2: reachable(S,D) ← link(S,Z), reachable(Z,D) R1: reachable(S,D) ← link(S,D) Query: reachable(M,N)
d a c a b a D S
reachable Output table (Round 3):
d b c b D S
reachable
d c D S
reachable Input table:
d c D S
link
c b D S
link
b a D S
link
Distributed Datalog Execution Plan Protocol
Expressiveness Safety Efficiency
d a c a b a D S
reachable Output table:
d b c b D S
reachable
d c D S
reachable Input table:
d c D S
link
c b D S
link
b a D S
link
R1: path(S,D,P) ← link(S,D), P=(S,D). R2: link(Z,S), path(S,D,P) P=S+P2. path(Z,D,P2), ← Query: path(S,D,P)
R1: path(S,D,P) ← link(S,D), P=(S,D). R2:
link(S,D) path(S,D,P)
R1 Recursion link(Z,S), path(S,D,P) P=S+P2.
link.S=path.S
R2
while (receive<path(Z,D,P2)>)) { for each neighbor S { newpath = path(S,D,S+P2) send newpath to neighbor S } }
path(Z,D,P2), ← Send path.S
Matching variable Z = “Join”
Pseudocode at node Z:
while (receive<path(Z,D,P2)>)) { for each neighbor S { newpath = path(S,D,S+P2) send newpath to neighbor S } }
R1: path(S,D,P) ← ← ← ← link(S,D), P=(S,D).
R2: path(S,D,P) ← link(Z,S), path(Z,D,P2), P=S+P2.
(a,b) P b a D S (b,c) P c b D S (c,d) P d c D S
Forwarding table:
link(S,D) path(S,D,P) Send path.S
link.S=path.S
R2 R1
P D S P D S P D S
path path path Neighbor table:
d c b D c S
link
a b c D b S
link
b D a S
link
c D d S
link Query: path(S,D,P,C)
R1: path(S,D,P) ← link(S,D), P=(S,D).
R2: path(S,D,P) ← ← ← ← link(S,Z), path(Z,D,P2), P=S+P2.
(a,b) P b a D S (b,c) P c b D S
path path path
(c,d) P d c D S
Forwarding table:
(a,b,c) c a (a,b) P b a D S (b,c,d) d b (b,c) P c b D S
p(b,d,[b,c,d]) p(a,c,[a,b,c]) link(S,D) path(S,D,P) path.S
link.S=path.S
R2 R1
Neighbor table:
d c b D c S
link
a b c D b S
link
b D a S
link
c D d S
link Query: path(S,D,P,C)
R1: path(S,D,P) ← link(S,D), P=(S,D).
R2: path(S,D,P) ← ← ← ← link(S,Z), path(Z,D,P2), P=S+P2.
path path path
(c,d) P d c D S
Forwarding table:
p(a,d,[a,b,c,d]) (a,b,c) c a (a,b) P b a D S (b,c,d) d b (b,c) P c b D S (a,b,c,d) d a (a,b,c) c a (a,b) P b a D S link(S,D) path(S,D,P) path.S
link.S=path.S
R2 R1
Neighbor table:
d c b D c S
link
a b c D b S
link
b D a S
link
c D d S
link Query: path(S,D,P,C)
Distributed Datalog Execution Plan Protocol
Expressiveness Safety Efficiency
R1: path(S,D, ,C) ← link(S,D,C) R2: path(S,D, ,C) ← C=C1+C2, Query: path(S,D, ,C)
link(S,Z,C1), path(Z,D, ,C2),
, P=(S,D). P P P2 P=S+P2. P
R1: path(S,D,P,C) ← link(S,D,C), P= (S,D). R2: path(S,D,P,C) ← link(S,Z,C1), path(Z,D,P2,C2), C=C1+C2, P= S+P2. Query: bestPath(S,D,P,C) R3: bestPathCost(S,D,min<C>) ← path(S,D,Z,C) R4: bestPath(S,D,Z,C) ← bestPathCost(S,D,C), path(S,D,P,C)
R1: path(S,D,P,C) ← link(S,D,C), P= (S,D). R2: path(S,D,P,C) ← link(S,Z,C1), path(Z,D,P2,C2), C=FN(C1,C2), P=S+P2. Query: bestPath(S,D,P,C) R3: bestPathCost(S,D,AGG<C>) ← path(S,D,Z,C) R4: bestPath(S,D,Z,C) ← bestPathCost(S,D,C), path(S,D,P,C)
Customizing C, AGG and FN: lowest RTT, lowest loss rate, highest available bandwidth, best-k
R1: path(S,D, ,C) ← link(S,D,C) R2: path(S,D, ,C) ← C=C1+C2, Query: path(S,D, ,C)
link(S,Z,C1), path(Z,D, ,C2),
, P=(S,D). P P P2 P=S+P2. P
R1: path(S,D, ,C) ← link(S,D,C) R2: path(S,D, ,C) ← link(S,Z,C1), path(Z,D, ,C2), C=C1+C2 Query: (S,D, ,C)
D Z W R3: shortestLength(S,D,min<C>) ← path(S,D,Z,C) R4: nextHop(S,D,Z,C) ← nextHop(S,D,Z,C), shortestLength(S,D,C) Z nextHop
R1: path(S,D,D,C) ← link(S,D,C) R2: path(S,D,Z,C) ← link(S,Z,C1), path(Z,D,W,C2), C=C1+C2 R3: shortestLength(S,D,min<C>) ← path(S,D,Z,C) R4: nextHop(S,D,Z,C) ← nextHop(S,D,Z,C), shortestLength(S,D,C) Query: nextHop(S,D,Z,C)
, W!=S
R1: path(S,D,D,C) ← link(S,D,C) R2: path(S,D,Z,C) ← link(S,Z,C1), path(Z,D,W,C2), C=C1+C2, W!=S R4: shortestLength(S,D,min<C>) ← path(S,D,Z,C) R5: nextHop(S,D,Z,C) ← nextHop(S,D,Z,C), shortestLength(S,D,C) Query: nextHop(S,D,Z,C)
R3: path(S,D,Z,C) ← link(S,Z,C1), path(Z,D,W,C2), C=∞, W=S
R1: path(S,D,P,C) ← link(S,D,C), P= (S,D). R2: path(S,D,P,C) ← C=C1+C2, P=S+P2. Query: path(S,D,P,C)
link(S,Z,C1), path(Z,D,P2,C2),
R1: path(S,D,P,C) ← link(S,D,C), P= (S,D). R2: path(S,D,P,C) ← C=C1+C2, P= P1+D. Query: path(S,D,P,C) path(S,Z,P1,C1), link(Z,D,C2),
Queries use input tables to produce output tables No side-effects on existing input tables
Natural bound on resource consumption of queries
Identify recursive definitions and check for
E.g., monotonically increasing/decreasing cost
Denial-of-service attacks, compromised routers
Aggregate selections: avoid sending
Limit computation to portion of network
Few sources and destinations Magic sets + left-right recursion rewrite
Multi-query sharing:
Identify “similar” queries, share their computations Reuse previously computed paths
Link failures are treated as link updates
Paths invalidated (cost=infinity), and new
Each node runs the query engine of PIER Initialized neighbor table directly accessible by PIER.
Bandwidth and latency bottlenecks Transit-stub topologies
72 PIER nodes Random, location-aware topologies Long-running queries
When all nodes issue the same query,
Scalability properties show similar trends as traditional
DV/PV protocols
When few nodes issue the same query,
Overhead is reduced using standard query optimizations
Long-running all-pairs shortest RTT paths query Ability to handle link RTT changes Induced failures (up to 20% of nodes)
Recovery time: <1s (median), <3.6s (average)
Express routing protocols using a recursive query language Better balance between routing extensibility and safety
Expressing policies as declarative rules Run-time query optimizations:
Cost-based decisions on query rewrites Multi-query sharing
Static checker for routing protocols Run-time monitoring of routing protocols
Research agenda: Specify and construct networks declaratively P2: “Implementing Declarative Overlays” (SOSP 2005)