Compressing Forwarding Tables
Ori Rottenstreich (Technion, Israel)
Joint work with Marat Radan, Yuval Cassuto, Isaac Keslassy (Technion, Israel)
Carmi Arad, Tal Mizrahi, Yoram Revah (Marvell Israel)
Avinatan Hassidim (Google Israel & Bar-Ilan Univ.)
• Forwarding information in datacenter networks is stored in switch forwarding tables• Example:
o Lookup key: MAC Address + VLANo Forwarding Information: Target Port
Forwarding Tables in Datacenters
2
?
• Typical table size: h∙d·b bits
• Host virtualization in datacenter networks results in a rapid growth of forwarding tables.
o More hosts ( h↑ )o More attributes ( d↑ )o More attribute values ( b↑ )
Growth of Forwarding Tables
3
d fields, each of b bits (on average)
1
h
h rows
Field 1
Field 2
Field d
This table architecture doesn’t scale!
hash-based
matching
Packet
header
• Direct access to all rows regardless of their indiceso High packet rate
• Storing each row in a fixed-width memory wordo We would like to minimize the required memory width
Required Properties of a Solution
4
width
row 1
row h
i
P bits (with d fields)
• Illustration of access to the encoded forwarding table. • A single encoded row of at most P bits is retrieved. • Then, d pipelined accesses to d dictionaries are performed.
• Goal: Find d codes that minimize the maximal width P.
Solution Overview
σ1
σ2σd
1
h
hash-based
matching
h rows
5
001 1 10
Packet
header
• Table A with d=3 columns and its encoding scheme
• Obtained maximal width of bits
A Forwarding Table Example
Today
d=3 dictionaries
Suggested Solution
6
Encoded table
Original table
3+1+1=5
2+1+2=5
2+1+1=4
2+1+2=5
2+1+2=5
3+1+1=5
2+1+2=5
width
• Huffman encoding:
o Minimizes the average width but not the maximal widtho Existence of long rows
• Fixed uniform encoding:
o Without long rows, but not efficient
• Our goal: Find an encoding scheme that minimizes the maximal width:
Traditional Solutions
7
• Definition 1 (Encoding Scheme): An encoding scheme of a FIB table with d columns is composed of d prefix codes, one for each column. •Definition 2 (Encoding Width): The encoding width of an encoding scheme is defined as the maximal sum of the lengths of the d codewords in the encoding of a row of A, i.e.
Problem Definition
8
• Definition 3 (Optimal Encoding Width): For a table A, we denote by the smallest possible width of an encoding scheme of A such that
• Our goal: Find an encoding scheme that minimizes the encoding width
• Constraint on the encoding scheme (Kraft’s Inequality): There exists a prefix encoding of the elements in a set with codeword lengths iff
Problem Definition (2)
9
• For a table A with h rows , we define the following optimization problem:
• We would like to minimize the maximal width P while satisfying the Kraft’s inequality for the d prefix codes The codeword lengths should be positive integers.
Optimization Problem
10
• Theorem: Finding the optimal encoding is NP-hard in the general case ( ). • Convex Algorithm:
o Consider the relaxed problem: codeword lengths are not necessarily integers. (The relaxed problem is convex.)o Take the ceiling of the codeword lengths in its solutiono Example: Solution: (2.2, 3.71) (3, 4)
• Theorem: By taking the ceiling of the codeword lengths in an optimal solution to the relaxed problem, we achieve a legal encoding scheme that satisfies
Approximation of the Optimal Encoding
11
Outline
Introduction and Problem Definition General Properties Two Column FIB Tables
Graph Representation Optimal Conditional Encoding Bounds on the Optimal Encoding Width
Experimental Results Summary
12
• Motivation: L2 MAC tables with two fields: Target Port + An additional attribute.
• Assumption: The table A has two columns with distinct elements in each column. •Theorem: The optimal encoding width of A satisfies
Two-Column FIB Tables
13
• A two-column FIB table A can be represented as a bipartite graph. •Example: Two-column FIB table with h=6 rows and (for W=2) distinct elements in each column.
Graph Representation
Forwarding table Bipartite graph
14
• Given an encoding of one column, we would like to find an encoding of the second column that minimizes the encoding width P.
• For an element , we should consider the maximal codeword length of an element in that shares a row with .
Notation:
Optimal Conditional Encoding
15
u a
y
w b
y
y
P bits
v
z
u
• Theorem: The optimal conditional encoding width satisfies
• Notes:• We should encode in bits. • Linear complexity
Optimal Conditional Encoding
16
• Reminder (Edge Cover): In an undirected graph
a set of edges is an edge cover of if .
• Example: nodes at each side ( )
• Intuition:
Smaller covering number More independent edges
Constraints on more elements Larger optimal width
Lower Bound on the Optimal Encoding Width
17
(A) (B)
Edge covering number: 8 Edge covering number: 14
• Theorem: The optimal encoding width of a table A with an edge covering number satisfies
• Example: ( )
Lower Bound on the Optimal Encoding Width
18
(A) (B)
Edge covering number: 8 Edge covering number: 14
33333333
33333333
14444444
14444444
Effectiveness of the encoding algorithm on synthetic FIB tables with d=2 columns and (W=8) elements, as a function of Zipf dist. parameter.
Simulation details: 1000 rows, 10 iterations.
Experimental Results
A lower bound of
.
Lower parameter Closer to the
uniform distribution
19
8 8 1 9
9 1
• Table: 903 rows. Collected in the enterprise network of a large company. • Without encoding: row width of 29 bits.
• With convex encoding: width of only 11 bits.
Real-Life FIB Table
20
improvement
Concluding Remarks
• New architecture for compression of forwarding tables in datacenters
• Approximation of the optimal solution
• Analysis of the optimal encoding width
21
Thank You