![Page 1: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/1.jpg)
Using Access Probabilities In Address Lookups
Jim Washburn & Katerina Argyraki
EE384Y Class Project
![Page 2: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/2.jpg)
Access probabilities are not uniform
• Lookup table contains set of keys Ki
• Access probabilities Pi
• Access times Ai
• Avg access time Ei = i { AiPi}
Key
Nexthop
Header
iP
![Page 3: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/3.jpg)
Where is accounting info stored?
Key
Count
Nexthop
Header
Key2Count
Nexthop
HeaderKey2
• Per key
• Per nexthop
![Page 4: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/4.jpg)
Lookup table operations
• add(key)• delete(key)• search(key)• compile( )
– When to compile? – What happens to searches while
compiling ? – How long to maintain accounting info?
![Page 5: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/5.jpg)
Approach to the problem
• Amortize the optimization• Incrementally optimize at search
time• Perform optimization step with low
probability per access– keeps cost low!
![Page 6: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/6.jpg)
Base structure: BST on intervals
• Can do prefix matches or exact matches • Allows many different tree configurations
for the same set of keys– can be dynamically reconfigurable
• Permits localized incremental operations– affect just two nodes
![Page 7: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/7.jpg)
BST rotation operation
C
BA
y
x
z
CB
A
x
z
y
right
left
Only nodes x and y are written
![Page 8: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/8.jpg)
Self-adjusting heuristics
• single rotation on every access– too conservative?
• move-to-root on every access– too aggressive?
• move-up on every access– “middle ground” solution– but how many nodes?
![Page 9: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/9.jpg)
Low-cost heuristics
• single rotation with low probability p– decrease the amount of writes
• move-to-root with probability proportional to node depth– favor nodes that are deep down the tree
• move-up with counters– per node counter keeps # of hits– a node is never moved above another
node with higher counter
![Page 10: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/10.jpg)
BST as Markov Chain
• Tree can be in any of its possible configurations, with probabilities given by the stationary distribution.
B
A
A
B
A
B
… A
B
![Page 11: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/11.jpg)
Markov calculations (1)
Optimal
SingleRotatio
n
Move to
Root
Expected Access time
1.3283 1.4643 1.4633
Expected time to
first passage to
optimal
NA 59.9 39.7
Done with 60 randomly selected access distributions, for a 3 node treeProbability of optimization step set to 0.1
![Page 12: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/12.jpg)
Markov Calculations (2)
![Page 13: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/13.jpg)
Simulation results (1)
avg OPT SR MTRSRR
MTRR
MUP
access’s
4.56
10.35
9.38
7.62
5.1 5.87
reads4.56
9.214.82
7.51
4.95 5.7
writes 0 1.134.55
0.11
0.15 0.16
• Scenario 1: 99% hit on 7 rules – .5, .25, .12, .6, .3, .1
• Average performance (the good news):
![Page 14: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/14.jpg)
Simulation results (2)
worstOPT
SRR
MTRR
MUP
access’s
12 57 42 35
reads 12 57 21 31
writes 0 2 21 14
• Scenario 1: 99% hit on 7 rules– .5, .25, .12, .6, .3, .1
• Worst-case performance (the bad news):
![Page 15: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/15.jpg)
Simulation results (3)
avg OPT SRRMTR
RMUP
access’s
6.79
14.93
7.6 7.6
reads6.79
14.75
7.34 7.37
writes 0 0.17 0.26 0.23
• Scenario 2: 60% hit on 12 rules– .13, .09, .06, .05, .04, .03, .02, .01, .01, .
01
• Average performance:
![Page 16: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/16.jpg)
Simulation results (4)
worstOPT
SRR
MTRR
MUP
access’s
10 74 42 29
reads 10 72 22 25
writes 0 2 21 14
• Scenario 2: 60% hit on 12 rules– .13, .09, .06, .05, .04, .03, .02, .01, .01, .
01
• Worst-case performance:
![Page 17: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/17.jpg)
Simulation results (5)
avgOPT
SRRMTR
RMUP
access’s
722.8
59.32 9.61
reads 722.6
58.97 9.3
writes 0 0.2 0.34 0.31
• Scenario 3: uniform distribution– The worst-case for our heuristics!
• Average performance:
![Page 18: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/18.jpg)
Simulation results (6)
worstOPT
SRR
MTRR
MUP
access’s
9 62 40 32
reads 9 61 22 22
writes 0 2 20 16
• Scenario 3: uniform distribution– The worst-case for our heuristics!
• Worst-case performance:
![Page 19: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/19.jpg)
Bounding the tree depth
• Check before moving a node– If move will increase depth beyond max,
don’t do it
• How to check?– Keep extra info per node e.g., node depth– Must not introduce extra accesses for
maintenance!– Impossible with single rotation or move
up
![Page 20: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/20.jpg)
MTRR with bounded worst-case
• Augmented BST– Each node knows
• the depth of its longest branch on the left• the depth of its longest branch on the right
– Rotating a node up, requires updating all its ancestors up to the root
– With move-to-root we do that anyway
![Page 21: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/21.jpg)
Simulation results (1)
avg OPTMTR
RMTR
B
access’s
4.56
5.1 6.47
reads4.56
4.95 6.24
writes 0 0.15 0.23
• Scenario 1: 99% hit on 7 rules – .5, .25, ,12, .6, .3, .1
• Average performance:
![Page 22: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/22.jpg)
Simulation results (2)
worstOPT
MTRR
MTRB
access’s
9 42 40
reads 9 22 20
writes 0 21 20
• Scenario 1: 99% hit on 7 rules – .5, .25, ,12, .6, .3, .1
• Worst-case performance:
![Page 23: Using Access Probabilities In Address Lookups](https://reader036.vdocuments.mx/reader036/viewer/2022062809/5681572e550346895dc4cb22/html5/thumbnails/23.jpg)
Conclusions
• We can optimize without having to maintain per-key accounting state, or periodically recompiling the entire data structure.
• Average access time results comparable to compiled results, which are close to lower bound which is determined by entropy.
• Worst case results not as good, need more heuristics to bound the tree depth