260 likes | 275 Views
Optimal Routing Table Design for IP Address Lookups under Memory Constraints. Gene Cheung, Steven McCanne Dept of EECS, UC Berkeley. an example application of the framework how it relates to framework?. Outline. Motivation Problem Formulation NP-complete
E N D
Optimal Routing Table Design for IP Address Lookups under Memory Constraints Gene Cheung, Steven McCanne Dept of EECS, UC Berkeley
an example application of the framework how it relates to framework? Outline • Motivation • Problem • Formulation • NP-complete • Pseudo-polynomial Algorithm (optimal) • Lagrangian Algorithm (approx.) • Results
Motivation • Today, problem is not clearly in rate of lines • Problem is in slow routers Routers are not fast enough
Motivation • Router get packet with IP Address • Find port in Routing Table • Send packet to port We would like to find FAST
Motivation Input for Table Design: set of variable length prefixes & port #s Note: not prefix-free
though IP addrs is each 32 bits long, longest prefix match is variable length infocom 99 Motivation In order to achieve Fast IP addr lookup: • Find longest prefix match in routing table corres. to IP addr.ofIP packet router
input: set of prefixes rep:binary tree complete prefix tree 1 c Problem 0 1 c 0 0 1 d e 0 1 a b
input: set of prefixes rep:complete prefix tree algo1: bit-by-bit, O(h) Problem 0 1 0 1 0 1 c d e 0 1 a b
input: set of prefixes rep:complete prefix tree algo1: bit-by-bit, O(h) algo2: full table, O(1), but size 2h slow mem 000 111 h a b c c d d e e Problem Q: What is the optimal arrangement of tables that minimizes decoding time?
. . . P T2 . . . T1 M2 M1 specified code is an locally optimized patch of code that perform a signal processing operation, to be defined Machine Model • Dependent on parameters of a machine model • Parameters: sizes and speeds of different hierarchical memories.
how does this slide follow from previous? this is step 3 p, Q, T’s, cost is H(b) total size of tables assigned to type 1 mem is R(b) B is set of possible config M1 h=2 H(b) = pa(T1 + T2) + pb(T1 + T2) + pc T1 + pd T1 + pe T1 4 R(b) = 4 M2 h=1 min H(b) s.t. R(b) S1 (P) b e B Formulation Def: Arrangement of tables in mem. is called a configuration, denotedb. 1 c d e Def’n: Total prob. flow thru a node i is called weight, denotedwi. a b H(b) = (pa+ pb+ pc+ pd+ pe) T1+ (pa+ pb+ pc )T2 = =w1 T1 + w4 T2 S2 = pi = prob of codeword i
NP-Complete • Prove the problem is NP-complete. • Reduction from 3D Matching problem in tech. report. • An algorithm that finds optimal solution must have exponential running time. • Pseudo-polynomial algorithm, O(n S12). • Development of approximate algorithm.
define TP1(i, s1), TP2(L, s1) table of height h, 2 choices: i) type 1: cost: wiT1 mem: s1 - 2h = TP2({j e Lh,i}, s1 - 2h) + wi T1 h h h children nodes Optimal Algorithm i
i) type 2: cost: wiT2 mem: s1 = TP2({j e Lh,i}, s1) + wi T2 h h h children nodes Optimal Algorithm i
Optimal Algorithm • Equations: TP1(i, s1) = min {min [TP2({j e Lh,i}, s1 - 2h) + wi T1, TP2({j e Lh,i}, s1) + wi T2 ]} TP2({.}, -) = infinite, TP2({}, +) = 0, TP1(., -) = infinite • dynamic programming 1 h Hi
multiple node argument: ...TP2({j e Lh,i}, s1) + ... 1. split into 2 sets 2. divvy up avail. memory TP2(L1, s) + TP2(L2, s1 - s) s s s children nodes s s s Optimal Algorithm s1 s1 i L1 L2
Optimal Algorithm • divide set of nodes into 2 disjoint sets • find optimal division of mem. space TP2(L, s1) = min {TP2(L1, s) + TP2(L2, s1 - s) } 0 s s1 s.t. L = L1 L2, L1 L2 = {} *select sets s.t. nodes in set have common ancestor, and 2 ancestors distinct & same level
“Efficient Bit Allocation for an Arbitrary Set of Quantizers” Approx. Algorithm • Lagrangian based*, dynamic programming • Solve the Lagrangian problem, unconstrained • Create DP table to store values of overlapping sub-problems each sub-problem is solved only once • Terminates in bounded error solution * Gersho & Shoham, IEEE Trans. ASSP, 88.
R(b*) b2 b1 S1 l Approx. Algorithm • Original problem: min {H(b)} s.t. R(b) S1 (P) • Lagrangian problem: min {H(b) + l R(b)} (D) Thm 1: l 0 s.t. opt. sol’n to (D), b*, is s.t. R(b*) = S1 , then b* is also opt. sol’n to (P). Thm 2: Error bounded by, | H(b1) - H(bP) | | H(b1) - H(b2) | b e B b e B
h=3 a b c c d d e e h=2 0 1 c d 0 e 1 0 1 0 1 c d e a b 0 1 a b how to solve (D) for given lambda? given h, Approx. Algorithm • For each l, we define TP1(i, l) as function that returns min. value of (D) for tree rooted at node i. • 2 options at node i: a) table in type 1 mem., • b) table in type 2 mem. a) TP1(i, l)= wi T1 +l 2h + child. cost b) TP1(i, l)= wi T2 + child. cost
how to solve (D) for given lambda? size of table is O(n) Approx. Algorithm • After simplification, we get: TP1(i,l) = min {TP2({j e Lh,i}, l) + min [wi T1 + l 2h, wiT2]} TP2(L,l) = SUM TP1(i,l) • Store value of TP1(i, l) in ith entry of DP table 1 h Hi saving here! j e L
Approx. Algorithm Q: How to find next multiplier value? A: Since R(b*) is inverse proportional to l, Binary search on real line. R(b*) S1 l
Implementation • Platform is Pentium II 266 MHz processor: • L1 cache: 16 kB, L2 cache: 512 kB • table lookup operation: T1 = 2, T2 = 4 • Approx. configuration (Algorithm) is generated using C / inline Assembly code.
M1, platform, Results • Lookup table only • Test data (IP Address lookup): • Routing table at PAIX (6/19/98) with 2638 prefixes • Routing tableat AADS (6/19/98) with 23068 prefixes • Generate 10 million IP address, assuming i.i.d. prefixes • Compare to: • Srinivasan & Varghese, Sigmetrics, 98.
mil lookups / sec 8.9% in PAIX, 25.4% in AADS Results • PAIX: 8.9% improvement • AADS: 25.4% improvement mil. lookups / s
Conclusion • Given a machine model, find the optimal routing table design. • Use similar optimization techniques for more general classification problems?