Download presentation
Presentation is loading. Please wait.
Published byClement Walton Modified over 6 years ago
1
Encoding Short Ranges in TCAM Without Expansion: Efficient Algorithm and Applications
Yotam Harchol The Hebrew University of Jerusalem, Israel Joint work with: Anat Bremler-Barr David Hay Yacov Hel-Or IDC Herzliya, Israel Hebrew University, ACM SPAA 2016 This research was supported by the European Research Council under the European Union’s Seventh Framework Programme (FP7/ )/ERC Grant agreement no
2
TCAM – Ternary Content Addressable Memory
TCAM is an associative memory module Useful for parallel multidimensional prefix lookup Each entry may consist of 0, 1, and * bits Widely used in high-speed networking devices What about ranges? (e.g., port numbers) Example: 2-dimensional IP lookup: Source IP Dest. IP P1 P2 Drop P3 SRAM 00110****110001*** 0111***** ** 00*******110****** 01*******11000**** TCAM 1 2 3 4 5
3
Range Encoding in Binary Representation
Can ternary encode only certain intervals Or we need more than one entry (expansion) Exponential space blow-up when using multiple range fields 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111 00** 011* 100* 0*** 01** ???? ???? 0101 011* 100* 1010
4
Encoding Short Ranges Ranges of arbitrary length – infeasible without expansion Ranges with bounded length – feasible! Useful for: Short TCP/UDP ranges (>60% of the ranges in real life) QoS mechanisms (IP ToS/DSCP) Packet size classification (by categories) Timestamps and counters IP spoofing detection (using IP TTL) SDX – AS numbering Also useful for applications outside the networking domain
5
Range Encoding on TCAM: Two Approaches
Database-independent encoding: [Lakshminarayanan et al., 2005; Bremler Barr et al., 2007] fenc([x, y]) = *1**1001**10 **1*10**101* *1**100***1* Easy to update Lower bound for w-bits field without expansion: 2w-1 bits per range [Lakshminarayanan et al., 2005] Database-dependent encoding: [Liu, 2002; Van Lunteren & Engbersen, 2003; Chang & Su, 2007; Che et al., 2008; Bremler Barr et al., 2009; Rottenstreich & Keslassy, 2010; Rottenstreich et al., 2013; Kogan et al., 2014] DB fenc( , [x, y]) = *1**100*10 **1*10*01* Compact codes Both schemes require expansion for a feasible code length
6
RENÉ – Range Encoding with No Expansion
Encoding function for short ranges: fenc([x, y]) = *1**1001**10 Database independent - easy to update No row expansion Near-optimal TCAM space usage Useful for packet classification applications Useful for high dimensional nearest neighbor search
7
Binary-Reflected Gray Code (BRGC)
Build recursively by reflecting binary code: 1 0000 0001 2 0011 3 0010 4 0110 5 0111 6 0101 7 0100 8 1100 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000 1 000 001 2 011 3 010 4 110 5 111 6 101 7 100 1 00 01 2 11 3 10 1 Hamming distance between each two adjacent points = 1
8
Range Encoding with Binary-Reflected Gray Code
With ternary BRGC we can encode some of the ranges of length h=2k (k∈N) What about other (red) ranges? 00** 0000 1 0001 2 0011 3 0010 4 0110 5 0111 6 0101 7 0100 8 1100 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000 01** 11** 10** 0*1* *10* 1*1* *00* *00**
9
Layers Layer: a set of disjoint consecutive ranges
Two (blue) layers can be encoded with a BRGC-based ternary word Other (red) layers need more bits Wait with the k-1 bits. Not here. Also don’t color bits in gray Not necessarily a power of 2 0000 1 0001 2 0011 3 0010 4 0110 5 0111 6 0101 7 0100 8 1100 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000 00** 01** 11** 10** 0*1* *10* 1*1* *00* *00**
10
Cover Ranges Cover range of R: the smallest blue range that fully contains R In red layers: No two consecutive ranges in the same layer are fully contained in a cover range Given the cover range, one bit is enough to differentiate ranges in the same layer Take a red interval from previous slide with its extra bit Show it’s the only one with this bit value in the cover 0000 1 0001 2 0011 3 0010 4 0110 5 0111 6 0101 7 0100 8 1100 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000 R 1 0*** cover(R)
11
Single Bit Range Index Red ranges require different encoding
Add one bit for each red layer Bit value alternates between ranges in the same layer Bits of other red layers are set to * For blue layers, these bits are always * Only one red layer and one bit One bit is enough because I know where I am to some extent 0000 1 0001 2 0011 3 0010 4 0110 5 0111 6 0101 7 0100 8 1100 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000 ** 0* 1* 0* 1* ** *1 *0 *1 *0
12
Encoding Scheme for Ranges
Encoding of a single range of length h=2k is: Value encoding is now: Blue ranges: BRGC(R) Red ranges: BRGC(cover(R)) Ternary BRGC Bit of L1 . . . Lh/2-1 w bits h-2 bits Lh-1 Lh/2+1 BRGC Bit of L1 . . . Lh/2-1 w bits h-2 bits Lh-1 Lh/2+1
13
Toy Example
14
Optimization For ranges of length h=2k k-1 LSBs of the BRGC part are always * Code can be shorten to w-log(h)+h-1 bits 0000|00 1 0001|10 2 0011|10 3 0010|11 4 0110|11 5 0111|01 6 0101|01 7 0100|00 8 1100|00 9 1101|10 10 1111|10 11 1110|11 12 1010|11 13 1011|01 14 1001|01 15 1000|00 00**|** 01**|** 11**|** 10**|** 0***|1* *1**|0* 1***|1* *0**|0* 0*1*|** *10*|** 1*1*|** *00*|** 0***|*1 *1**|*0 1***|*1 *0**|*0 0000|00 1 0001|10 2 0011|10 3 0010|11 4 0110|11 5 0111|01 6 0101|01 7 0100|00 8 1100|00 9 1101|10 10 1111|10 11 1110|11 12 1010|11 13 1011|01 14 1001|01 15 1000|00 00**|** 01**|** 11**|** 10**|** 0***|1* *1**|0* 1***|1* *0**|0* 0*1*|** *10*|** 1*1*|** *00*|** 0***|*1 *1**|*0 1***|*1 *0**|*0
15
Encoding Multiple Range Lengths
For ranges of length 3, intersect two ranges of length 4: 00*|** 000|00 1 000|10 2 001|10 3 001|11 4 011|11 5 011|01 6 010|01 7 010|00 8 110|00 9 110|10 10 111|10 11 111|11 12 101|11 13 101|01 14 100|01 15 100|00 01*|** 11*|** 10*|** 0**|1* *1*|0* 1**|1* 0*1|** *10|** 1*1|** 0**|*1 *1*|*0 1**|*1 *0*|0* *00|** *0*|*0 We present the conjunction operator Π: For two ranges R1, R2: tcode(v) ≈ tcode(R1) Π tcode(R2) if and only if v∈R1 ∩ R2 (also: tcode(R1) Π tcode(R2) = ⊥ R1 ∩ R2 = ∅) (⊥ means ‘undefined’, and if ai Π bi = ⊥ then a Π b = ⊥) Remove gray bits away 4 7 01*|** 5 8 *1*|0* 5 7 01*|** Π *1*|0* = 01*|0*
16
TCAM bits used per range field
Theoretical Bound TCAM bits used per range field (log2 scale) Maximal range length (log2 scale) For w=16
17
The Nearest Neighbor Search Problem
Input: - A set of data points - A query point (or a series of those) (points are in a discrete space) Output: Data point closest to the query point The Curse of Dimensionality: Hard problem for high dimensions (even over 10 or so)
18
The Nearest Neighbor Search Problem
Encode cubes on data points Given a query point, single TCAM lookup returns the smallest cube that contains it No TCAM entry expansion in high dimension Add legend Bullets Data Query
19
The Nearest Neighbor Search Problem
Or instead, save TCAM space Encode cubes on the query point Query TCAM with growing cubes Find first data point to match Goal – small space expansion, one TCAM lookup OR Multiple queries, less entries Data Query
20
Experiment on a Real TCAM
Currently - no evaluation board for TCAM Instead, we used a commodity network switch with a TCAM Switch has 48 ports of 1Gbps each (1.5 Million packet per second) TCAM is 192 bits wide First cut the ternary string into dimensions Then ignore it and cut by header fields d-Dimensional Cube Representation: 00*1**001***011***01*1**00*1**00*1**00****0***1*0****1 1st dimension Src. MAC 2nd dimension Dest. MAC 3rd dimension Src. IP 4th dimension 5th dimension Dest. IP 6th dimension 7th dimension OpenFlow flow_mod Single port: 1.5 Million Queries Per Second! Queries as packets OpenFlow Counters
21
fenc([x, y]) = Conclusions Encoding function for short ranges:
*1**1001**10 Database independent - easy to update No row expansion Near-optimal TCAM space usage Useful for packet classification applications Useful for high dimensional nearest neighbor search
22
Questions? Thank you.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.