JP3754043B2 - Data retrieval device - Google Patents
Data retrieval device Download PDFInfo
- Publication number
- JP3754043B2 JP3754043B2 JP2003346529A JP2003346529A JP3754043B2 JP 3754043 B2 JP3754043 B2 JP 3754043B2 JP 2003346529 A JP2003346529 A JP 2003346529A JP 2003346529 A JP2003346529 A JP 2003346529A JP 3754043 B2 JP3754043 B2 JP 3754043B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- stage
- memory
- search
- node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Description
本発明は、2分探索による検索データを格納する記憶装置の構成方法に関する。 The present invention relates to a method for configuring a storage device that stores search data obtained by binary search.
従来は、IPルータなどのパケット転送装置においては、パケットヘッダに搭載された宛先アドレスを元にルーティングテーブルを検索し、次ホップルータを決定している。ルーティングテーブルには宛先アドレスと次ホップルータの関係とを保持している。 Conventionally, in a packet transfer device such as an IP router, a routing table is searched based on a destination address mounted in a packet header to determine a next hop router. The routing table holds the relationship between the destination address and the next hop router.
このようなパケット転送装置では、入力されたパケットの宛先アドレスから2分探索のツリーを用いて次ホップルータを決定するという検索方法が広く用いられている。ツリーのノード上には宛先アドレスの境界値と次ホップルータを表す値とが格納されている。ツリーの検索はツリーのルート(頂点)から行い、各ノードではパケットの宛先アドレスとノードに格納されている境界値の大小の比較を行う。大小の比較によって次のノードへ順々に移っていく。ツリーの検索が終了した時点でパケットの宛先アドレスがどの範囲に入っているかを調査することで検索の回答結果となる次ホップルータが決定できる。 In such a packet transfer apparatus, a search method of determining a next hop router from a destination address of an input packet by using a binary search tree is widely used. A boundary value of the destination address and a value indicating the next hop router are stored on the node of the tree. The tree search is performed from the root (vertex) of the tree, and each node compares the destination address of the packet with the boundary value stored in the node. It moves to the next node in order by comparing the size. By investigating which range the destination address of the packet is in when the tree search is completed, the next hop router that is the result of the search can be determined.
具体的な検索方法について図5を用いて説明する。検索すべきパケットの宛先アドレスが1.2.3.20の場合、まずツリーのルート(root:頂点)のノードで境界値と比較をする。この場合は、
1.2.3.20<1.2.3.26
なので次ノードとして左下のノードへ移る。このノードでも境界値と比較する。
1.2.3.20>1.2.3.0
なので、今度は右下のノードへ移る。ここでも同様に比較を行うと
1.2.3.20<1.2.3.25
であり、ここで検索を終了する。
A specific search method will be described with reference to FIG. When the destination address of the packet to be searched is 1.2.3.20, the node is first compared with the boundary value at the root (root) node of the tree. in this case,
1.2.3.20 <1.2.3.26
So move to the lower left node as the next node. This node also compares with the boundary value.
1.2.3.20> 1.2.3.0
So this time, move to the lower right node. If the comparison is made in the same manner here, 1.2.3.20 <1.2.3.25
And the search ends here.
パケットの宛先アドレスが含まれる範囲は、
1.2.3.0(NH=B)<1.2.3.20<1.2.3.25(NH=C)
となることがわかり、1.2.3.20の次ホップルータはBとなる。
The range that includes the destination address of the packet is
1.2.3.0 (NH = B) <1.2.3.20 <1.2.3.25 (NH = C)
And the next hop router at 1.2.3.20 is B.
ここで、注意すべきことは、ノードの境界値は「その境界値以上の場合、宛先アドレスの次ホップルータを表す値がそのノードが格納している次ホップルータを表す値となる」ということである。すなわち
1.2.3.0(NH=B)≦X<1.2.3.25(NH=C)
の場合、Xの次ホップルータはCではなくBである。したがって、「以上」で前ノードから1.2.3.25(NH=C)のノードに到着した場合、1.2.3.25以外の値が宛先IPアドレスであれば前ノード(ここでは1.2.3.0(NH=B))に格納されている次ホップルータを表す値が解となる。
Here, it should be noted that the boundary value of a node is "If the boundary value is greater than or equal to the boundary value, the value representing the next hop router of the destination address is the value representing the next hop router stored by that node". It is. That is, 1.2.3.0 (NH = B) ≦ X <1.2.3.25 (NH = C)
In this case, the next hop router of X is B instead of C. Therefore, when the node arrives at the node of 1.2.2.3.25 (NH = C) from the previous node with “above”, if the value other than 1.2.3.25 is the destination IP address, the previous node (here The value representing the next hop router stored in 1.2.3.0 (NH = B) is the solution.
図6に具体的な検索例をもう1つ示す。今度はパケットの宛先アドレスが1.2.3.30の場合である。図5と同様に検索を行うと、
1.2.3.26(NH=B)<1.2.3.30<1.2.4.0(NH=A)
となることが分かり、パケットの宛先アドレス1.2.30の次ホップルータはBとなる。宛先アドレスが含まれる範囲を見つけるので、「未満」で前ノードから到着した場合には、1.2.4.0以外の値が宛先IPアドレスであれば、前々ノードに格納されている次ホップルータを表す値が解となる(例えば特許文献1または2参照)。
FIG. 6 shows another specific search example. This time is the case where the destination address of the packet is 1.2.3.30. When searching as in FIG.
1.2.3.26 (NH = B) <1.2.3.30 <1.2.4.0 (NH = A)
And the next hop router of the packet destination address 1.2.30 is B. Since the range including the destination address is found, if it arrives from the previous node with “less than”, if the value other than 1.2.4.0 is the destination IP address, the next stored in the previous node A value representing a hop router is a solution (see, for example,
従来、2分探索木を格納するデータ格納部は、図4のようなメモリ構成をとっていた。この構成の場合、メモリ量は最小となるが、データ更新を行う場合、データを追加する場合、データを削除する場合、共に2分探索のデータが大幅に変更されてしまう。例えば、追加または削除の場合には、いずれかのメモリに追加または削除を行う度に、全てのメモリ内容を1つずつずらして更新する必要がある。 Conventionally, a data storage unit for storing a binary search tree has a memory configuration as shown in FIG. In this configuration, the amount of memory is minimized, but when performing data update, adding data, or deleting data, the binary search data is significantly changed. For example, in the case of addition or deletion, every time addition or deletion is made to any memory, it is necessary to update all the memory contents by shifting one by one.
本発明は、このような背景に行われたものであって、2分探索木構造を格納するデータ格納部におけるメモリ更新を簡単かつ短時間に行うことができるデータ検索装置を提供することを目的とする。 The present invention has been made in such a background, and it is an object of the present invention to provide a data search apparatus that can easily and quickly update a memory in a data storage unit that stores a binary search tree structure. And
本発明は、登録されたデータからキーワードに適合するデータを選び出すデータ検索装置であって、2分探索木構造を有するデータ格納部を備え、当該データ格納部の総データ量が2n個であるとき、それぞれ2m個のメモリからなる複数個の一定サイズのメモリブロックを備え、前記木構造の段数をkとするときに、
これにより、データ追加に備えた空きメモリを用意しておくことができるため、2分木探索構造におけるメモリ更新を簡単かつ短時間に行うことができる。 As a result, it is possible to prepare an empty memory for data addition, so that the memory update in the binary tree search structure can be performed easily and in a short time.
また、それぞれ1段目からk段目までのデータを格納したメモリブロックをk個持つこともできる。これによれば、メモリ量は多くなるが、各検索段毎に並列にメモリにアクセスできるため、トータルの検索時間を短くすることができる。あるいは、データ更新に際し、デュプリケートしてデータを持っているため、1つのデータを更新している間にも、検索を行うことができる。 It is also possible to have k memory blocks each storing data from the first stage to the kth stage. According to this, although the amount of memory increases, since the memory can be accessed in parallel for each search stage, the total search time can be shortened. Alternatively, since the data is duplicated when the data is updated, the search can be performed while one data is being updated.
本発明により、データ更新を行う際に、メモリのブロック化により、メモリブロック内のデータ更新、メモリブロック間のデータ更新と、更新手順を分けることが可能となり、ブロック内のデータ更新の場合には、更新対象メモリブロック内だけの更新であり、対象外のメモリブロックには影響がなく、更新時間を短くすることができる。また、ブロック間のデータ更新に関しても、複数の対象ブロックだけにしか影響がなく、更新が容易となる。 According to the present invention, when updating data, it is possible to separate the update procedure from the data update in the memory block and the data update between the memory blocks by making the memory into blocks. The update is performed only within the update target memory block, and there is no influence on the non-target memory block, and the update time can be shortened. In addition, the data update between blocks affects only a plurality of target blocks and can be easily updated.
(実施例1)
図1は、登録されたデータからキーワードに適合するデータを選び出すデータ検索装置の構造である。データ格納部(記憶装置)1と、データ検索論理部2と、データ更新部3とからなる。データ格納部1は、キーワードと検索対象データを格納したメモリ(記憶装置)であり、データ検索論理部2は、2分探索を行う演算部である。データ更新部3は、検索データを更新するための機能である。
Example 1
FIG. 1 shows the structure of a data search apparatus that selects data that matches a keyword from registered data. A data storage unit (storage device) 1, a data
図4は、2分探索木を格納する従来のデータ格納部の構造である。2分探索法は、検索段数iに必要なデータ量が2i-1のオーダーである。そのため、段数によって必要なメモリ量が大きくなってしまう。 FIG. 4 shows the structure of a conventional data storage unit that stores a binary search tree. In the binary search method, the amount of data necessary for the number of search stages i is on the order of 2 i−1 . For this reason, the amount of memory required increases depending on the number of stages.
図2は第一の実施例を示した図であり、メモリブロックサイズを16と32にした2例を示している。従来のデータ格納部と本実施例のデータ格納部1とのメモリ構成の比較のため、対応関係を示す丸付き数字を付した。メモリブロックサイズが16の場合でも32の場合でも、どちらの構成も空きメモリは1であり、メモリを効率よく実装している。このように、本発明に従ったメモリ構成を用いることにより、空きメモリを小さくすることが可能である。
FIG. 2 is a diagram showing the first embodiment, and shows two examples in which the memory block size is 16 and 32. In FIG. In order to compare the memory configuration of the conventional data storage unit and the
すなわち、データ格納部1の総データ量は、2分探索木構造が6段であることから、25=32個である。このとき、それぞれ24=16個のメモリからなる複数個の一定サイズのメモリブロックを備え、2分探索木構造の段数を6とするときに、
また、他の例として、データ格納部1の総データ量は、2分探索木構造が6段であることから、25=32個である。このとき、それぞれ25=32個のメモリからなる複数個の一定サイズのメモリブロックを備え、2分探索木構造の段数を6とするときに、
[数2]
が32以下となるkを求めると、k=5である。したがって、1段目から5段目までのデータを同一メモリブロックに格納し、6段目からは、6段目以上の各段のメモリを複数個のメモリブロックにそれぞれ分散して格納する(請求項1)。
As another example, the total amount of data in the
[Equation 2]
When k is calculated such that is 32 or less, k = 5. Therefore, the data from the first stage to the fifth stage are stored in the same memory block, and from the sixth stage, the memory of each stage of the sixth stage or more is distributed and stored in a plurality of memory blocks (claim). Item 1).
これにより、どちらの構成も空きメモリは1であり、メモリを効率よく実装している。本発明に従ったメモリ構成を用いることにより、空きメモリを小さくすることが可能である。 As a result, the free memory is 1 in both configurations, and the memory is efficiently mounted. By using the memory configuration according to the present invention, it is possible to reduce the free memory.
(実施例2)
図3は第二の実施例である。第二実施例では、それぞれ1段目からk段目までのデータを格納したメモリブロックをk個持つ(請求項2)。すなわち、第一の実施例で、1つのメモリブロックに収められたデータを検索段毎に同じデータを持たせた構成になっている。この方法は、1.メモリ量は多くなるが、各検索段毎に並列にメモリにアクセスできるため、トータルの検索時間を短くする効果が得られる。2.データ更新に際し、デュプリケートしてデータを持っているため、1つのデータを更新している間にも、検索を行うことができる。
(Example 2)
FIG. 3 shows a second embodiment. The second embodiment has k memory blocks each storing data from the first stage to the kth stage (claim 2). That is, in the first embodiment, the data stored in one memory block has the same data for each search stage. This method is: Although the amount of memory increases, since the memory can be accessed in parallel for each search stage, the effect of shortening the total search time can be obtained. 2. When data is updated, the data is duplicated, so that the search can be performed while one data is being updated.
本発明により、データの更新時間を短くすることができる。また、ブロック間のデータ更新に関しても、複数の対象ブロックだけにしか影響がなく、更新が容易となる。これにより、大規模な2分探索木を用いたデータ検索装置を構成した場合に、データ更新を簡単化することができるため、ユーザの利便性を向上させることができる。 According to the present invention, the data update time can be shortened. In addition, the data update between blocks affects only a plurality of target blocks and can be easily updated. As a result, when a data search apparatus using a large binary search tree is configured, data updating can be simplified, and user convenience can be improved.
1 データ格納部
2 データ検索論理部
3 データ更新部
1
Claims (2)
2分探索木構造を有するデータ格納部を備え、
当該データ格納部の総データ量が2n個であるとき、
それぞれ2m個のメモリからなる複数個の一定サイズのメモリブロックを備え、
前記木構造の段数をkとするときに、
ことを特徴とするデータ検索装置。 In a data search device that selects data that matches a keyword from registered data,
A data storage unit having a binary search tree structure;
When the total amount of data in the data storage is 2 n
A plurality of memory blocks of a certain size, each consisting of 2 m memories,
When the number of steps of the tree structure is k,
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003346529A JP3754043B2 (en) | 2003-10-06 | 2003-10-06 | Data retrieval device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003346529A JP3754043B2 (en) | 2003-10-06 | 2003-10-06 | Data retrieval device |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2005117212A JP2005117212A (en) | 2005-04-28 |
JP3754043B2 true JP3754043B2 (en) | 2006-03-08 |
Family
ID=34539420
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003346529A Expired - Fee Related JP3754043B2 (en) | 2003-10-06 | 2003-10-06 | Data retrieval device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3754043B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2933462B1 (en) * | 2008-07-04 | 2010-07-30 | Inst Francais Du Petrole | METHOD FOR CONTROLLING THE CLOSURE PHASE OF A CLUTCH OF A ROBOTIC AUTOMOTIVE TRANSMISSION SYSTEM |
-
2003
- 2003-10-06 JP JP2003346529A patent/JP3754043B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2005117212A (en) | 2005-04-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8295286B2 (en) | Apparatus and method using hashing for efficiently implementing an IP lookup solution in hardware | |
US7418505B2 (en) | IP address lookup using either a hashing table or multiple hash functions | |
EP1808987B1 (en) | Longest prefix matching using tree bitmap data structures | |
US9672234B2 (en) | Database and database processing methods | |
US7774538B2 (en) | Method for ternary contents address memory table management | |
JP3485262B2 (en) | Method and means for classifying data packets | |
KR100586461B1 (en) | Method, Hardware Architecture and Recording Medium for Searching IP Address by Using Pipeline Binary Tree | |
CN107431660B (en) | Search device, search method, and recording medium | |
US20100293327A1 (en) | TCAM Management Approach That Minimize Movements | |
Le et al. | Scalable tree-based architectures for IPv4/v6 lookup using prefix partitioning | |
KR101434065B1 (en) | Method and device for improving scalabilty of longest prefix match | |
WO2009135417A1 (en) | The longest prefix match mehtod and device based on tree data structure | |
CN108134739B (en) | Route searching method and device based on index trie | |
US10771386B2 (en) | IP routing search | |
US8180958B2 (en) | Key selection device and process for content-addressable memory | |
US20170142013A1 (en) | Search apparatus, search configuration method, and search method | |
US20040019737A1 (en) | Multiple-RAM CAM device and method therefor | |
US7478109B1 (en) | Identification of a longest matching prefix based on a search of intervals corresponding to the prefixes | |
WO2014047863A1 (en) | Generating a shape graph for a routing table | |
US20040044868A1 (en) | Method and apparatus for high-speed longest prefix match of keys in a memory | |
JP3691018B2 (en) | Longest match search circuit and method, program, and recording medium | |
CN107798117B (en) | Data storage and reading method and device | |
JP3754043B2 (en) | Data retrieval device | |
TW550497B (en) | Storage efficient minimization logic | |
KR101587756B1 (en) | Apparatus and method for searching string data using bloom filter pre-searching |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20051207 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20051213 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20051214 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091222 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101222 Year of fee payment: 5 |
|
LAPS | Cancellation because of no payment of annual fees |