minimizing expected lookup times on binary search trees april 29, 2002 pankaj gupta principal...

60
Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor [email protected]. edu [email protected] http://klamath.stanford.edu/~pankaj

Upload: oliver-blair

Post on 31-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

Minimizing Expected Lookup Times on Binary

Search TreesApril 29, 2002

High PerformanceSwitching and RoutingTelecom Center Workshop: Sept 4, 1997.

Pankaj GuptaPrincipal Architect,

Cypress [email protected]

[email protected]://klamath.stanford.edu/~pankaj

Page 2: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

2

Binary Search on Prefix Intervals1

0000 11110010 0100 0110 1000 11101010 1100

P1

P4P3

P5P2

Prefix IntervalP1 /0 0000…

1111

P2 00/2 0000…0011

P3 1/1 1000…1111

P4 1101/4 1101…1101

P5 001/3 0010…0011

1001

1. [Lampson et al., Proc. Infocom, 1998]

I1 I3 I4 I5 I6I2

Page 3: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

3

I1

I3

I2 I4 I5

I6

0111

0011 1101

11000001

>Alphabetic Tree

1/2 1/4

1/8

1/16 1/32

1/32

>

>

>

>

0000 11110010 0100 0110 1000 11101010 1100

P1

P4P3

P5P2

1001

I1 I3 I4 I5 I6I2

Page 4: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

4

0001

Another Alphabetic Tree

I1

I2

I5

I3

I4

I6

0111

0011

1100

1101

1/2

1/4

1/8

1/16

1/32 1/32

Page 5: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

5

0001

Yet Another Alphabetic Tree

I1

I2

I5I3 I4 I6

0111

0011

11001101

1/2

1/4

1/8 1/321/16 1/32

Page 6: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

6

I1

I3

I2 I4 I5

I6

0111

0011 1101

11000001

>Original

Alphabetic Tree

1/2 1/4

1/8

1/16 1/32

1/32

0000 11110010 0100 0110 1000 11101010 1100

P1

P4P3

P5P2

I1 I3 I4 I5 I6I21001

>

>

>

>

Avgtime = 2.85

Maxtime = 3

Page 7: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

7

0001

Optimal Alphabetic Tree

I1

I2

I5

I3

I4

I6

0111

0011

1100

1101

1/2

1/4

1/8

1/16

1/32 1/32

Avgtime = 1.94

Maxtime = 5

Optimal = Minimum average lookup time

Page 8: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

8

0001

I1

I2

I5I3 I4 I6

0111

0011

11001101

1/2

1/4

1/8 1/321/16 1/32

Optimal Depth-constrained Alphabetic

TreeAvgtime = 2

Maxtime = 4

Depth Constraint = 4

Page 9: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

9

Desired Behavior of Algorithm

Maximum Lookup Time

Avera

ge L

ooku

p

Tim

e

logN

logN

Page 10: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

10

Problem Statement

• Depth-constrained Huffman trees• Optimal solutions

Minimize Average Lookup Time = i lipi s.t. li D i

access time to reach leaf i

probability of accessing leaf i

Depth constraint

Related Work:

[Larmore and Przytycka94] O(nDlogn) with large constant factors.

Page 11: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

11

Goal: Near-optimal Depth-constrained

Alphabetic Tree

• Simpler to find than an optimal solution.

• Probabilities are approximate.

Why near-optimal ?

Page 12: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

12

Algorithm MinDPQ

Fact [Yeung91]: Given {pk}, can choose {lk} such that: H(p) C < H(p) + 2

Dlp kD

k 2

But:Depth constraint (D) violated

nkp

nkpl

k

kk 11log

,1log

2

2

iii pppH

imeavgLookupTC

log)(

Page 13: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

13

Algorithm MinDPQ (contd.)

Original distribution {pk}, possibly pmin< 2-D

Transformed distribution {qk}, qmin 2-D

Transform Probabilities

1* s.t. is where2,max*

kkqDkp

kq

can be found in O(nlogn) time and O(n) space

Explicit Solution

22)()(** opt

kkk CpHqpDlpC

Within 2 memory accesses of optimal

Page 14: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

14

Algorithm MinDPQ: Experimental Results

Maximum mem-accesses

Avera

ge m

em

-acc

ess

es

Page 15: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

15

Summary of Algorithm MinDPQ

• A practical algorithm to minimize average lookup time while simultaneously keeping maximum lookup time bounded.

• Provably within two memory accesses of the optimal algorithm.

Page 16: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

16

Lookup: What’s Used Out There?

• Overwhelming majority:– Modifications of multi-bit tries (h/w

optimized trie algorithms)– DRAM (sometimes SRAM) based,

large number of routes (>0.25M)

• Others mostly Ternary-CAM based– Smaller number of routes

Page 17: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

Packet Classification

April 29 and May 1, 2002

High PerformanceSwitching and RoutingTelecom Center Workshop: Sept 4, 1997.

Pankaj GuptaPrincipal Architect,

Cypress [email protected]

[email protected]://klamath.stanford.edu/~pankaj

Page 18: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

18

Packet Classification: Outline

• Motivation• Background and Problem

Definition • Classification Schemes

Page 19: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

19

RFC 1812: Requirements for IPv4 Routers

• Must perform an IP datagram forwarding decision (called forwarding)

• Must send the datagram out the appropriate interface (called switching)

Optionally: a router MAY choose to perform special processing on incoming packets

Page 20: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

20

Background

The Internet Core

IP Core router

IP Edge Router

A

C

R

Traditional Internet provides a “best-effort” service, and treats all packets going to the same destination identically

Page 21: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

21

Motivation: Desire for Additional Services

ISP1

NAP

E1

ISP2

ISP3X

Service ExampleDifferentiated Service

Ensure that traffic from ISP2 is given higher priority over traffic from ISP3.

Packet Filtering

Deny all web traffic from ISP3 at interface X.

Policy-based routing

Ensure that all web traffic from ISP2 is sent via interface Z.

Y

Z

Page 22: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

22

More Value added Services

• Accounting and Billing– Treat all video traffic as highest

priority and perform accounting for this type of traffic

• Committed Access Rate (rate limiting)– Rate limit WWW traffic from

interface#7 to 10Mbps

Page 23: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

23

Special Processing Requires Identification of

Flows• All packets of a flow obey a pre-defined

rule and are processed similarly by the router

• E.g. a flow = (src-IP-address, dst-IP-address), or a flow = (dst-IP-prefix, protocol) etc.

• Router needs to identify the flow of every incoming packet and then perform appropriate special processing

Page 24: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

24

Flow-aware vs Flow-unaware Routers

• Flow-aware router: keeps track of flows and performs similar processing on packets in a flow

• Flow-unaware router (packet-by-packet router): treats each incoming packet individually

Page 25: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

25

Flow-aware Routers Need:

Additional mechanisms to negotiate, set-up, manage and execute on service agreements

capability to distinguish and isolate traffic belonging to different flows based on negotiated service agreements

classification

Rules or policies

Page 26: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

26

Special processing

Control

Datapath:per-packet processing

Routing lookup

Flow-aware Router: Basic Architectural Components

Routing, resource reservation, admission control, SLAs

Packet classification

Switching

Scheduling

Page 27: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

27

Packet Classification: Outline

• Motivation• Background and Problem

Definition • Classification Schemes

Page 28: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

28

Packet Classification Engine

Action

--------

---- ----

--------

Predicate Action

Classifier (policy database)

Packet Classification

Incoming Packet

HEADER

Page 29: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

29

Header Fields used for Classification

L3-SA L2-DAL2-SAL3-DA L3-PROTL4-PROTL4-DPL4-SP

Transport layer header Network layer header MAC header

DA = Destination addressSA = Source addressPROT = ProtocolSP = Source portDP = Destination port

L2 = layer 2 (e.g., Ethernet)L3 = layer 3 (e.g., IP)L4 = layer 4 (e.g., TCP)

Page 30: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

30

Multi-field Packet Classification

Packet Classification: Find the action associated with the highest priority rule matching an incoming packet header.

Field 1 Field 2 … Field k

Action

Rule 1 5.3.40.0/21 2.13.8.11/32

… UDP A1

Rule 2 5.168.3.0/24 152.133.0.0/16

… TCP A2

… … … … … …

Rule N 5.168.0.0/16 152.0.0.0/8 … ANY AN

Example: packet (5.168.3.32, 152.133.171.71, …, TCP)

Page 31: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

31

Formal Problem Definition

Given a classifier C with N rules, Rj, 1 j N, where Rj consists of three entities:

1) A regular expression Rj[i], 1 i d, on each of the d header fields,

2) A number, pri(Rj), indicating the priority of the rule in the classifier, and

3) An action, referred to as action(Rj).

For an incoming packet P with the header considered as a d-tuple of points (P1, P2, …, Pd), the d-dimensional packet classification problem is to find the rule Rm with the highest priority among all the rules Rj matching the d-tuple; i.e., pri(Rm) > pri(Rj), j m, 1 j N, such that Pi matches Rj[i], 1 i d. We call rule Rm the best matching rule for packet P.

Page 32: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

32

Routing Lookup: Instance of 1D Classification

• One-dimension (destination address)

• Forwarding table classifier• Routing table entry rule• Outgoing interface action• Prefix-length priority

Page 33: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

33

Example 4D Classifier

Rule

L3-DA L3-SA L4-DP L4-PROT

Action

R1 152.163.190.69/255.255.255.255

152.163.80.11/255.255.255.255

* * Deny

R2 152.168.3/255.255.255

152.163.200.157/255.255.255.255

eq www udp Deny

R3 152.168.3/255.255.255

152.163.200.157/255.255.255.255

range 20-21

udp Permit

R4 152.168.3/255.255.255

152.163.200.157/255.255.255.255

eq www tcp Deny

R5 * * * * Deny

Page 34: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

34

Example Classification Results

Pkt Hdr

L3-DA L3-SA L4-DP L4-PROT

Rule, Action

P1 152.163.190.69 152.163.80.11 www tcp R1, Deny

P2 152.168.3.21 152.163.200.157

www udp R2, Deny

Page 35: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

35

R5

Geometric Interpretation

R4

R3

R2R1

R7

Dimension 1

Dim

ensi

on 2

R6

e.g. (128.16.46.23, *)e.g. (144.24/24, 64/16)

P2 P1

Packet classification problem: Find the highest priority rectangle containing an incoming point

Page 36: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

36

Packet Classification: Outline

• Motivation• Background and Problem

Definition • Classification Schemes

Page 37: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

37

Metrics for Classification Algorithms

• Speed• Storage requirements• Ability to handle large classifiers• Flexibility in implementation• Low preprocessing time• Update time • Scalability in the number of header fields• Flexibility in rule specification

Page 38: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

38

Size of Classifier?

• Microflow recognition: 128K-1M flows in a metro/edge router

• Firewall applications, <2K• Wildcarded filters, 16-128K • Depends heavily on the type of

router

Page 39: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

39

Linear Search

• Keep rules in a linked list• O(N) storage, O(N) lookup time,

O(1) update complexity

Page 40: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

40

Lookups/Classification with Ternary CAM

Memory array Priority

encoder

Action Memory

P32

P31

P8

PacketHeader

Action

TCAM RAM

01

2

3

M

0

1

0

0

1

1.23.11.3, tcp

1.23.x.x, x

Page 41: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

41

Ternary CAMs

Advantages

Suitable for multiple fieldsFast: 10-16 ns (66-100 Mpps)Simple to understand

Disadvantages

Inflexible: range-to-prefix blowupDensity: largest available in 2001 was 8Mb, i.e., 64K x 128 (can be cascaded)Power: 8-12W @ 100MHzTough soft-error problemCost: $100-$150 for 8Mb

Page 42: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

42

Rule Range Maximal Prefixes

R5 [3,11] 0011, 01**, 10**

R4 [2,7] 001*, 01**

R3 [4,11] 01**, 10**

R2 [4,7] 01**

R1 [1,15] 0001, 001*, 01**, 10**, 110*, 1110

Range-to-prefix Blowup

Rule Range

R1 [3,11]

R2 [2,7]

R3 [4,11]

R4 [4,7]

R5 [1,14]

Maximum memory blowup = factor of (2W-2)d

Page 43: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

43

Radix Trie (Recap)

P1 111* H1

P2 10* H2

P3 1010*

H3

P4 10101

H4

P2

P3

P4

P1

A

B

C

G

D

F

H

E

1

0

0

1 1

1

1

Lookup 10111

Add P5=1110*

I

0

P5

next-hop-ptr (if prefix)

left-ptr right-ptr

Trie node

Page 44: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

44

Example Classifier

Rule Destination Address

Source Address

R1 0* 10*

R2 0* 01*

R3 0* 1*

R4 00* 1*

R5 00* 11*

R6 10* 1*

R7 * 00*

Page 45: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

45

Hierarchical Tries

Dimension DA

Dimension SAR5 R2 R1

R3R6

R7

R4

O(NW) memoryO(W2) lookup

Rule

DA SA

R1 0* 10*

R2 0* 01*

R3 0* 1*

R4 00* 1*

R5 00* 11*

R6 10* 1*

R7 * 00*

Search (000,010)

Page 46: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

46

Set-pruning Tries [Tsuchiya, Sri98]

Dimension DA

Rule

DA SA

R1 0* 10*

R2 0* 01*

R3 0* 1*

R4 00* 1*

R5 00* 11*

R6 10* 1*

R7 * 00*

R7 Dimension SAR2 R1 R5 R7 R2 R1

R3

R7

R6

R7

R4

O(N2) memoryO(2W) lookup

Search (000,010)

Page 47: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

47

Grid-of-Tries [Sri98]

Dimension DA

Dimension SAR5 R2 R1

R3R6

R7

R4

O(NW) memoryO(2W) lookup

Rule

DA SA

R1 0* 10*

R2 0* 01*

R3 0* 1*

R4 00* 1*

R5 00* 11*

R6 10* 1*

R7 * 00*

Search (000,010)

Page 48: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

48

Grid-of-Tries

Advantages

Good solution for two dimensions

Disadvantages

Static solutionNot easily extensible to more than two dimensions

20K 2D rules: 2MB, 9 memory accesses (with expansion)

Page 49: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

49

Bitmap-intersection [Lak98]

R4 R3 R2R11

1

0

0

1

0

1

1

R3

R4

R1

R2

P1

Page 50: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

50

Bitmap-intersection

Advantages

Good solution for multiple dimensions, for small classifiers

Disadvantages

Static solutionLarge memory bandwidth (scales linearly in N)Large amount of memory (scales quadratically in N)Hardware-optimized

512 rules: 1Mpps with single FPGA (33MHz) and five 1Mb SRAM chips

Page 51: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

51

Crossproducting [Sri98]

R4 R3R2

R1

54

3

2

1

6

21 7 8 94 5 63

P1

(1,3)

(8,4)

Page 52: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

52

Crossproducting

Advantages

Fast accessesSuitable for multiple fields

Disadvantages

Large amount of memoryNeed caching for bigger classifiers (> 50 rules)

50 rules: 1.5MB, need caching (on-demand crossproducting) for bigger classifiers

Need: d 1-D lookups + 1 memory access, O(Nd) space

Page 53: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

53

Classification Algorithms: Speed vs

Storage Tradeoff

O(log N) time with O(Nd) storage, orO(logd-1N) time with O(N) storage

Point Location: Lower bounds for N regions in d dimensions.

N = 100, d = 4, Nd = 100 MBytes and logd-1N = 350 memory accesses

Page 54: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

54

Classification Tradeoff in Hardware

Switches/Routers• Power consumption of

classification subsystem• Cost• Speed• Density (Storage)

Page 55: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

55

Algorithms so far: Summary

• Good for two fields, but do not scale to more than two fields, OR

• Good for very small classifiers (< 50 rules) only, OR

• Have non-deterministic classification time, OR

• Either too slow or consume too much storage

Page 56: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

56

One Solution: Heuristics that “seem to work well

in real-life”• Recursive Flow Classification [Gupta,

McKeown 1999]• Hierarchical Intelligent Cuttings [Gupta,

McKeown 1999]• Aggregated Bit-vector [Baboescu,

Varghese 2001]• Good heuristics do better than worst-

case bounds for real-life datasets.

Page 57: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

57

Properties of real-life classifier datasets

• Hierarchy (to at least some level)• Structure

Page 58: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

58

Classification: What’s Used Out There?

• Majority: Ternary CAMs– High performance, cost, power,

determinstic worst-case

• Some others: Modifications of RFC– Low speed, low cost DRAM-based,

heuristic

• Some others: nothing/linear search etc.

Page 59: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

59

Packet Classification: References

• [Lak98] T.V. Lakshman. D. Stiliadis. “High speed policy based packet forwarding using efficient multi-dimensional range matching”, Sigcomm 1998, pp 191-202

• [Sri98] V. Srinivasan, S. Suri, G. Varghese and M. Waldvogel. “Fast and scalable layer 4 switching”, Sigcomm 1998, pp 203-214

• V. Srinivasan, G. Varghese, S. Suri. “Fast packet classification using tuple space search”, Sigcomm 1999, pp 135-146

• P. Gupta, N. McKeown, “Packet classification using hierarchical intelligent cuttings,” Hot Interconnects VII, 1999

• [Gupta99] P. Gupta, N. McKeown, “Packet classification on multiple fields,” Sigcomm 1999, pp 147-160

Page 60: Minimizing Expected Lookup Times on Binary Search Trees April 29, 2002 Pankaj Gupta Principal Architect, Cypress Semiconductor pankaj@cs.stanford.edu pcg@cypress.com

60

Packet Classification: References (contd.)

• M. M. Buddhikot, S. Suri, and M. Waldvogel, “Space decomposition techniques for fast layer-4 switching,” Protocols for High Speed Networks, vol. 66, no. 6, pp 277-83, 1999

• A. Feldmann and S. Muthukrishnan, “Tradeoffs for packet classification,” Proc. Infocom 2000

• T. Woo, “A modular approach to packet classification: algorithms and results, “ Proc. Infocom 2000

• S. Iyer, R.R. Kompella, and A. Shelat, “ClassiPI: An architecture for fast and flexible packet classification,” IEEE Network, March/April 2001, vol. 15, no. 2, pp 33-41

• P. Gupta and N. McKeown, “Algorithms for packet classification,” IEEE Network, March/April 2001, vol. 15, no. 2, pp 24-32

• F. Baboescu and G. Varghese, “Scalable packet classification,” Proc. Sigcomm 2001