JP2020119363A - Retrieval device and method for creating hash table - Google Patents
Retrieval device and method for creating hash table Download PDFInfo
- Publication number
- JP2020119363A JP2020119363A JP2019011155A JP2019011155A JP2020119363A JP 2020119363 A JP2020119363 A JP 2020119363A JP 2019011155 A JP2019011155 A JP 2019011155A JP 2019011155 A JP2019011155 A JP 2019011155A JP 2020119363 A JP2020119363 A JP 2020119363A
- Authority
- JP
- Japan
- Prior art keywords
- hash
- data
- hash table
- divided data
- tree
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、検索装置、および、ハッシュテーブルの作成方法に関する。 The present invention relates to a search device and a hash table creation method.
従来、パケットの転送等において、どのパケットにどのruleを適用するかの検索にハッシュ法が用いられていた。このハッシュ法は高速な検索を実現する技術である。 Conventionally, in packet transfer and the like, a hash method has been used to search which rule applies to which packet. This hash method is a technology that realizes high-speed search.
ここで、ハッシュ法の原空間が大きい場合、メモリ等のリソース上の問題から、ハッシュ空間の縮尺度を高めなければならず、その縮尺度に応じてハッシュ衝突のリスクが生じる。 Here, when the original space of the hash method is large, the reduction scale of the hash space has to be increased due to a resource problem such as memory, and there is a risk of hash collision depending on the reduction scale.
例えば、検索に用いられるハッシュ空間をNbitとし、ハッシュ関数として恒等関数(y=x)を使用し、64bitマシンを用いる場合、ハッシュテーブルには、2N×64(bit)のメモリリソースが必要である。ここで、ハッシュテーブルのメモリリソースを16GByte以内に抑えたい場合、ハッシュ空間は31bit以下である必要がある。よって、ハッシュ法の原空間が64bitの場合、縮尺度が1/(233)のハッシュ関数を選択しなければならない。その結果、登録対象のrule(データ)の数が10億以下であれば、すべてのデータが同じハッシュ値にマッピングされる場合もあり、その場合、すべての登録データを線形検索しなければならない。例えば、非特許文献1に記載の技術においても、ハッシュ空間を縮尺するため、複数のデータが1つのハッシュ値にマッピングされ、固定化されず、再度検索する必要が出てくる。
For example, when the hash space used for search is Nbit, the identity function (y=x) is used as the hash function, and a 64-bit machine is used, the hash table requires 2 N × 64 (bit) memory resources. Is. Here, in order to suppress the memory resource of the hash table within 16 GByte, the hash space must be 31 bits or less. Therefore, when the original space of the hash method is 64 bits, a hash function with a reduction scale of 1/(2 33 ) must be selected. As a result, if the number of rules (data) to be registered is 1 billion or less, all the data may be mapped to the same hash value. In that case, all registered data must be linearly searched. For example, even in the technique described in
そこで、本発明は、前記した問題を解決し、ハッシュ法の原空間が大きい場合であってもハッシュ衝突の発生を低減することを課題とする。 Therefore, an object of the present invention is to solve the above-mentioned problems and reduce the occurrence of hash collision even when the original space of the hash method is large.
前記した課題を解決するため、本発明は、テーブルへの登録対象のデータ群の入力を受け付ける入力部と、入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する分割部と、前記データ群の登録時に、前記所定のbit数のハッシュ値とポインタとしてNULLとを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおいて前記分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、前記ハッシュテーブルそれぞれをノードとするツリーを構築することにより、前記ハッシュテーブルそれぞれの使用メモリの総量を低減し、前記ハッシュテーブルにおけるハッシュ衝突を低減するテーブル作成部と、を備えることを特徴とする。 In order to solve the above-mentioned problems, the present invention provides an input unit that receives an input of a data group to be registered in a table, and divided data of a predetermined number of bits by dividing each input data group into a plurality of sections. And a dividing unit that generates a hash table that associates the hash value of the predetermined number of bits with NULL as a pointer when registering the data group, and corresponds to the hash value of the divided data in the created hash table. By updating the pointer attached from NULL to a pointer to the hash table of the divided data following the divided data in the original data of the divided data, and constructing a tree with each of the hash tables as a node, the hash A table creating unit that reduces the total amount of memory used for each table and reduces hash collisions in the hash table.
本発明によれば、ハッシュ法の原空間が大きい場合であってもハッシュ衝突の発生を低減することができる。 According to the present invention, it is possible to reduce the occurrence of hash collision even when the original space of the hash method is large.
以下、図面を参照しながら、本発明を実施するための形態(実施形態)を第1の実施形態から第4の実施形態に分けて説明する。本発明は、各実施形態に限定されない。 Hereinafter, modes (embodiments) for carrying out the present invention will be described separately from the first embodiment to the fourth embodiment with reference to the drawings. The present invention is not limited to each embodiment.
[第1の実施形態]
[ハッシュテーブルのツリーの例]
まず、図1を用いて、第1の実施形態におけるハッシュテーブルのツリーの構築例を説明する。ここではデータの検索に用いられるハッシュ空間(原空間)が64bitである場合を例に説明する。本実施形態の検索装置は、例えば、検索に用いられる64bitのハッシュ空間を4つに分割し、16bitのハッシュ空間を示すハッシュテーブルをノードとするツリーを構築する。
[First Embodiment]
[Example of tree of hash table]
First, an example of building a tree of a hash table according to the first embodiment will be described with reference to FIG. Here, a case where the hash space (original space) used for data search is 64 bits will be described as an example. The search device according to the present embodiment divides a 64-bit hash space used for search into four, and constructs a tree having a hash table indicating a 16-bit hash space as a node.
この検索装置は、ハッシュテーブルへの登録対象のデータ(以下、適宜「rule」と称す)群の入力を受け付けると、登録に必要なハッシュテーブルを新規に作成する。ここでは、ハッシュテーブルに用いるハッシュ関数として、恒等関数(y=x)を用いる場合を例に説明する。 When this search device receives an input of a group of data to be registered (hereinafter appropriately referred to as “rule”) in the hash table, it newly creates a hash table necessary for registration. Here, a case where an identity function (y=x) is used as the hash function used in the hash table will be described as an example.
また、本実施形態におけるハッシュテーブルは、ハッシュ値とポインタとを対応付けたテーブルである。なお、図1に示すハッシュテーブル104,106,109,110のハッシュ値には、bool(false/true)が対応付けられているが、ポインタを対応付けてもよい。 Further, the hash table in this embodiment is a table in which hash values and pointers are associated with each other. Note that bool (false/true) is associated with the hash values of the hash tables 104, 106, 109, and 110 shown in FIG. 1, but a pointer may be associated therewith.
例えば、検索装置が、図1に示す(1)〜(4)のデータを4つの区間(区間111〜114)に分割し、分割されたデータ(分割データ)を16bitのハッシュテーブル101〜110に登録する。具体的には、検索装置は、ハッシュテーブル101において(1)〜(4)のデータに登場する分割データ(=ハッシュ値)に対応するポインタを「NULL」から「NP(ネクストポインタ)」に更新する。そして、このNPに対応するハッシュテーブル(例えば、ハッシュテーブル102)のハッシュ値のうち、上記の分割データに続く分割データに対応するポインタを「NULL」から「NP」に更新する。
For example, the search device divides the data (1) to (4) shown in FIG. 1 into four sections (
例えば、検索装置は、ハッシュテーブル101を作成し、このハッシュテーブル101における分割データ「200」および「300」のポインタを「NULL」から「NP」に更新する。次に、検索装置は、ハッシュテーブル102を作成すると、このハッシュテーブル102において、上記の分割データ「200」に続く分割データ「300」および「600」のポインタを「NULL」から「NP」に更新する。検索装置は、上記の処理を(1)〜(4)のデータそれぞれについて実行することにより、(1)〜(4)のデータをハッシュテーブル101〜110に登録する。その結果、ハッシュテーブル101〜110をノードとし、ノード同士がNPにより接続されたハッシュテーブルのツリーが構築される。 For example, the search device creates the hash table 101 and updates the pointers of the divided data “200” and “300” in the hash table 101 from “NULL” to “NP”. Next, when the search device creates the hash table 102, the pointers of the divided data “300” and “600” following the divided data “200” in the hash table 102 are updated from “NULL” to “NP”. To do. The search device registers the data (1) to (4) in the hash tables 101 to 110 by executing the above-described processing for each of the data (1) to (4). As a result, a hash table tree in which the hash tables 101 to 110 are used as nodes and the nodes are connected by NPs is constructed.
検索装置が、上記のハッシュテーブルのツリーを構築した後、例えば、(1)のデータの検索要求を受け付けた場合、図1に示すハッシュテーブルのツリーを辿ることにより、(1)のデータを検索する。検索の結果、(1)のデータを発見すると、検索装置はtrueを返し、(1)のデータを発見できなかった場合、検索装置はfalseを返す。 After the search device constructs the above-mentioned hash table tree, for example, when a search request for the data of (1) is received, the search of the data of (1) is performed by tracing the tree of the hash table shown in FIG. To do. As a result of the search, when the data of (1) is found, the search device returns true, and when the data of (1) cannot be found, the search device returns false.
上記のように、検索装置は、例えば、検索対象となるハッシュ空間を分割し、分割したハッシュ空間を示すハッシュテーブルのツリーを構築する。また、検索装置は、データの登録時に必要なハッシュテーブルを作成する。その結果、検索対象となるハッシュ空間が比較的大きい場合であっても、ハッシュテーブルの使用メモリ量を大幅に低減することができる。これにより、検索装置は、ハッシュテーブルに用いるハッシュ値を縮尺しないでよい、あるいは、ハッシュ値を縮尺する場合であっても縮尺度を小さくすることができるので、ハッシュ衝突の発生を低減することができる。また、例えば、検索装置において、各ハッシュテーブルに使用することができるメモリ量の総量(つまり、rule登録に使用することができるメモリ量の総量)が所定値(例えば、16GByte)以内に限られている場合であっても、使用メモリ量を上記の所定値以内に収めることができる。 As described above, the search device divides the hash space to be searched, for example, and constructs a tree of a hash table indicating the divided hash space. Further, the search device creates a hash table required when registering the data. As a result, even when the hash space to be searched is relatively large, the amount of memory used in the hash table can be significantly reduced. With this, the search device does not have to scale the hash value used in the hash table, or the scale can be reduced even when the hash value is scaled, so that the occurrence of hash collision can be reduced. it can. Further, for example, in the search device, the total amount of memory that can be used for each hash table (that is, the total amount of memory that can be used for rule registration) is limited to within a predetermined value (for example, 16 GBytes). Even if there is, the used memory amount can be kept within the above-mentioned predetermined value.
[構成]
次に、図2を用いて第1の実施形態の検索装置10の構成例を説明する。検索装置10は、入力部11、制御部12、記憶部13、出力部14を備える。
[Constitution]
Next, a configuration example of the
入力部11および出力部14は、例えば、検索装置10の備える入出力インタフェースにより、実現される。制御部12は、例えば、検索装置10の備えるCPUによるプログラム実行処理により実現される。記憶部13は、例えば、検索装置10の備えるメインメモリおよびハードディスク装置により実現される。
The input unit 11 and the output unit 14 are realized by, for example, an input/output interface included in the
入力部11は、各種データの入力を受け付ける。例えば、入力部11は、ハッシュテーブルへの登録対象となるデータ群の入力を受け付ける。制御部12は、検索装置10全体の制御を司り、例えば、分割部121と、テーブル作成部122と、検索部123とを備える。破線で示す分割制御部124および指示部125は装備される場合と装備されない場合とがあり、装備される場合については、後記する。
The input unit 11 receives input of various data. For example, the input unit 11 receives an input of a data group to be registered in the hash table. The control unit 12 controls the
分割部121は、入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する。 The dividing unit 121 generates divided data having a predetermined number of bits by dividing each input data group into a plurality of sections.
テーブル作成部122は、登録対象のデータの登録先となるハッシュテーブルを作成し、作成したハッシュテーブルにデータを登録する。具体的には、テーブル作成部122は、上記の所定のbit数のハッシュ値とポインタとを対応付けたハッシュテーブルを作成する。そして、テーブル作成部122は、作成したハッシュテーブルに、分割部121により生成された分割データを登録する。例えば、テーブル作成部122は、作成したハッシュテーブルにおいて、当該分割データのハッシュ値に対応付けられるポインタを、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタ(上記のNP)に更新する。テーブル作成部122は、このような処理を、登録対象となるデータの末尾の区間の分割データまで繰り返す。これにより、検索対象となるハッシュテーブルがポインタ(上記のNP)により接続された、ハッシュテーブルのツリーが構築される。
The
検索部123は、テーブル作成部122により作成されたハッシュテーブルのツリーを用いて、検索対象のデータを検索し、出力部14経由で検索結果を出力する。
The search unit 123 searches the search target data using the tree of the hash table created by the
記憶部13は、制御部12が動作するために必要な各種データを記憶する。例えば、記憶部13は、ハッシュ空間の分割数等を記憶する。この分割数は、例えば、入力部11からの指示入力に基づき適宜変更可能である。また、記憶部13は、テーブル作成部122により作成されたハッシュテーブルを記憶する。
The storage unit 13 stores various data necessary for the control unit 12 to operate. For example, the storage unit 13 stores the number of divisions of the hash space and the like. The number of divisions can be appropriately changed based on an instruction input from the input unit 11, for example. The storage unit 13 also stores the hash table created by the
出力部14は、制御部12による処理結果を出力する。例えば、出力部14は、検索部123による検索結果を出力する。 The output unit 14 outputs the processing result of the control unit 12. For example, the output unit 14 outputs the search result by the search unit 123.
このような検索装置10によれば、例えば、64bitのハッシュ空間を4分割し、10000ruleを登録した場合でも、メモリ使用量は最大で15.7GByte程度である。つまり、上記の場合、ハッシュテーブルの数は最大で1+10000+10000+10000=30001であるので、メモリ使用量を、30001(テーブル数)×65536(1テーブルあたりのindex数)×8Byte(1indexあたりの容量)≒15.7GByte以内に収めることができる。
According to such a
このように検索装置10は、登録対象のruleに関するハッシュテーブルのみを新規に作成するので、ハッシュテーブルに必要なメモリ領域を低減できる。その結果、ハッシュ関数として恒等関数(y=x)を用いやすくなる。また、従来技術のようにハッシュ空間を分割せずに上記の10000ruleを登録する場合、ハッシュ空間の縮尺度を高める必要がある。よって、ruleの検索時に最大で10000回のハッシュ衝突が発生するので、検索時間が長くなってしまうおそれがある。一方、検索装置10の場合、ruleの検索時に、(ハッシュ空間の分割数−1)回のNULL判定が発生するものの、ハッシュ空間の縮尺度を高める必要がなくなる。その結果、ハッシュ衝突の発生を低減することができるので、検索時間が長くなることを防止することができる。
In this way, the
[第2の実施形態]
次に、第2の実施形態の検索装置10を説明する。第1の実施形態と同じ構成は同じ符号を付して説明を省略する。
[Second Embodiment]
Next, the
第2の実施形態の検索装置10のテーブル作成部122は、分割部121において、登録対象のrule群それぞれを所定のbit数の区間に区切った分割データを生成した後、区間ごとに、当該区間に属する分割データ群の種類を集計する。そして、テーブル作成部122は、ハッシュテーブルのツリーを構築する際、集計した分割データの種類が少ない区間の分割データのハッシュテーブルほど、ツリーのルート側に配置し、集計した分割データの種類が多い区間の分割データのハッシュテーブルほど、ツリーの末端側に配置する。このようにすることで、検索装置10は、ハッシュテーブルのツリーの使用メモリ量を低減することができる。その結果、検索装置10は、ハッシュテーブルのツリーに登録可能なrule数を増加させることができる。例えば、検索装置10においてrule登録に使用することができるメモリ量の総量が所定値(例えば、16GByte)以内に限られている場合あっても、より多くのruleを登録することができる。
The
例えば、図1の(1)〜(4)に示すruleを4つの区間(区間111,112,113,114)に区切った場合、分割データの種類が最も少ないのは区間111であり(2種類)、2番目に分割データの種類が少ないのは区間112,114であり(3種類)、最も分割データの種類が多いのは区間113である(4種類)。
For example, when the rule shown in (1) to (4) of FIG. 1 is divided into four sections (
よって、テーブル作成部122は、テーブル作成部122は区間111の分割データのハッシュテーブルをツリーのルート側に配置し、区間113の分割データのハッシュテーブルをツリーの末端側に配置し、区間112,114の分割データのハッシュテーブルをツリーのルートと末端との間に配置する。
Therefore, the
また、検索装置10は64bitのデータを4分割した際の区間ごとの分割データの種類数がそれぞれ1、10、1000、50000である10万ruleを登録する場合の使用メモリ量の計算例を、図3を参照しながら説明する。
In addition, the
例えば、分割データの種類数が「50000」の区間における分割データ群のハッシュテーブルをツリーのルート側に配置し、ツリーの末端方向に向かって、種類数の昇順に、種類数が「1000」の区間における分割データのハッシュテーブル→種類数が「10」の区間における分割データのハッシュテーブル→種類数が「1」の区間における分割データのハッシュテーブルという順に配置した場合を考える。この場合、各区間におけるテーブル数の最大値は、図3(a)に示すように1、50000、100000、100000なので、ハッシュテーブルの数の合計は最大で1+50000+100000+100000=250001である。よって、ハッシュテーブルのツリーの使用メモリ量は最大で約131.1GByteで、16GByte以内に収まらない可能性がある。 For example, the hash table of the divided data group in the section where the number of types of divided data is “50000” is arranged on the root side of the tree, and the number of types is “1000” in ascending order of the number of types toward the end of the tree. Consider a case where a hash table of divided data in a section→a hash table of divided data in a section of which the number of types is “10”→a hash table of divided data in a section of which the number of types is “1” are arranged in this order. In this case, the maximum number of tables in each section is 1, 50000, 100000, 100000, as shown in FIG. 3A, so the total number of hash tables is 1+50000+100000+100000=250001 at maximum. is there. Therefore, the maximum memory usage of the tree of the hash table is about 131.1 GByte, which may not be within 16 GByte.
一方、検索装置10のテーブル作成部122は、分割データの種類数が「1」の区間における分割データのハッシュテーブルをツリーのルート側に配置し、ツリーの末端方向に向かって、種類数の昇順に、種類数が「10」の区間における分割データのハッシュテーブル→種類数が「1000」の区間における分割データのハッシュテーブル→種類数が「50000」の区間における分割データのハッシュテーブルという順に配置する。この場合、各区間におけるテーブル数の最大値は、図3(b)に示すように1、1、10、10000なので、ハッシュテーブルの数の合計は最大で1+1+10+10000=10011である。よって、ハッシュテーブルのツリーの使用メモリ量は最大で約5.2GByteで、16GByte以内に収まる。
On the other hand, the
[第3の実施形態]
次に、第3の実施形態の検索装置10を説明する。前記した実施形態と同じ構成は同じ符号を付して説明を省略する。
[Third Embodiment]
Next, the
第1の実施形態で述べたとおり、ハッシュ空間の分割数(例えば、第1の実施形態においては4分割)を増やすほど、ハッシュテーブルのツリーが使用するメモリ領域を節約することができる。そこで、予めハッシュテーブルのツリーが使用する最大メモリ領域(閾値)をコンフィグ等で検索装置10に指定しておき、ハッシュテーブルのツリーが使用するメモリ領域の総量(使用メモリ量)が上記の閾値を超える場合、検索装置10は、上記の分割数を増加させてもよい。
As described in the first embodiment, as the number of divisions of the hash space (for example, four divisions in the first embodiment) is increased, the memory area used by the hash table tree can be saved. Therefore, the maximum memory area (threshold value) used by the tree of the hash table is specified in the
例えば、第3の実施形態において、検索装置10は、破線で示す分割制御部124をさらに備える。分割制御部124は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超える場合、ハッシュ空間の分割数を所定数より増加させる。
For example, in the third embodiment, the
例えば、分割制御部124は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超えると判断した場合、分割部121およびテーブル作成部122の用いる分割数が当初「4」であったところ、「8」に増加させる。例えば、分割制御部124は、分割部121に登録対象のruleそれぞれを8bitずつに分割した分割データを生成するよう指示し、また、テーブル作成部122に8bitのハッシュ値とポインタとを対応付けたハッシュテーブルを作成するよう指示する。
For example, when the
これにより検索装置10は、例えば、登録対象のrule数が多い場合でも、ハッシュテーブルのツリーの使用メモリの総量を所定の閾値以内に収めることができる。その結果、例えば、検索装置10においてrule登録に使用することができるメモリ量の総量が所定の閾値(例えば、16GByte)以内に限られている場合において、登録対象のrule数が増加したときでも、これに対応することができる。
With this, the
例えば、rule登録に使用することができるメモリ量の総量が16GByte以内に限られている場合において、検索装置10が、10万ruleをハッシュテーブルのツリーに登録するときを考える。この場合、検索装置10が、ハッシュ空間の分割数を「4」とすると、例えば、図4(a)に示すように、ハッシュテーブルのテーブル数は最大で1+65536+100000+100000=265537である。よって、ハッシュテーブルのツリーに使用メモリ量は、最大で約139.2GByteで、16GByte以内に収まらず、その結果、検索装置10は、登録対象のruleを登録できない可能性がある。
For example, consider a case in which the
一方、第3の実施形態の検索装置10のように、ハッシュ空間の分割数を「8」とする(つまり、8bitずつに分割する)と、例えば、図4(b)に示すように、ハッシュテーブルのテーブル数は最大で1+256+65536+100000+…+100000=565793である。よって、ハッシュテーブルのツリーの使用メモリ量は、最大でも約1.2GByteで、16GByte以内に収めることができる。その結果、検索装置10は、登録対象のruleを登録することができる。
On the other hand, if the number of divisions of the hash space is set to “8” (that is, divided into 8 bits each) as in the
[第4の実施形態]
次に、第4の実施形態の検索装置10を説明する。前記した実施形態と同じ構成は同じ符号を付して説明を省略する。
[Fourth Embodiment]
Next, the
前記したとおり検索装置10は、ハッシュ関数の縮尺度を高めることによっても、ハッシュテーブルのツリーが使用するメモリ領域を節約することができる。そこで、予めハッシュテーブルのツリーが使用する最大メモリ領域(閾値)をコンフィグ等で検索装置10に指定しておき、ハッシュテーブルのツリーの使用メモリの総量が上記の閾値を超える場合、検索装置10は、ハッシュ関数の縮尺度を高めるようにしてもよい。
As described above, the
ここで、ハッシュ関数の縮尺度を高めるとは、例えば、検索装置10がハッシュ関数にmod N(Nは自然数)を用いていた場合、Nの値を今まで使っていた値よりも小さくする。あるいは、検索装置10がもともとハッシュ関数に恒等関数を用いていた場合、ハッシュ関数にmod N(Nは自然数)を用いるようにすることである。この場合の実施形態を第4の実施形態として説明する。
Here, to increase the reduction scale of the hash function means, for example, when the
例えば、第3の実施形態の項で述べたとおり、検索装置10が10万ruleを登録する場合において、ハッシュ関数として恒等関数を用いると、ハッシュテーブルのツリーの使用メモリの総量は16GByteを超える可能性がある。しかし、検索装置10が、例えば、ハッシュ関数としてy=x mod 8192(縮尺 1/8)を用いることで、10万ruleを登録する場合でも、ハッシュテーブルのツリーの使用メモリ量は、最大で約13.6GByteで、に抑えることができる。このことを、図5を用いて説明する。
For example, as described in the section of the third embodiment, when the
例えば、図5に示すように、検索装置10が64bitのハッシュ区間を4分割し、10万ruleを登録する場合において、各ハッシュテーブルに用いるハッシュ関数としてmod 8192(縮尺 1/8)を適用したとき、ハッシュテーブルのテーブル数は最大で1+8192+100000+100000=208193となる。よって、ハッシュテーブルのツリーの使用メモリ量は、最大で約13.6GByteで、16GByte以内に収まる。
For example, as shown in FIG. 5, when the
[その他の実施形態]
なお、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超える場合、ハッシュ空間の分割数を増加させる(第3の実施形態参照)か、ハッシュテーブルに用いられるハッシュ関数の縮尺度を高める(第4の実施形態参照)かを、検索装置10の利用者が設定してもよい。
[Other Embodiments]
Note that the
この場合、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超える場合、ハッシュ空間の分割数を増加させるか、ハッシュ関数の縮尺度を高めるかを示す設定情報を入力部11経由で受け付けると、当該設定情報を記憶部13に格納しておく。そして、検索装置10の指示部125(図1参照)は、ハッシュテーブルのツリーの使用メモリの総量が所定値を超える場合、記憶部13に記憶された設定情報に従い、分割制御部124に分割数を所定値よりも増加させる指示、または、テーブル作成部122に、ハッシュテーブルに用いられるハッシュ関数の縮尺度を所定値よりも高める指示を行う。
In this case, when the total amount of used memory of the tree of the hash table exceeds a predetermined threshold, the
このようにすることで、ハッシュテーブルのツリーの使用メモリの総量が所定値を超える場合、検索装置10がハッシュ空間の分割数を増加させる(第3の実施形態参照)方式を採るか、各ハッシュテーブルに用いられるハッシュ関数の縮尺度を高める(第4の実施形態参照)方式を採るかを検索装置10の利用者が指定することができる。
By doing so, when the total amount of used memory in the tree of the hash table exceeds a predetermined value, the
なお、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量に応じて、ハッシュ空間の分割数、および、各ハッシュテーブルに用いられるハッシュ関数の縮尺度を決定してもよい。例えば、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量が大きいほど(つまり、登録rule数が多いほど)、ハッシュ空間の分割数を増加させ、あるいは、各ハッシュテーブルに用いられるハッシュ関数の縮尺度を高くしてもよい。
The
[プログラム]
また、上記の実施形態で述べた検索装置10の機能を実現するプログラムを所望の情報処理装置(コンピュータ)にインストールすることによって実装できる。例えば、パッケージソフトウェアやオンラインソフトウェアとして提供される上記のプログラムを情報処理装置に実行させることにより、情報処理装置を検索装置10として機能させることができる。ここで言う情報処理装置には、デスクトップ型またはノート型のパーソナルコンピュータ、ラック搭載型のサーバコンピュータ等が含まれる。また、その他にも、情報処理装置にはスマートフォン、携帯電話機やPHS(Personal Handyphone System)等の移動体通信端末、さらには、PDA(Personal Digital Assistant)等がその範疇に含まれる。また、検索装置10を、クラウドサーバに実装してもよい。
[program]
Further, it can be implemented by installing a program that realizes the function of the
図6を用いて、上記のプログラムを実行するコンピュータの一例を説明する。図6に示すように、コンピュータ1000は、例えば、メモリ1010と、CPU1020と、ハードディスクドライブインタフェース1030と、ディスクドライブインタフェース1040と、シリアルポートインタフェース1050と、ビデオアダプタ1060と、ネットワークインタフェース1070とを有する。これらの各部は、バス1080によって接続される。
An example of a computer that executes the above program will be described with reference to FIG. As shown in FIG. 6, the
メモリ1010は、ROM(Read Only Memory)1011およびRAM(Random Access Memory)1012を含む。ROM1011は、例えば、BIOS(Basic Input Output System)等のブートプログラムを記憶する。ハードディスクドライブインタフェース1030は、ハードディスクドライブ1090に接続される。ディスクドライブインタフェース1040は、ディスクドライブ1100に接続される。ディスクドライブ1100には、例えば、磁気ディスクや光ディスク等の着脱可能な記憶媒体が挿入される。シリアルポートインタフェース1050には、例えば、マウス1110およびキーボード1120が接続される。ビデオアダプタ1060には、例えば、ディスプレイ1130が接続される。
The
ここで、図6に示すように、ハードディスクドライブ1090は、例えば、OS1091、アプリケーションプログラム1092、プログラムモジュール1093およびプログラムデータ1094を記憶する。前記した実施形態で説明した各種データや情報は、例えばハードディスクドライブ1090やメモリ1010に記憶される。
Here, as shown in FIG. 6, the hard disk drive 1090 stores, for example, an
そして、CPU1020が、ハードディスクドライブ1090に記憶されたプログラムモジュール1093やプログラムデータ1094を必要に応じてRAM1012に読み出して、上述した各手順を実行する。
Then, the
なお、上記のプログラムに係るプログラムモジュール1093やプログラムデータ1094は、ハードディスクドライブ1090に記憶される場合に限られず、例えば、着脱可能な記憶媒体に記憶されて、ディスクドライブ1100等を介してCPU1020によって読み出されてもよい。あるいは、上記のプログラムに係るプログラムモジュール1093やプログラムデータ1094は、LANやWAN(Wide Area Network)等のネットワークを介して接続された他のコンピュータに記憶され、ネットワークインタフェース1070を介してCPU1020によって読み出されてもよい。
The
10 検索装置
11 入力部
12 制御部
13 記憶部
121 分割部
122 テーブル作成部
123 検索部
124 分割制御部
125 指示部
10 search device 11 input unit 12 control unit 13 storage unit 121
Claims (7)
入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する分割部と、
前記データ群の登録時に、前記所定のbit数のハッシュ値とポインタとしてNULLとを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおける前記分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、前記ハッシュテーブルそれぞれをノードとするツリーを構築することにより、前記ハッシュテーブルそれぞれの使用メモリの総量を低減し、前記ハッシュテーブルにおけるハッシュ衝突を低減するテーブル作成部と、
を備えることを特徴とする検索装置。 An input unit that receives the input of the data group to be registered in the table,
A division unit that generates division data of a predetermined number of bits by dividing each input data group into a plurality of sections,
When registering the data group, create a hash table that associates the hash value of the predetermined bit number with NULL as a pointer, and from the NULL pointer that is associated with the hash value of the divided data in the created hash table, The total amount of used memory of each of the hash tables is constructed by updating the pointers to the hash tables of the divided data following the divided data in the original data of the divided data and constructing a tree with each of the hash tables as a node. And a table creation unit that reduces hash collisions in the hash table,
A search device comprising:
前記区間ごとに、当該区間に属する前記分割データの種類を集計し、前記集計した分割データの種類が少ない区間の分割データのハッシュテーブルほど、前記ツリーのルート側に配置し、前記集計した分割データの種類が多い区間の分割データのハッシュテーブルほど、前記ツリーの末端側に配置した前記ツリーを構築することにより、登録可能なデータの数を増加させる
ことを特徴とする請求項1に記載の検索装置。 The table creation unit,
For each section, the types of the divided data belonging to the section are aggregated, and the hash table of the divided data of the section having the smaller types of the aggregated divided data is arranged on the root side of the tree, and the aggregated divided data is arranged. 2. The search according to claim 1, wherein the number of data that can be registered is increased by constructing the tree arranged on the end side of the tree for a hash table of divided data in a section having a large number of types. apparatus.
前記ハッシュテーブルに用いられるハッシュ関数として恒等関数を用いることにより、前記ハッシュテーブルにおけるハッシュ衝突を発生させない
ことを特徴とする請求項1に記載の検索装置。 The table creation unit,
The search apparatus according to claim 1, wherein a hash collision is not generated in the hash table by using an identity function as a hash function used in the hash table.
ことを特徴とする請求項1に記載の検索装置。 The search device according to claim 1, further comprising a division control unit that increases the number of the divided sections above a predetermined value when the total amount of used memory of the tree exceeds a predetermined value.
前記ツリーの使用メモリの総量が所定値を超える場合、前記ハッシュテーブルに用いられるハッシュ関数の縮尺度を所定値よりも高める
ことを特徴とする請求項1に記載の検索装置。 The table creation unit,
The search device according to claim 1, wherein when the total amount of memory used by the tree exceeds a predetermined value, the reduction scale of the hash function used in the hash table is increased above a predetermined value.
ことを特徴とする請求項4に記載の検索装置。 When the total amount of memory used by the tree exceeds a predetermined value, an instruction to the division control unit to increase the number of the division sections above a predetermined value according to the setting information stored in the storage unit, or the table creation unit The search device according to claim 4, further comprising an instruction unit that issues an instruction to increase a reduction scale of a hash function used in the hash table above a predetermined value.
テーブルへの登録対象のデータ群の入力を受け付けるステップと、
入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成するステップと、
前記データ群の登録時に、前記所定のbit数のハッシュ値とポインタとしてNULLとを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおける前記分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、前記ハッシュテーブルそれぞれをノードとするツリーを構築することにより、前記ハッシュテーブルそれぞれの使用メモリの総量を低減し、前記ハッシュテーブルにおけるハッシュ衝突を低減するステップと、
を含むことを特徴とするハッシュテーブルの作成方法。 A method for creating a hash table executed by a search device, comprising:
A step of receiving the input of the data group to be registered in the table,
Generating divided data with a predetermined number of bits by dividing each input data group into a plurality of sections,
When registering the data group, create a hash table that associates the hash value of the predetermined bit number with NULL as a pointer, and from the NULL pointer that is associated with the hash value of the divided data in the created hash table, The total amount of used memory of each of the hash tables is constructed by updating the pointers to the hash tables of the divided data following the divided data in the original data of the divided data and constructing a tree with each of the hash tables as a node. To reduce hash collisions in the hash table,
A method of creating a hash table characterized by including.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019011155A JP2020119363A (en) | 2019-01-25 | 2019-01-25 | Retrieval device and method for creating hash table |
PCT/JP2020/000617 WO2020153154A1 (en) | 2019-01-25 | 2020-01-10 | Retrieval device and hash table creation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019011155A JP2020119363A (en) | 2019-01-25 | 2019-01-25 | Retrieval device and method for creating hash table |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2020119363A true JP2020119363A (en) | 2020-08-06 |
Family
ID=71736954
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019011155A Pending JP2020119363A (en) | 2019-01-25 | 2019-01-25 | Retrieval device and method for creating hash table |
Country Status (2)
Country | Link |
---|---|
JP (1) | JP2020119363A (en) |
WO (1) | WO2020153154A1 (en) |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB9811574D0 (en) * | 1998-05-30 | 1998-07-29 | Ibm | Indexed file system and a method and a mechanism for accessing data records from such a system |
WO2006094366A1 (en) * | 2005-03-11 | 2006-09-14 | Rocksoft Limited | Method for indexing in a reduced-redundancy storage system |
JP2017091432A (en) * | 2015-11-17 | 2017-05-25 | 日本電信電話株式会社 | Dictionary search method and device |
-
2019
- 2019-01-25 JP JP2019011155A patent/JP2020119363A/en active Pending
-
2020
- 2020-01-10 WO PCT/JP2020/000617 patent/WO2020153154A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
WO2020153154A1 (en) | 2020-07-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10592531B2 (en) | Efficient partitioning of relational data | |
US10169348B2 (en) | Using a file path to determine file locality for applications | |
JP2020531949A (en) | Lazy update of database hash code in blockchain | |
US11169804B2 (en) | Method for vectorizing d-heaps using horizontal aggregation SIMD instructions | |
CN110737663A (en) | data storage method, device, equipment and storage medium | |
US9485309B2 (en) | Optimal fair distribution among buckets of different capacities | |
CN114416310A (en) | Multiprocessor load balancing method, computing device and storage medium | |
US10601711B1 (en) | Lens table | |
US11651221B2 (en) | Method, device, and computer program product for deep learning | |
CN109302449B (en) | Data writing method, data reading device and server | |
CN111737228B (en) | Database and table dividing method and device | |
WO2020153154A1 (en) | Retrieval device and hash table creation method | |
US11379232B2 (en) | Method for generic vectorized d-heaps | |
CN111163060B (en) | Application group-based forwarding method, device and system | |
JP6189266B2 (en) | Data processing apparatus, data processing method, and data processing program | |
JP2018132900A (en) | Storage method, storage device and storage program | |
US10511531B1 (en) | Enhanced lens distribution | |
CN107729577B (en) | Data searching method based on multidimensional hash table, terminal equipment and storage medium | |
US10355994B1 (en) | Lens distribution | |
US10795873B1 (en) | Hash output manipulation | |
US10146791B2 (en) | Open file rebalance | |
CN108694205B (en) | Method and device for matching target field | |
US11435926B2 (en) | Method, device, and computer program product for managing storage system | |
CN113468529B (en) | Data searching method and device | |
CN112711588A (en) | Multi-table connection method and device |