After writing two essays, it was out of hand ... To Beijing on business, go before two articles! (Written on 2015/03/21 night, the next day to Beijing)
When I described the packet classification dimension tree structure, I used a large number of two tree structures, which meant that I had to turn left and right, and where to turn, the comparison was unavoidable. I need to exempt the comparison operation, how is this possible? Of course it is possible to change the space time. Also, the space footprint cannot be too large to benefit the cache utilization. So I thought of the index, which is similar to the MMU page table. Inevitably, I once again encountered the problem of spatial complexity ...
Interval/rule to bitmap
If the interval can be directly indexed, then the interval can be represented by an array, and then the rules covered by the interval can be a bitmap, for the 16bit domain, the direct index is not 2^16 index entries, each index entry points to an index, that is, the interval array subscript. The entire structure is as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/9A/wKiom1UNXAnD1rc_AAKy0VsGmAc344.jpg "title=" R4-1.jpg "alt=" Wkiom1unxand1rc_aaky0vsgmac344.jpg "/>
This is almost an internal implementation of the dimension tree parallel pattern, and is particularly well-suited for hardware implementations, which are simple enough to rule.
So intuitive that there is no need to explain anything! But how is this structure built? The construction of bitmaps is very simple, needless to say, the key is the construction of the index table, it is not difficult, according to the interval segmentation of a 65,535 of the table items are populated, just like building page catalogs, page table. It is worth explaining, however, that each matching field here is only 16bit, and if there is more, the memory will go crazy! For example, how to match 32bit IP address! This is indeed a problem.
Matching of 32-bit IP addresses
This is the problem I have been thinking about, and in recent days, I found a solution! That's because I found the index/bitmap matching structure above.
Although this structure can only match 16bit of the domain greater than 16bit will cause a huge memory footprint ...), but it contains a lot of ideas. The most important thing is how the data is compressed by the third table, that is, data sharing, which seems to be the domain of the database, but the idea is universal. If this problem is solved, I can almost design a new structure of the IPV4 routing lookup table. I really designed it, but this is the content of the next article.
A high performance datagram matching structure based on index and bitmap construction