Near-optimal Routing Lookups
with Bounded Worst-case
Performance
Pankaj Gupta, Balaji Prabhakar and Stephen Boyd
Stanford University
{pankaj, balaji, boyd}@stanford.edu
March 30, 2000
Backbone Routing Table Sizes
80000
70000
60000
50000
15K
40000
30000
20000
10000
0
94
10K
95
96
97
98
99
00
Source: http://telstra.net/ops/bgptable.html
Motivation
Every router performs at least one basic
task: forwarding
Forwarding requires fast lookups
Most lookup schemes: worst-case lookup
time vs storage requirements
We want to minimize the average-case
lookup time
–While still keeping the worst case bounded
Routing Lookups
H
E
A
D
E
R
Destination
Address
Incoming
Packet
Forwarding Engine
Next Hop Computation
Forwarding Table
IP Prefix
Next Hop
----------------
----
IP Router
Next Hop
Longest Prefix Matching
Prefix
171.64.130.2
61.34.2/23
61.34.3/24
171.64.130/24
171/8
Next
Hop
R1
R3
R3
R5
Forwarding Table
R3
Data Structure:Example
P2
0000
I1
P5
I2
0010
P3
P1
0100
I3
P4
0110
1000
Prefix
Interval
P1
*
0000-1111
P2
00*
0000-0011
P3
1*
1000-1111
P4
1101
1101-1101
P5
001*
0010-0011
I4
1010
1100
I5 I6
1110 1111
Lampson et al
[Infocom98]
Alphabetic Tree
0111
>
0011
>
0001
1/2
>
I1
I2
P2
0000
1/4
I1
P5
I2
0010
1/8
I3
>
1/16
Avgtime = 2.85 I4
Maxtime = 3
P1
0100
0110
> 1/32
I6
1100
I3
1101
1000
1/32
I5
P4
P3
I4
1010
1100
I5 I6
1110 1111
Optimal Alphabetic Tree
0001
I1
0011
1/2
0111
I2
1/4
Avgtime = 1.94
Maxtime = 5
I3
1/8
1100
I4
1/16
I5
1/32
1101
1/32
I6
Optimal Depth-constrained
Alphabetic Tree
0001
I1
Avgtime = 2
0011
Maxtime = 4
0111
I2
1100
1101
I3
I4
I5
I6
Problem Statement
li = access time to reach leaf i
pi = probability of accessing leaf i
Minimize LUavg = C = i li • pi st li D i
Most previous work: depth-constrained Huffman trees
Introduction of the alphabetic constraint
increases the difficulty of the problem
Goal: Near-optimal Depthconstrained Alphabetic Tree
Simpler to find than an optimal solution
Probabilities inaccurate anyway
Algorithm MinDPQ
Builds on previous work on alphabetic trees
Lemma[Yeung91]: Given {pk}, can choose {lk}
such that: H(p) C H(p) + 2
C avgLookupTim e
p log p
H ( p)
i
i
pk 2
D
i
k 1, n
log2 pk
lk
log2 pk 1 1 k n
But:
lk D
Depth Constraint
Violated
Our Approach
Original
distribution {pk},
possibly pmin< 2-D
Transform
Probabilities
Transformed
distribution {qk},
qmin 2-D
* log2 qk
Chooselk
min log2 qk 1, D
k 1, n
2 k n 1
Optimal Alphabetic Tree
1
1
1 1 1 1
pk , , ,
,
,
2 4 8 16 32 32
0001
log2 pk 1,2,3,4,5,5
0011
I1
1/2
0111
I2
1/4
D=4
I3
1/8
1100
I4
1/16
I5
1/32
1101
1/32
I6
Transformation
* log2 qk
Chooselk
min log2 qk 1, D
C*
k
pk lk*
k
2 k n 1
D( p q ) H ( p ) 2
minimize DPQ D( p q)
subject to
k 1, n
pk
pk log
qk
k
qk 1 and qk Q 2 D k
Constraint Set
convex and
compact
Solution
pk
*
qk max( , Q) where is st q*
k 1
k
Closed form
solution!
can be found in O(nlogn) time and O(n) space
C*
k
pk lk*
D( p q) H ( p) 2 C opt 2
Depth-constrained Weightbalanced Tree (DCWBT)
root
1/2
1/4,1/8,1/6,1/32,1/32
balance weights equally
DCWBT: distribute weights as equally as
possible under the depth-constraint
Even simpler
Good performance
Simulation Results
Routing #prefixes #intervals Entropy Unopt_
(trace) srch
VBNS
1307
2243
6.63
12
MAE_
WEST
24681
39277
7.89
16
MAE_
EAST
43435
65330
8.02
16
Average Lookup Time
Average lookup time (trace)
MAE_EAST_DCWBT
MAE_EAST_DPQ
Maximum Tree Depth Constraint
Conclusions
Binary search tree data
structure
Minimize average case
while keeping the worst
case bounded
Probabilities are
inaccurate
Two practical,
near-optimal
algorithms
© Copyright 2026 Paperzz