Survey and Proposal on Binary Search Algorithms for Longest Prefix Match Author: Hyesook Lim, Member, IEEE, and Nara Lee, Student Member, IEEE Publisher: IEEE COMMUNICATIONS SURVEYS & TUTORIALS Presenter: Yu Hao, Tzeng Date: 2012/10/03 1
Outline Introdution Trie-based Algorithms Algorithms Performing Binary Search on Prefix Values Algorithms Performing Binary Search on Prefix Lengths Performance Conclusion 2
Introdution Describe various IP address lookup algorithms and compare the characteristics. Use a consistent example set to describe the data structure and the search procedure of each algorithm Evaluate each algorithm in terms of the minimum, worst-case, and average-case number of memory accesses, as well as memory requirements 3
Trie-based Algorithms Binary Trie (B-Trie) Path-Compressed Trie (PC-Trie) Priority Trie (P-Trie) 4
Trie-based Algorithms (Cont.) Binary Trie (B-Trie) Path-Compressed Trie (PC-Trie) Priority Trie (P-Trie) 5
Trie-based Algorithms (Cont.) Binary Trie (B-Trie) No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* P P0 P2 P5 P4 P3 P6 6
Trie-based Algorithms (Cont.) Binary Trie (B-Trie) No.Prefix validLeft pointRight pointOutput port P2 31--P P P P P P3 P P0 P2 P5 P4 P3 P6 7
Trie-based Algorithms (Cont.) Binary Trie (B-Trie) Example Input : Path : 0 -> 2 -> 5 -> 7 -> 9 -> 11 -> NULL Best matching prefix (BMP) : P2 -> P4 P P0 P2 P5 P4 P3 P6 8
Trie-based Algorithms (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High 9
Trie-based Algorithms (Cont.) Binary Trie (B-Trie) Path-Compressed Trie (PC-Trie) Priority Trie (P-Trie) 10
Trie-based Algorithms (Cont.) Path-Compressed Trie (PC-Trie) Use skip values to remove single-child empty internal nodes Remove a child pointer by converting the sub-trie of each node into a full trie P P0 P2 P5 P4 P3 P6 P P0 P2 P5P4 P3 P6 Skip 1 11
Trie-based Algorithms (Cont.) Path-Compressed Trie (PC-Trie) P P0 P2 P5P4 P3 P6 Skip 1 No. Prefix valid Skip value StringLength Next Point Output port 000* * *15P *2-P *3-P * *49P *311P *6-P *5-P6 12
Trie-based Algorithms (Cont.) Path-Compressed Trie (PC-Trie) References [7] P P0 P2 P5 P4 P3 P P0 4 P1 7 P3 8 P6 2 P2 6 P5 5 P No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* 13
Trie-based Algorithms (Cont.) Path-Compressed Trie (PC-Trie) References [7] P0 4 P1 7 P3 8 P6 2 P2 6 P5 5 P No. Prefix valid Bit number String Left point Right point Output port 001* * *56P *--P *--P *7-P *-8P *--P *--P6 14
Trie-based Algorithms (Cont.) Path-Compressed Trie (PC-Trie) References [7] Example Input : Path : 0 -> 2 -> 5 -> 7 BMP : P2 -> P P0 4 P1 7 P3 8 P6 2 P2 6 P5 5 P No. Prefix valid Bit number String Left point Right point Output port 001* * *56P *--P *--P *7-P *-8P *--P *--P6 15
Trie-based Algorithms (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low 16
Trie-based Algorithms (Cont.) Binary Trie (B-Trie) Path-Compressed Trie (PC-Trie) Priority Trie (P-Trie) 17
Trie-based Algorithms (Cont.) Priority Trie (P-Trie) relocate the longest prefix belonging to the sub-trie of each empty internal node into the empty node to remove empty internal nodes in the binary trie P P0 P2 P5 P4 P3 P P0 P2 P5 P3 P1 P6 P4 18
Trie-based Algorithms (Cont.) Priority Trie (P-Trie) P0 P2 P5 P3 P1 P6 P4 No. Priority / Ordinary PrefixLengthLeft pointRight point Output port *612P *33-P1 201*1-4P2 3000*2--P *556P *4--P *3--P5 19
Trie-based Algorithms (Cont.) Priority Trie (P-Trie) Example Input : Path : 0 -> 2 -> 4 -> 5 BMP : P2 -> P P0 P2 P5 P3 P1 P6 P4 No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* 20
Trie-based Algorithms (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low 21
Algorithms Performing Binary Search on Prefix Values Binary Search on Range (BSR) Binary Search Tree (BST) Weighted Binary Search Tree (WBST) Binary Search Tree with Prefix Vector (BST-PV) Binary Search Tree with Switch Pointer (BST-SP) 22
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) Binary Search Tree (BST) Weighted Binary Search Tree (WBST) Binary Search Tree with Prefix Vector (BST-PV) Binary Search Tree with Switch Pointer (BST-SP) 23
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* 24
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) ValueBMP (equivalence)BMP (greater-than) P P0P P P P P3P P4P P P6- 25
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) Example Input : BMP : P4 ValueBMP (equivalence)BMP (greater-than) P P0P P P P P3P P4P P P6- 26
Algorithms Performing Binary Search on Prefix Values (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low 27
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) Binary Search Tree (BST) Weighted Binary Search Tree (WBST) Binary Search Tree with Prefix Vector (BST-PV) Binary Search Tree with Switch Pointer (BST-SP) 28
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree (BST) P2 P5 P1 P0 P4 P3 P6 No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* 29
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree (BST) P2 P5 P1 P0 P4 P3 P6 No.PrefixLengthLeft pointerRight PointerOutput port 0010*312P1 100*2--P0 21*1-3P *445P *6--P3 5111*3-6P *5--P6 30
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree (BST) Example Input : Path : 0 -> 2 -> 3 -> 4 BMP : P2 -> P P2 P5 P1 P0 P4 P3 P6 No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* 31
Algorithms Performing Binary Search on Prefix Values (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low 32
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) Binary Search Tree (BST) Weighted Binary Search Tree (WBST) Binary Search Tree with Prefix Vector (BST-PV) Binary Search Tree with Switch Pointer (BST-SP) 33
Algorithms Performing Binary Search on Prefix Values (Cont.) Weighted Binary Search Tree (WBST) Define the weight of a prefix, as the number of enclosed prefixes plus 1 PrefixWeight P01 P11 P25 34
Algorithms Performing Binary Search on Prefix Values (Cont.) Weighted Binary Search Tree (WBST) No.PrefixLengthLeft pointerRight PointerOutput port 01*112P2 100*2-3P *445P4 3010*3--P *6--P3 5111*3-6P *5--P6 P P4 P2 P0 P1P3 P6 35
Algorithms Performing Binary Search on Prefix Values (Cont.) Weighted Binary Search Tree (WBST) Example Input : Path : 0 -> 2 -> 4 Output port : P2 -> P4 No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* P P4 P2 P0 P1P3 P6 36
Algorithms Performing Binary Search on Prefix Values (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low 37
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) Binary Search Tree (BST) Weighted Binary Search Tree (WBST) Binary Search Tree with Prefix Vector (BST-PV) Binary Search Tree with Switch Pointer (BST-SP) 38
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Prefix Vector (BST-PV) prefix vectors are constructed for each leaf prefix of the binary trie the leaf prefixes with a prefix vector are sorted in ascending order P P0 P2 P5 P4 P3 P6 PrefixLengthPrefix vector 00*2-P *3--P *6P2--P4-P *5P2-P5-P6- 39
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Prefix Vector (BST-PV) prefix vectors are constructed for each leaf prefix of the binary trie the leaf prefixes with a prefix vector are sorted in ascending order PrefixLengthPrefix vector 00*2-P *3--P *6P2--P4-P *5P2-P5-P6- 40
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Prefix Vector (BST-PV) Example Input : Path : 0 -> 1 BMP : P4 No.Prefix P000* P1010* P21* P * P41101* P5111* P611111*
Algorithms Performing Binary Search on Prefix Values (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low 42
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search on Range (BSR) Binary Search Tree (BST) Weighted Binary Search Tree (WBST) Binary Search Tree with Prefix Vector (BST-PV) Binary Search Tree with Switch Pointer (BST-SP) 43
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Switch Pointer (BST-SP) P P0 P2 P5 P4 P3 P6 No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* P P5 P3 P1 P2 P4P0 44
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Switch Pointer (BST-SP) No.Prefix P000* P1010* P21* P * P41101* P5111* P611111* P P5 P3 P1 P2 P4P0 No.PrefixLength Output port Switch pointer Enclosure length 000*1P *3P1-0 21*1P *6P *4P *3P *5P653 45
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Switch Pointer (BST-SP) Search Best matching prefix (BMP) Best matching length (BML) Current matching enclosure length (CMEL) Switch pointer (SP) 46
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Switch Pointer (BST-SP) Example I Input : Statu #BMPBMLCMELSP 0Wildcard P2144 P P5 P3 P1 P2 P4P0 No.PrefixLength Output port Switch pointer Enclosure length 000*1P *3P1-0 21*1P *6P *4P *3P *5P653 47
Algorithms Performing Binary Search on Prefix Values (Cont.) Binary Search Tree with Switch Pointer (BST-SP) Example II Input : Statu #BMPBMLCMELSP 0Wildcard P5324 P P5 P3 P1 P2 P4P0 No.PrefixLength Output port Switch pointer Enclosure length 000*1P *3P1-0 21*1P *6P *4P *3P *5P653 48
Algorithms Performing Binary Search on Prefix Values (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low BST-SPVery highHighMay or may not be low 49
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) logW-Elevator Algorithm (logW-E) Binary Search on Lengths in Multiple Tries (BSL-MT) 50
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) logW-Elevator Algorithm (logW-E) Binary Search on Lengths in Multiple Tries (BSL-MT) 51
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P Level 3 Prefix / InternalNodeMarkerPrefix / pre-computed BMP 10100P P P5 53
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P Level 1 Prefix / InternalNodeMarkerPrefix / pre-computed BMP P2 54
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P Level 5 Prefix / InternalNodeMarkerPrefix / pre-computed BMP P P6 55
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P Level 2 Prefix / InternalNodeMarkerPrefix / pre-computed BMP 1000P
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P Level 4 Prefix / InternalNodeMarkerPrefix / pre-computed BMP P
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) M P P0 P2 P5 P4 P3 P6 M BMP = P2 M BMP = P Level 6 Prefix / InternalNodeMarkerPrefix / pre-computed BMP P3 58
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) Example Input : Path : 3 -> 5 -> 6 BMP : P2 -> P4 Level 3 Prefix / InternalNodeMarkerPrefix / pre-computed BMP 10100P P P5 Level 5 Prefix / InternalNodeMarkerPrefix / pre-computed BMP P P6 Level 6 Prefix / InternalNodeMarkerPrefix / pre-computed BMP P
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low BST-SPVery highHighMay or may not be low W-BSLVery highVery lowLow 60
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) logW-Elevator Algorithm (logW-E) Binary Search on Lengths in Multiple Tries (BSL-MT) 61
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) 62
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) 63
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) Example Input : Path : 3 -> 5 -> 6 BMP : P4 Level 3 Prefix / InternalNodePrefix 1010P Level 5 Prefix / InternalNodePrefix P P P6 Level 6 Prefix / InternalNodePrefix P P3 64
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low BST-SPVery highHighMay or may not be low W-BSLVery highVery lowLow L-BSLVery highVery lowLow 65
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) logW-Elevator Algorithm (logW-E) Binary Search on Lengths in Multiple Tries (BSL-MT) 66
Algorithms Performing Binary Search on Prefix Lengths (Cont.) logW-Elevator Algorithm (logW-E) This algorithm constructs multiple kth-level tries for k = W/2, W/4, · · ·, 2 required to perform a binary search on levels, in addition to a PATRICIA trie. P P0 P2 P5 P4 P3 P6 67
Algorithms Performing Binary Search on Prefix Lengths (Cont.) logW-Elevator Algorithm (logW-E) Example I Input :
Algorithms Performing Binary Search on Prefix Lengths (Cont.) logW-Elevator Algorithm (logW-E) Example II Input :
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low BST-SPVery highHighMay or may not be low W-BSLVery highVery lowLow L-BSLVery highVery lowLow logW-EHighVery lowLow 70
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Waldvogels Binary Search on Length (W-BSL) Binary Search on Length in a Leaf-Pushed Trie (L-BSL) logW-Elevator Algorithm (logW-E) Binary Search on Lengths in Multiple Tries (BSL-MT) 71
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Binary Search on Lengths in Multiple Tries (BSL-MT) P P0 P2 P5 P4 P3 P6 72
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Binary Search on Lengths in Multiple Tries (BSL-MT) 73
Algorithms Performing Binary Search on Prefix Lengths (Cont.) Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low BST-SPVery highHighMay or may not be low W-BSLVery highVery lowLow L-BSLVery highVery lowLow logW-EHighVery lowLow BSL-MTVery lowLow in average, high in worst caseMay or may not be low 74
Performance 75
Performance (Cont.) 76
Performance (Cont.) 77
Performance (Cont.) 78
Conclusion Algorithms Complexity to provide incremental update Search performance degradation when applied to large routing date Search performance degradation when applied to IPv6 B-TrieVery low High PC-TrieMedium Low P-TrieLow Very low BSRVery highVery low BSTVery highHigh May or may not be low WBSTVery highHighMay or may not be low BST-PVVery highLowVery low BST-SPVery highHighMay or may not be low W-BSLVery highVery lowLow L-BSLVery highVery lowLow logW-EHighVery lowLow BSL-MTVery lowLow in average, high in worst caseMay or may not be low 79