JP3754043B2 - Data retrieval device - Google Patents

Data retrieval device Download PDF

Info

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
Application number
JP2003346529A
Other languages
Japanese (ja)
Other versions
JP2005117212A (en
Inventor
勝 片山
公平 塩本
直明 山中
雅則 宇賀
研也 高島
靖明 中西
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2003346529A priority Critical patent/JP3754043B2/en
Publication of JP2005117212A publication Critical patent/JP2005117212A/en
Application granted granted Critical
Publication of JP3754043B2 publication Critical patent/JP3754043B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

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, Patent Document 1 or 2).

特開2000−332786号公報JP 2000-332786 A 特開2000−358064号公報JP 2000-358064 A

従来、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とするときに、

Figure 0003754043
である場合には、1段目からk段目までのデータを同一メモリブロックに格納し、k+1段目からは、k+1段目以上の各段のメモリを複数個のメモリブロックにそれぞれ分散して格納する手段を備えたことを特徴とする。 The present invention is a data search device that selects data that matches a keyword from registered data, and includes a data storage unit having a binary search tree structure, and the total data amount of the data storage unit is 2 n. When there are a plurality of memory blocks of a certain size each consisting of 2 m memories, and the number of stages of the tree structure is k,
Figure 0003754043
In this case, the data from the first stage to the kth stage are stored in the same memory block, and from the k + 1 stage, the memories of each stage of the (k + 1) th stage and higher are distributed to a plurality of memory blocks. A means for storing is provided.

これにより、データ追加に備えた空きメモリを用意しておくことができるため、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 search logic unit 2, and a data update unit 3 are included. The data storage unit 1 is a memory (storage device) that stores keywords and search target data, and the data search logic unit 2 is a calculation unit that performs a binary search. The data update unit 3 is a function for updating search 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 data storage unit 1 of the present embodiment, a circled number indicating the correspondence is given. Regardless of whether the memory block size is 16 or 32, the free memory is 1 in both configurations, and the memory is efficiently mounted. As described above, by using the memory configuration according to the present invention, the free memory can be reduced.

すなわち、データ格納部1の総データ量は、2分探索木構造が6段であることから、25=32個である。このとき、それぞれ2=16個のメモリからなる複数個の一定サイズのメモリブロックを備え、2分探索木構造の段数を6とするときに、

Figure 0003754043
が16以下となるkを求めると、k=4である。したがって、1段目から3段目までのデータを同一メモリブロックに格納し、4段目からは、4段目以上の各段のメモリを複数個のメモリブロックにそれぞれ分散して格納する(請求項1)。 That is, the total amount of data in the data storage unit 1 is 2 5 = 32 because the binary search tree structure has 6 stages. At this time, when a plurality of fixed-size memory blocks each having 2 4 = 16 memories are provided and the number of stages of the binary search tree structure is 6,
Figure 0003754043
When k is calculated such that is 16 or less, k = 4. Therefore, the data from the first stage to the third stage are stored in the same memory block, and from the fourth stage, the memory of each stage of the fourth stage or more is distributed and stored in a plurality of memory blocks (claims). Item 1).

また、他の例として、データ格納部1の総データ量は、2分探索木構造が6段であることから、25=32個である。このとき、それぞれ2=32個のメモリからなる複数個の一定サイズのメモリブロックを備え、2分探索木構造の段数を6とするときに、
[数2]
が32以下となるkを求めると、k=5である。したがって、1段目から5段目までのデータを同一メモリブロックに格納し、6段目からは、6段目以上の各段のメモリを複数個のメモリブロックにそれぞれ分散して格納する(請求項1)。
As another example, the total amount of data in the data storage unit 1 is 2 5 = 32 because the binary search tree structure has six stages. At this time, when a plurality of fixed-size memory blocks each having 2 5 = 32 memories are provided and the number of stages of the binary search tree structure is 6,
[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.

本実施形態のデータ検索装置の構成図。The block diagram of the data search device of this embodiment. 第一実施形態のデータ格納部の構成図。The block diagram of the data storage part of 1st embodiment. 第二実施形態のデータ格納部の構成図。The block diagram of the data storage part of 2nd embodiment. 2分探索木を格納する従来のデータ格納部の構成図。The block diagram of the conventional data storage part which stores a binary search tree. 2分探索手順を説明するための図。The figure for demonstrating a binary search procedure. 2分探索手順を説明するための図。The figure for demonstrating a binary search procedure.

符号の説明Explanation of symbols

1 データ格納部
2 データ検索論理部
3 データ更新部
1 Data storage unit 2 Data search logic unit 3 Data update unit

Claims (2)

登録されたデータからキーワードに適合するデータを選び出すデータ検索装置において、
2分探索木構造を有するデータ格納部を備え、
当該データ格納部の総データ量が2n個であるとき、
それぞれ2m個のメモリからなる複数個の一定サイズのメモリブロックを備え、
前記木構造の段数をkとするときに、
Figure 0003754043
である場合には、1段目からk段目までのデータを同一メモリブロックに格納し、k+1段目からは、k+1段目以上の各段のメモリを複数個のメモリブロックにそれぞれ分散して格納する手段を備えた
ことを特徴とするデータ検索装置。
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,
Figure 0003754043
In this case, the data from the first stage to the kth stage are stored in the same memory block, and from the k + 1 stage, the memories of each stage of the (k + 1) th stage and higher are distributed to a plurality of memory blocks. A data search device comprising means for storing.
それぞれ1段目からk段目までのデータを格納したメモリブロックをk個持つ請求項1記載のデータ検索装置。   2. The data search apparatus according to claim 1, comprising k memory blocks each storing data from the first stage to the k-th stage.
JP2003346529A 2003-10-06 2003-10-06 Data retrieval device Expired - Fee Related JP3754043B2 (en)

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)

* Cited by examiner, † Cited by third party
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

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