1 / 33

Space-Efficient TCAM-based Classification Using Gray Coding

Infocom paper presentation. Space-Efficient TCAM-based Classification Using Gray Coding. Anat Bremler – Barr Interdisciplianry Center. Danny Hendler Ben-Gurion University. Talk outline. Definitions Problem definition, prior art The Short Range Gray Encoding Algorithm

albany
Download Presentation

Space-Efficient TCAM-based Classification Using Gray Coding

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Infocom paper presentation Space-Efficient TCAM-based Classification Using Gray Coding Anat Bremler – Barr Interdisciplianry Center Danny Hendler Ben-Gurion University

  2. Talk outline • Definitions • Problem definition, prior art • The Short Range Gray Encoding Algorithm • Experimental results • Future work

  3. Packet Classification

  4. ACL ID ACL11 ACL11 ACL11 ACL11 ACL11 ACL11 ACL11 117.57.3.2 Sourceaddr 127.*.*.* 128.32.0.0 128.32.0.0 95.14.5.1 117.57.3.2 128.32.0.0 136 80 55 34-36 >1024 >1024 Sourceport ≤ 1024 32.12.1.1 46.2.67.11 32.*.*.* 95.12.3.3 Destaddr 32.*.*.* 32.12.1.1 32.12.1.1 15 25 ≤ 1024 15-18 80 80 Destport 80 TCP TCP Protocol TCP UDP TCP TCP UPD Action Allow Allow Allow Log Log Deny Deny searchkey f Packet Classification header payload ACL database

  5. Search key 0011101101010000010100111110110 Ternary content-addressable memory • Associative memory: parallel comparisons against all entries • Fixed-width entries • Ternary digits: 0 / 1 / X (don’t care) • Only first match is returned TCAM 1 0011101101010XX00X01001111XXXX 11X00X00001110X0X101000110XXXX 2 3 10XX010100X0XX0100011010X01000 4 001110XXXXXXXXXXXXXXXXXXXXXXX ... 1 1110XX010X01X0010101010X0XXXXX Width of W digits

  6. TCAM 1 0011101101010XX00X01001111XXXX 11X00X00001110X0X101000110XXXX 2 3 10XX010100X0XX0100011010X01000 4 001110XXXXXXXXXXXXXXXXXXXXXXX ... 1110XX010X01X0010101010X0XXXXX TCAM: pros, cons, usage • Pros • High throughput • Deterministic throughput • Cons • Higher cost (~X30 than SRAM) • Higher power consumption • Usage • Over 6M deployed devices (2004) • Used in multi-gigabit systems with >10K rules • May support 128K entries of 144- bit, 133M searches/second.

  7. How can we efficiently represent range rules by TCAM entries? The problem: TCAM range representation Match-type rule field value matching key-field exact 00111011011011000000 001110110110110000000 001110110110110000000 prefix 001***************** range >1024 2012

  8. 0 1 000 001 010 011 100 101 110 111 [1,6] TCAM entries: 001, 01*, 10*, 110 Basic approach: prefix expansion Representing [1,6] • Prefix expansion is inefficient • A range over W-bits may expand to 2W-2 entries • For 2 range-fields, may expand to (2W-2)2 • Expansion factor of up to 6 on real-world databases !!!

  9. XXXXX XXXXX XXXXX XXXXX ... XXXXX Extra bits(typically 36) Prior art: use of extra bits TCAM 1 0011101101010XX00X01001111XXXX 2 11X00X00001110X0X101000110XXXX 3 10XX010100X0XX0100011010X01000 4 001110XXXXXXXXXXXXXXXXXXXXXXX ... 1110XX010X01X0010101010X0XXXXX • Hierarchical database dependent encoding [Liu2002], [Lunteren and Engbersen2003] • Database-Independent Range Pre-Encoding [Venkatachary,Lakshminarayanan, Rangarajan2005]

  10. XXXXX XXXXX XXXXX XXXXX ... XXXXX Prior art: database-dependent encoding Key idea: allocate an extra bit to commonly occurring ranges. TCAM Example Source-port ≥ 1024 1 0011101101010XX00X01001111XXXX 2 11X00X00001110X0X101000110XXXX 3 10XX010100X0XX0100011010X01000 Representing a rule Set the assigned extra bit to 1 Set all other extra bits to X 11010010101XXXXXXXXXXXXXXXXXX 4 001110XXXXXXXXXXXXXXXXXXXXXXX 1 ... 1110XX010X01X0010101010X0XXXXX Generating the search key If source-port within range set extra bit to 1 Otherwise set extra bit to 0

  11. Fence encoding(w-bit words) Range Encoding = i 02w-i-11i ≥ i x2w-i-11i < i 02w-ixi-1 [i,j] 02w-1-jXj-i1i Prior art: database-independent range –pre-encoding (DIRPE) Key idea: Use extra bits for independent encoding, use general ternary values rather than prefixes. Number i is encoded by: 02w-1-i1i • Fence encoding • Expansion 1 • Requires 2w-1 bits What if we have a smaller number of bits?

  12. Key idea: Divide all (regular plus extra) bits to chunks, encode each by fence encoding W+36 bits XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Chunk1 (k1 bits) Chunk2 (k2 bits) Chunk4 (k4 bits) Chunk3 (k3 bits) Prior art: database-independent range –pre-encoding (cont’d) What if a smaller number of bits is available? Range expansion increases with the number of chunks

  13. An Observation: The problem is equivalent to the DNF expression minimization problem R=[10,11] b1b0 + b1b’0 ≈ b1 The general problem is NP-complete. • “Computing the minimum DNF representation of boolean functions defined by interval” • [Schieber, Geist, Zacks, 2005] • A linear-time algorithm for finding minimum-size DNF expression for any range of binary-coded numbers • Worst-case expansion for binary-encoded numbers is 2W-4 Thanks to Ronny Roth for the observation and the reference to the paper

  14. Talk outline • Definitions • Problem definition, prior art • The Short Range Gray Encoding Algorithm • Experimental results • Open questions

  15. Our solution: Short-Range Gray Encoding (SRGE) Gain without pain: Range expansion reduction can be obtained without the use of extra bits by changing the encoding scheme (SRGE) SRGE can be combined with database-dependent scheme: the Hybrid-SRGE scheme Hybrid-SRGE yields range-expansion of only 1.02 on real databases

  16. An example: covering [1,2] Binary encoding Gray encoding 00 01 10 11 00 01 11 10 Cover set: {01, 10} Cover set: {*1} Our solution: observations • Ranges tend to be small: typically correspond to similar-functionality ports: • 161-162: snmp, snmptrap • 67-68: bootps server, bootps client • 2300-2400: Microsoft DirectX • Binary coding not optimal for small ranges

  17. Obviously, not `our’ Frank Gray 3-bit BRGC: 000 001 011 010 110 111 101 100 0 0 0 0 0 0 0 0 4-bit BRGC: 1 1 1 1 1 1 1 1 Binary Reflected Gray Code Gray code: codewords for consecutive integers differ by single bit 000 001 011 010 110 111 101 100 100 101 111 110 010 011 001 000 Transforming binary  BRGC is quick

  18. Binary Reflected Gray Code (cont’d) 1 0 0 1 0 1 0 1 1 0 0 1 1 0 000 001 011 010 110 111 101 100 It is exactly this reflection property that helps decrease expansion

  19. p The SRGE algorithm Need to find minimum cover of [s,e] using gray coding. Find the least common ancestor p of point s and e s e

  20. pl pr The SRGE algorithm Let pl be the rightmost leaf in p’s left sub-tree Let pr be the leftmost leaf in p’s right sub-tree p s e

  21. The SRGE algorithm First, we handle the smaller of: [s,pl], [e,pr] p s pl pr e

  22. s’ The SRGE algorithm Cover by prefixes the smaller range and its mirror relative to p p s pl pr e We still need to cover the leftover range [s’,e], if it is non-empty

  23. p’ pl’ pr’ The SRGE algorithm • Repeat the previous procedure for the leftover: [s',e] • find their least common ancestor p’ • let pl' be the rightmost leaf in the left sub-tree of p' • let pr' be the leftmost leaf in the right sub-tree of p' p s pr s' e

  24. The SRGE algorithm • Two cases to consider: • |[pr', e]| > |[s', pl']|: • Cover [pr', e] by prefixes • The mirror of [pr', e] (relative to p') covers [s', pl'] p p’ s pr s’ pl’ pr’ e

  25. The SRGE algorithm • |[s', pl']|>|[pr', e']|: • Cover [pr', e] by prefixes. • Cover [s', pl'] by one a single prefix, corresponding to p' left sub-tree p p’ q ql s pr s’ pl’ pr’ e

  26. Hybrid-SRGE • For each unique range, compute total number of redundant entries under SRGE • Deal with the most expensive ranges by using standard database-dependent encoding

  27. Talk outline • Definitions • Problem definition, prior art • The Short Range Gray Encoding Algorithm • Experimental results • Future work

  28. SRGE range-expansion reduction Random ranges

  29. 223K rules with 300 unique ranges Combined from collection of 126 separate databases (firewall, acl-routers, intrusion prevention systems) Results on a real-life database Algorithm Expansion Redundancy Hybrid SRGE 1.03 1.2 Hybrid DIRPE 1.12 NA Prefix expansion 2.6 NA Acknowledgment: Cisco, David Taylor (WHSTL)

  30. Almost 60% of the unique ranges have length less then 20 Approx. 40% of the total number of ranges have length less then 20 Range-length distribution

  31. A small number of ranges cause most expansion

  32. Range expansion bounds The worst-case expansion ratio of SRGE on w-bit words is 2w-4 The worst-case expansion ratio of any range-covering scheme on w-bit words is at least w, regardless of the encoding scheme

  33. Expansion as function of bits number 2w-2 SRGE worst-case expansion is2W-4entries Number of TCAM entries At leastWentries required – regardless of the encoding technique Unknown 1 w Number of bits used 2^w-1

More Related