WO2020153154A1 - 検索装置、および、ハッシュテーブルの作成方法 - Google Patents

検索装置、および、ハッシュテーブルの作成方法 Download PDF

Info

Publication number
WO2020153154A1
WO2020153154A1 PCT/JP2020/000617 JP2020000617W WO2020153154A1 WO 2020153154 A1 WO2020153154 A1 WO 2020153154A1 JP 2020000617 W JP2020000617 W JP 2020000617W WO 2020153154 A1 WO2020153154 A1 WO 2020153154A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
hash table
data
divided data
tree
Prior art date
Application number
PCT/JP2020/000617
Other languages
English (en)
French (fr)
Inventor
斉 金子
雅幸 西木
Original Assignee
日本電信電話株式会社
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 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Publication of WO2020153154A1 publication Critical patent/WO2020153154A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures

Definitions

  • the present invention relates to a search device and a hash table creation method.
  • the hash method has been used to search which rule is applied to which packet in packet transfer or the like.
  • This hash method is a technology that realizes high-speed search.
  • the hash space used for search is Nbit
  • a 64-bit machine is used
  • the hash table requires 2 N ⁇ 64 (bit) memory resources. Is.
  • the hash space 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.
  • 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 Non-Patent Document 1, since the hash space is scaled down, a plurality of data are mapped to one hash value, are not fixed, and need to be searched again.
  • 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.
  • 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.
  • 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.
  • the occurrence of hash collision can be reduced even if the original space of the hash method is large.
  • FIG. 1 is a diagram illustrating an example of a tree of a hash table constructed by the search device according to the first embodiment.
  • FIG. 2 is a diagram illustrating a configuration example of the search device according to each embodiment.
  • FIG. 3 is a diagram for explaining the effect of the search device according to the second embodiment.
  • FIG. 4 is a diagram for explaining the effect of the search device according to the third embodiment.
  • FIG. 5 is a diagram for explaining the maximum value of the used memory amount of the tree of the hash table created by the search device according to the fourth embodiment.
  • FIG. 6 is a diagram illustrating an example of a computer that executes a program that implements the functions of the search device according to each embodiment.
  • This search device creates a new hash table required for registration when it receives an input of a group of data to be registered (hereinafter referred to as "rule” as appropriate) in the hash table.
  • rules a group of data to be registered
  • the hash table in this embodiment is a table in which hash values and pointers are associated with each other.
  • bool false/true
  • a pointer may be associated therewith.
  • the search device creates the hash table 101 and updates the pointers of the divided data “200” and “300” in this hash table 101 from “NULL” to “NP”.
  • 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”.
  • the search device registers the data of (1) to (4) in the hash tables 101 to 110 by executing the above processing for each of the data of (1) to (4).
  • 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.
  • 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.
  • the search device divides the hash space to be searched, for example, and constructs a tree of hash tables 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.
  • 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.
  • the search device 10 includes an input unit 11, a control unit 12, a storage unit 13, and an output unit 14.
  • the input unit 11 and the output unit 14 are realized by, for example, an input/output interface included in the search device 10.
  • the control unit 12 is realized by, for example, a program execution process performed by a CPU included in the search device 10.
  • the storage unit 13 is realized by, for example, a main memory and a hard disk device included in the search device 10.
  • the input unit 11 receives input of various data.
  • the input unit 11 receives an input of a data group to be registered in the hash table.
  • the control unit 12 controls the entire search device 10, and includes, for example, a division unit 121, a table creation unit 122, and a search unit 123.
  • the division control unit 124 and the instruction unit 125 indicated by broken lines may or may not be equipped, which will be described later.
  • the dividing unit 121 divides each input data group into a plurality of sections to generate divided data having a predetermined number of bits.
  • the table creation unit 122 creates a hash table that is the registration destination of the data to be registered, and registers the data in the created hash table. Specifically, the table creation unit 122 creates a hash table in which the above-mentioned hash value having a predetermined number of bits and a pointer are associated with each other. Then, the table creation unit 122 registers the split data created by the split unit 121 in the created hash table. For example, the table creation unit 122 sets a pointer associated with the hash value of the divided data in the created hash table to a pointer to a hash table of divided data that follows the divided data in the original data of the divided data ( Update to NP) above. The table creation unit 122 repeats such processing until the divided data in the last section of the data to be registered. As a result, a hash table tree in which the hash tables to be searched are connected by the pointer (NP described above) is constructed.
  • the search unit 123 searches the search target data using the tree of the hash table created by the table creation unit 122, and outputs the search result via the output unit 14.
  • 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 table creation unit 122.
  • 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.
  • the maximum memory usage is about 15.7 GByte.
  • the table creation unit 122 of the search device 10 in the dividing unit 121, generates divided data in which each rule group to be registered is divided into sections of a predetermined number of bits, and then the section is divided into sections. The types of divided data groups belonging to are totaled. Then, when the tree of the hash table is constructed, the table creation unit 122 arranges the hash table of the divided data in the section in which the type of the divided data that has been aggregated is smaller on the root side of the tree, and the type of the aggregated data that has been aggregated is larger.
  • the hash table of the divided data of the section is arranged at the end side of the tree. By doing so, the search device 10 can reduce the memory usage of the tree of the hash table.
  • the search device 10 can increase the number of rules that can be registered in the tree of the hash table. For example, even if the total amount of memory that can be used for rule registration in the search device 10 is limited to within a predetermined value (for example, 16 GBytes), more rules can be registered.
  • a predetermined value for example, 16 GBytes
  • section 111 has the smallest kind of divided data (2 kinds. )
  • Sections 112 and 114 have the second smallest kind of divided data (3 kinds)
  • section 113 has the largest kind of divided data (4 kinds).
  • the table creating unit 122 arranges the hash table of the divided data of the section 111 on the root side of the tree and the hash table of the divided data of the section 113 on the end side of the tree, and the table creating unit 122 sets the section 112, A hash table of 114 divided data is arranged between the root and the end of the tree.
  • the search device 10 calculates an example of the amount of memory used when registering 100,000 rules in which the number of types of divided data for each section when 64-bit data is divided into four is 1, 10, 1000, and 50000, respectively. This will be described with reference to FIG.
  • 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.
  • 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.
  • the table creation unit 122 of the search device 10 arranges the hash table of the divided data in the section where the number of types of the divided data is “1” on the root side of the tree, and the ascending order of the number of types toward the end of the tree.
  • the hash table of the divided data in the section where the number of types is "10” ⁇ the hash table of the divided data in the section where the number of types is "1000” ⁇ the hash table of the divided data in the section where the number of types is "50000" .
  • the memory area used by the tree of the hash table can be saved as the number of divisions of the hash space (for example, four divisions in the first embodiment) is increased. Therefore, the maximum memory area (threshold value) used by the tree of the hash table is specified in the search device 10 in advance by the config or the like, and the total amount of memory area (used memory amount) used by the tree of the hash table is set to the above threshold value. When it exceeds, the search device 10 may increase the number of divisions.
  • the search device 10 further includes a division control unit 124 indicated by a broken line.
  • the division control unit 124 increases the number of divisions of the hash space above a predetermined number when the total amount of used memory of the tree of the hash table exceeds a predetermined threshold.
  • the partition control unit 124 determines that the total amount of used memory of the tree of the hash table exceeds the predetermined threshold value, the number of partitions used by the partition unit 121 and the table creation unit 122 was initially “4”, Increase to "8".
  • the division control unit 124 instructs the division unit 121 to generate division data by dividing each rule to be registered into 8 bits, and associates the table creation unit 122 with the 8-bit hash value and the pointer. Instruct to create a hash table.
  • the search device 10 can keep the total amount of used memory of the tree of the hash table within a predetermined threshold even if the number of rules to be registered is large. As a result, for example, when the total amount of memory that can be used for rule registration in the search device 10 is limited to within a predetermined threshold value (for example, 16 GByte), even when the number of rules to be registered increases, This can be dealt with.
  • a predetermined threshold value for example, 16 GByte
  • the search device 10 registers 100,000 rules in the tree of the hash table when the total amount of memory that can be used for rule registration is limited to within 16 GBytes.
  • the search device 10 can register the rule to be registered.
  • the search device 10 can also save the memory area used by the tree of the hash table by increasing the reduction scale of the hash function. Therefore, when the maximum memory area (threshold value) used by the tree of the hash table is specified in the search device 10 in advance by the configuration and the total amount of used memory of the tree of the hash table exceeds the above threshold value, the search device 10 The reduction scale of the hash function may be increased.
  • increasing the reduction scale of the hash function means, for example, when the search device 10 uses mod N (N is a natural number) for the hash function, the value of N is made smaller than the value used so far.
  • mod N mod N (N is a natural number) should be used for the hash function. An embodiment in this case will be described as a fourth embodiment.
  • the search device 10 divides a 64-bit hash interval into four and registers 100,000 rules
  • mod 8192 scale 1/8 is applied as a hash function used for each hash table.
  • the search device 10 increases the number of divisions of the hash space when the total amount of used memory of the tree of the hash table exceeds a predetermined threshold value (see the third embodiment), or the hash function used for the hash table.
  • the user of the search device 10 may set whether to increase the reduction scale (see the fourth embodiment).
  • the search device 10 inputs the setting information indicating whether to increase the number of divisions of the hash space or the reduction scale of the hash function.
  • the setting information is stored in the storage unit 13.
  • the instruction unit 125 (see FIG. 1) of the search device 10 causes the division control unit 124 to divide the number of divisions according to the setting information stored in the storage unit 13. Is increased above a predetermined value, or the table creation unit 122 is instructed to increase the reduction scale of the hash function used in the hash table above a predetermined value.
  • the search device 10 adopts a method of increasing the number of divisions of the hash space (see the third embodiment), or The user of the search device 10 can specify whether to adopt the method of increasing the reduction scale of the hash function used in the table (see the fourth embodiment).
  • the search device 10 may determine the number of divisions of the hash space and the reduction scale of the hash function used for each hash table according to the total amount of used memory of the tree of the hash table. For example, the search device 10 increases the number of divisions of the hash space as the total amount of used memory of the tree of the hash table increases (that is, the number of registered rules increases), or the number of hash functions used for each hash table increases.
  • the reduction scale may be increased.
  • the information processing device can be caused to function as the search device 10 by causing the information processing device to execute the above-described program provided as package software or online software.
  • the information processing device mentioned here includes a desktop or notebook personal computer, a rack-mounted server computer, and the like.
  • the information processing apparatus includes a mobile communication terminal such as a smartphone, a mobile phone, a PHS (Personal Handyphone System), and a PDA (Personal Digital Assistant) in its category.
  • the search device 10 may be mounted on a cloud server.
  • the computer 1000 has, for example, a memory 1010, a CPU 1020, a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These units are connected by a bus 1080.
  • the memory 1010 includes a ROM (Read Only Memory) 1011 and a RAM (Random Access Memory) 1012.
  • the ROM 1011 stores, for example, a boot program such as BIOS (Basic Input Output System).
  • BIOS Basic Input Output System
  • the hard disk drive interface 1030 is connected to the hard disk drive 1090.
  • the disk drive interface 1040 is connected to the disk drive 1100.
  • a removable storage medium such as a magnetic disk or an optical disk is inserted into the disk drive 1100.
  • a mouse 1110 and a keyboard 1120 are connected to the serial port interface 1050, for example.
  • a display 1130 for example, is connected to the video adapter 1060.
  • the hard disk drive 1090 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094.
  • the various data and information described in the above embodiments are stored in, for example, the hard disk drive 1090 or the memory 1010.
  • the CPU 1020 reads the program module 1093 and the program data 1094 stored in the hard disk drive 1090 into the RAM 1012 as necessary, and executes the above-described procedures.
  • the program module 1093 and the program data 1094 related to the above program are not limited to being stored in the hard disk drive 1090, and may be stored in a removable storage medium and read by the CPU 1020 via the disk drive 1100 or the like. May be issued. Alternatively, the program module 1093 and the program data 1094 related to the above program are stored in another computer connected via a network such as LAN or WAN (Wide Area Network) and read by the CPU 1020 via the network interface 1070. May be done.
  • LAN or WAN Wide Area Network
  • search device 11 input unit 12 control unit 13 storage unit 121 division unit 122 table creation unit 123 search unit 124 division control unit 125 instruction unit

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

検索装置は、テーブルへの登録対象のデータ群の入力を受け付ける入力部と、入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する分割部と、データ群の登録時に、所定のbit数のハッシュ値とポインタとしてNULLを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおける分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、ハッシュテーブルそれぞれをノードとするツリーを構築することにより、ハッシュテーブルそれぞれの使用メモリの総量を低減し、ハッシュテーブルにおけるハッシュ衝突を低減するテーブル作成部とを備える。

Description

検索装置、および、ハッシュテーブルの作成方法
 本発明は、検索装置、および、ハッシュテーブルの作成方法に関する。
 従来、パケットの転送等において、どのパケットにどのruleを適用するかの検索にハッシュ法が用いられていた。このハッシュ法は高速な検索を実現する技術である。
ALAXALA、[平成31年1月13日検索]、インターネット<URL:https://www.nic.ad.jp/ja/materials/iw/2012/proceedings/d1/>
 ここで、ハッシュ法の原空間が大きい場合、メモリ等のリソース上の問題から、ハッシュ空間の縮尺度を高めなければならず、その縮尺度に応じてハッシュ衝突のリスクが生じる。
 例えば、検索に用いられるハッシュ空間をNbitとし、ハッシュ関数として恒等関数(y=x)を使用し、64bitマシンを用いる場合、ハッシュテーブルには、2N×64(bit)のメモリリソースが必要である。ここで、ハッシュテーブルのメモリリソースを16GByte以内に抑えたい場合、ハッシュ空間は31bit以下である必要がある。よって、ハッシュ法の原空間が64bitの場合、縮尺度が1/(233)のハッシュ関数を選択しなければならない。その結果、登録対象のrule(データ)の数が10億以下であれば、すべてのデータが同じハッシュ値にマッピングされる場合もあり、その場合、すべての登録データを線形検索しなければならない。例えば、非特許文献1に記載の技術においても、ハッシュ空間を縮尺するため、複数のデータが1つのハッシュ値にマッピングされ、固定化されず、再度検索する必要が出てくる。
 そこで、本発明は、前記した問題を解決し、ハッシュ法の原空間が大きい場合であってもハッシュ衝突の発生を低減することを課題とする。
 前記した課題を解決するため、本発明は、テーブルへの登録対象のデータ群の入力を受け付ける入力部と、入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する分割部と、前記データ群の登録時に、前記所定のbit数のハッシュ値とポインタとしてNULLとを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおいて前記分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、前記ハッシュテーブルそれぞれをノードとするツリーを構築することにより、前記ハッシュテーブルそれぞれの使用メモリの総量を低減し、前記ハッシュテーブルにおけるハッシュ衝突を低減するテーブル作成部と、を備えることを特徴とする。
 本発明によれば、ハッシュ法の原空間が大きい場合であってもハッシュ衝突の発生を低減することができる。
図1は、第1の実施形態の検索装置が構築するハッシュテーブルのツリーの一例を示す図である。 図2は、各実施形態の検索装置の構成例を示す図である。 図3は、第2の実施形態の検索装置の効果を説明するための図である。 図4は、第3の実施形態の検索装置の効果を説明するための図である。 図5は、第4の実施形態の検索装置が作成するハッシュテーブルのツリーの使用メモリ量の最大値を説明するための図である。 図6は、各実施形態の検索装置の機能を実現するプログラムを実行するコンピュータの一例を示す図である。
 以下、図面を参照しながら、本発明を実施するための形態(実施形態)を第1の実施形態から第4の実施形態に分けて説明する。本発明は、各実施形態に限定されない。
[第1の実施形態]
[ハッシュテーブルのツリーの例]
 まず、図1を用いて、第1の実施形態におけるハッシュテーブルのツリーの構築例を説明する。ここではデータの検索に用いられるハッシュ空間(原空間)が64bitである場合を例に説明する。本実施形態の検索装置は、例えば、検索に用いられる64bitのハッシュ空間を4つに分割し、16bitのハッシュ空間を示すハッシュテーブルをノードとするツリーを構築する。
 この検索装置は、ハッシュテーブルへの登録対象のデータ(以下、適宜「rule」と称す)群の入力を受け付けると、登録に必要なハッシュテーブルを新規に作成する。ここでは、ハッシュテーブルに用いるハッシュ関数として、恒等関数(y=x)を用いる場合を例に説明する。
 また、本実施形態におけるハッシュテーブルは、ハッシュ値とポインタとを対応付けたテーブルである。なお、図1に示すハッシュテーブル104,106,109,110のハッシュ値には、bool(false/true)が対応付けられているが、ポインタを対応付けてもよい。
 例えば、検索装置が、図1に示す(1)~(4)のデータを4つの区間(区間111~114)に分割し、分割されたデータ(分割データ)を16bitのハッシュテーブル101~110に登録する。具体的には、検索装置は、ハッシュテーブル101において(1)~(4)のデータに登場する分割データ(=ハッシュ値)に対応するポインタを「NULL」から「NP(ネクストポインタ)」に更新する。そして、このNPに対応するハッシュテーブル(例えば、ハッシュテーブル102)のハッシュ値のうち、上記の分割データに続く分割データに対応するポインタを「NULL」から「NP」に更新する。
 例えば、検索装置は、ハッシュテーブル101を作成し、このハッシュテーブル101における分割データ「200」および「300」のポインタを「NULL」から「NP」に更新する。次に、検索装置は、ハッシュテーブル102を作成すると、このハッシュテーブル102において、上記の分割データ「200」に続く分割データ「300」および「600」のポインタを「NULL」から「NP」に更新する。検索装置は、上記の処理を(1)~(4)のデータそれぞれについて実行することにより、(1)~(4)のデータをハッシュテーブル101~110に登録する。その結果、ハッシュテーブル101~110をノードとし、ノード同士がNPにより接続されたハッシュテーブルのツリーが構築される。
 検索装置が、上記のハッシュテーブルのツリーを構築した後、例えば、(1)のデータの検索要求を受け付けた場合、図1に示すハッシュテーブルのツリーを辿ることにより、(1)のデータを検索する。検索の結果、(1)のデータを発見すると、検索装置はtrueを返し、(1)のデータを発見できなかった場合、検索装置はfalseを返す。
 上記のように、検索装置は、例えば、検索対象となるハッシュ空間を分割し、分割したハッシュ空間を示すハッシュテーブルのツリーを構築する。また、検索装置は、データの登録時に必要なハッシュテーブルを作成する。その結果、検索対象となるハッシュ空間が比較的大きい場合であっても、ハッシュテーブルの使用メモリ量を大幅に低減することができる。これにより、検索装置は、ハッシュテーブルに用いるハッシュ値を縮尺しないでよい、あるいは、ハッシュ値を縮尺する場合であっても縮尺度を小さくすることができるので、ハッシュ衝突の発生を低減することができる。また、例えば、検索装置において、各ハッシュテーブルに使用することができるメモリ量の総量(つまり、rule登録に使用することができるメモリ量の総量)が所定値(例えば、16GByte)以内に限られている場合であっても、使用メモリ量を上記の所定値以内に収めることができる。
[構成]
 次に、図2を用いて第1の実施形態の検索装置10の構成例を説明する。検索装置10は、入力部11、制御部12、記憶部13、出力部14を備える。
 入力部11および出力部14は、例えば、検索装置10の備える入出力インタフェースにより、実現される。制御部12は、例えば、検索装置10の備えるCPUによるプログラム実行処理により実現される。記憶部13は、例えば、検索装置10の備えるメインメモリおよびハードディスク装置により実現される。
 入力部11は、各種データの入力を受け付ける。例えば、入力部11は、ハッシュテーブルへの登録対象となるデータ群の入力を受け付ける。制御部12は、検索装置10全体の制御を司り、例えば、分割部121と、テーブル作成部122と、検索部123とを備える。破線で示す分割制御部124および指示部125は装備される場合と装備されない場合とがあり、装備される場合については、後記する。
 分割部121は、入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する。
 テーブル作成部122は、登録対象のデータの登録先となるハッシュテーブルを作成し、作成したハッシュテーブルにデータを登録する。具体的には、テーブル作成部122は、上記の所定のbit数のハッシュ値とポインタとを対応付けたハッシュテーブルを作成する。そして、テーブル作成部122は、作成したハッシュテーブルに、分割部121により生成された分割データを登録する。例えば、テーブル作成部122は、作成したハッシュテーブルにおいて、当該分割データのハッシュ値に対応付けられるポインタを、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタ(上記のNP)に更新する。テーブル作成部122は、このような処理を、登録対象となるデータの末尾の区間の分割データまで繰り返す。これにより、検索対象となるハッシュテーブルがポインタ(上記のNP)により接続された、ハッシュテーブルのツリーが構築される。
 検索部123は、テーブル作成部122により作成されたハッシュテーブルのツリーを用いて、検索対象のデータを検索し、出力部14経由で検索結果を出力する。
 記憶部13は、制御部12が動作するために必要な各種データを記憶する。例えば、記憶部13は、ハッシュ空間の分割数等を記憶する。この分割数は、例えば、入力部11からの指示入力に基づき適宜変更可能である。また、記憶部13は、テーブル作成部122により作成されたハッシュテーブルを記憶する。
 出力部14は、制御部12による処理結果を出力する。例えば、出力部14は、検索部123による検索結果を出力する。
 このような検索装置10によれば、例えば、64bitのハッシュ空間を4分割し、10000ruleを登録した場合でも、メモリ使用量は最大で15.7GByte程度である。つまり、上記の場合、ハッシュテーブルの数は最大で1+10000+10000+10000=30001であるので、メモリ使用量を、30001(テーブル数)×65536(1テーブルあたりのindex数)×8Byte(1indexあたりの容量)≒15.7GByte以内に収めることができる。
 このように検索装置10は、登録対象のruleに関するハッシュテーブルのみを新規に作成するので、ハッシュテーブルに必要なメモリ領域を低減できる。その結果、ハッシュ関数として恒等関数(y=x)を用いやすくなる。また、従来技術のようにハッシュ空間を分割せずに上記の10000ruleを登録する場合、ハッシュ空間の縮尺度を高める必要がある。よって、ruleの検索時に最大で10000回のハッシュ衝突が発生するので、検索時間が長くなってしまうおそれがある。一方、検索装置10の場合、ruleの検索時に、(ハッシュ空間の分割数-1)回のNULL判定が発生するものの、ハッシュ空間の縮尺度を高める必要がなくなる。その結果、ハッシュ衝突の発生を低減することができるので、検索時間が長くなることを防止することができる。
[第2の実施形態]
 次に、第2の実施形態の検索装置10を説明する。第1の実施形態と同じ構成は同じ符号を付して説明を省略する。
 第2の実施形態の検索装置10のテーブル作成部122は、分割部121において、登録対象のrule群それぞれを所定のbit数の区間に区切った分割データを生成した後、区間ごとに、当該区間に属する分割データ群の種類を集計する。そして、テーブル作成部122は、ハッシュテーブルのツリーを構築する際、集計した分割データの種類が少ない区間の分割データのハッシュテーブルほど、ツリーのルート側に配置し、集計した分割データの種類が多い区間の分割データのハッシュテーブルほど、ツリーの末端側に配置する。このようにすることで、検索装置10は、ハッシュテーブルのツリーの使用メモリ量を低減することができる。その結果、検索装置10は、ハッシュテーブルのツリーに登録可能なrule数を増加させることができる。例えば、検索装置10においてrule登録に使用することができるメモリ量の総量が所定値(例えば、16GByte)以内に限られている場合あっても、より多くのruleを登録することができる。
 例えば、図1の(1)~(4)に示すruleを4つの区間(区間111,112,113,114)に区切った場合、分割データの種類が最も少ないのは区間111であり(2種類)、2番目に分割データの種類が少ないのは区間112,114であり(3種類)、最も分割データの種類が多いのは区間113である(4種類)。
 よって、テーブル作成部122は、テーブル作成部122は区間111の分割データのハッシュテーブルをツリーのルート側に配置し、区間113の分割データのハッシュテーブルをツリーの末端側に配置し、区間112,114の分割データのハッシュテーブルをツリーのルートと末端との間に配置する。
 また、検索装置10は64bitのデータを4分割した際の区間ごとの分割データの種類数がそれぞれ1、10、1000、50000である10万ruleを登録する場合の使用メモリ量の計算例を、図3を参照しながら説明する。
 例えば、分割データの種類数が「50000」の区間における分割データ群のハッシュテーブルをツリーのルート側に配置し、ツリーの末端方向に向かって、種類数の昇順に、種類数が「1000」の区間における分割データのハッシュテーブル→種類数が「10」の区間における分割データのハッシュテーブル→種類数が「1」の区間における分割データのハッシュテーブルという順に配置した場合を考える。この場合、各区間におけるテーブル数の最大値は、図3(a)に示すように1、50000、100000、100000なので、ハッシュテーブルの数の合計は最大で1+50000+100000+100000=250001である。よって、ハッシュテーブルのツリーの使用メモリ量は最大で約131.1GByteで、16GByte以内に収まらない可能性がある。
 一方、検索装置10のテーブル作成部122は、分割データの種類数が「1」の区間における分割データのハッシュテーブルをツリーのルート側に配置し、ツリーの末端方向に向かって、種類数の昇順に、種類数が「10」の区間における分割データのハッシュテーブル→種類数が「1000」の区間における分割データのハッシュテーブル→種類数が「50000」の区間における分割データのハッシュテーブルという順に配置する。この場合、各区間におけるテーブル数の最大値は、図3(b)に示すように1、1、10、10000なので、ハッシュテーブルの数の合計は最大で1+1+10+10000=10011である。よって、ハッシュテーブルのツリーの使用メモリ量は最大で約5.2GByteで、16GByte以内に収まる。
[第3の実施形態]
 次に、第3の実施形態の検索装置10を説明する。前記した実施形態と同じ構成は同じ符号を付して説明を省略する。
 第1の実施形態で述べたとおり、ハッシュ空間の分割数(例えば、第1の実施形態においては4分割)を増やすほど、ハッシュテーブルのツリーが使用するメモリ領域を節約することができる。そこで、予めハッシュテーブルのツリーが使用する最大メモリ領域(閾値)をコンフィグ等で検索装置10に指定しておき、ハッシュテーブルのツリーが使用するメモリ領域の総量(使用メモリ量)が上記の閾値を超える場合、検索装置10は、上記の分割数を増加させてもよい。
 例えば、第3の実施形態において、検索装置10は、破線で示す分割制御部124をさらに備える。分割制御部124は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超える場合、ハッシュ空間の分割数を所定数より増加させる。
 例えば、分割制御部124は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超えると判断した場合、分割部121およびテーブル作成部122の用いる分割数が当初「4」であったところ、「8」に増加させる。例えば、分割制御部124は、分割部121に登録対象のruleそれぞれを8bitずつに分割した分割データを生成するよう指示し、また、テーブル作成部122に8bitのハッシュ値とポインタとを対応付けたハッシュテーブルを作成するよう指示する。
 これにより検索装置10は、例えば、登録対象のrule数が多い場合でも、ハッシュテーブルのツリーの使用メモリの総量を所定の閾値以内に収めることができる。その結果、例えば、検索装置10においてrule登録に使用することができるメモリ量の総量が所定の閾値(例えば、16GByte)以内に限られている場合において、登録対象のrule数が増加したときでも、これに対応することができる。
 例えば、rule登録に使用することができるメモリ量の総量が16GByte以内に限られている場合において、検索装置10が、10万ruleをハッシュテーブルのツリーに登録するときを考える。この場合、検索装置10が、ハッシュ空間の分割数を「4」とすると、例えば、図4(a)に示すように、ハッシュテーブルのテーブル数は最大で1+65536+100000+100000=265537である。よって、ハッシュテーブルのツリーに使用メモリ量は、最大で約139.2GByteで、16GByte以内に収まらず、その結果、検索装置10は、登録対象のruleを登録できない可能性がある。
 一方、第3の実施形態の検索装置10のように、ハッシュ空間の分割数を「8」とする(つまり、8bitずつに分割する)と、例えば、図4(b)に示すように、ハッシュテーブルのテーブル数は最大で1+256+65536+100000+…+100000=565793である。よって、ハッシュテーブルのツリーの使用メモリ量は、最大でも約1.2GByteで、16GByte以内に収めることができる。その結果、検索装置10は、登録対象のruleを登録することができる。
[第4の実施形態]
 次に、第4の実施形態の検索装置10を説明する。前記した実施形態と同じ構成は同じ符号を付して説明を省略する。
 前記したとおり検索装置10は、ハッシュ関数の縮尺度を高めることによっても、ハッシュテーブルのツリーが使用するメモリ領域を節約することができる。そこで、予めハッシュテーブルのツリーが使用する最大メモリ領域(閾値)をコンフィグ等で検索装置10に指定しておき、ハッシュテーブルのツリーの使用メモリの総量が上記の閾値を超える場合、検索装置10は、ハッシュ関数の縮尺度を高めるようにしてもよい。
 ここで、ハッシュ関数の縮尺度を高めるとは、例えば、検索装置10がハッシュ関数にmod N(Nは自然数)を用いていた場合、Nの値を今まで使っていた値よりも小さくする。あるいは、検索装置10がもともとハッシュ関数に恒等関数を用いていた場合、ハッシュ関数にmod N(Nは自然数)を用いるようにすることである。この場合の実施形態を第4の実施形態として説明する。
 例えば、第3の実施形態の項で述べたとおり、検索装置10が10万ruleを登録する場合において、ハッシュ関数として恒等関数を用いると、ハッシュテーブルのツリーの使用メモリの総量は16GByteを超える可能性がある。しかし、検索装置10が、例えば、ハッシュ関数としてy=x mod 8192(縮尺 1/8)を用いることで、10万ruleを登録する場合でも、ハッシュテーブルのツリーの使用メモリ量は、最大で約13.6GByteで、に抑えることができる。このことを、図5を用いて説明する。
 例えば、図5に示すように、検索装置10が64bitのハッシュ区間を4分割し、10万ruleを登録する場合において、各ハッシュテーブルに用いるハッシュ関数としてmod 8192(縮尺 1/8)を適用したとき、ハッシュテーブルのテーブル数は最大で1+8192+100000+100000=208193となる。よって、ハッシュテーブルのツリーの使用メモリ量は、最大で約13.6GByteで、16GByte以内に収まる。
[その他の実施形態]
 なお、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超える場合、ハッシュ空間の分割数を増加させる(第3の実施形態参照)か、ハッシュテーブルに用いられるハッシュ関数の縮尺度を高める(第4の実施形態参照)かを、検索装置10の利用者が設定してもよい。
 この場合、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量が所定の閾値を超える場合、ハッシュ空間の分割数を増加させるか、ハッシュ関数の縮尺度を高めるかを示す設定情報を入力部11経由で受け付けると、当該設定情報を記憶部13に格納しておく。そして、検索装置10の指示部125(図1参照)は、ハッシュテーブルのツリーの使用メモリの総量が所定値を超える場合、記憶部13に記憶された設定情報に従い、分割制御部124に分割数を所定値よりも増加させる指示、または、テーブル作成部122に、ハッシュテーブルに用いられるハッシュ関数の縮尺度を所定値よりも高める指示を行う。
 このようにすることで、ハッシュテーブルのツリーの使用メモリの総量が所定値を超える場合、検索装置10がハッシュ空間の分割数を増加させる(第3の実施形態参照)方式を採るか、各ハッシュテーブルに用いられるハッシュ関数の縮尺度を高める(第4の実施形態参照)方式を採るかを検索装置10の利用者が指定することができる。
 なお、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量に応じて、ハッシュ空間の分割数、および、各ハッシュテーブルに用いられるハッシュ関数の縮尺度を決定してもよい。例えば、検索装置10は、ハッシュテーブルのツリーの使用メモリの総量が大きいほど(つまり、登録rule数が多いほど)、ハッシュ空間の分割数を増加させ、あるいは、各ハッシュテーブルに用いられるハッシュ関数の縮尺度を高くしてもよい。
[プログラム]
 また、上記の実施形態で述べた検索装置10の機能を実現するプログラムを所望の情報処理装置(コンピュータ)にインストールすることによって実装できる。例えば、パッケージソフトウェアやオンラインソフトウェアとして提供される上記のプログラムを情報処理装置に実行させることにより、情報処理装置を検索装置10として機能させることができる。ここで言う情報処理装置には、デスクトップ型またはノート型のパーソナルコンピュータ、ラック搭載型のサーバコンピュータ等が含まれる。また、その他にも、情報処理装置にはスマートフォン、携帯電話機やPHS(Personal Handyphone System)等の移動体通信端末、さらには、PDA(Personal Digital Assistant)等がその範疇に含まれる。また、検索装置10を、クラウドサーバに実装してもよい。
 図6を用いて、上記のプログラムを実行するコンピュータの一例を説明する。図6に示すように、コンピュータ1000は、例えば、メモリ1010と、CPU1020と、ハードディスクドライブインタフェース1030と、ディスクドライブインタフェース1040と、シリアルポートインタフェース1050と、ビデオアダプタ1060と、ネットワークインタフェース1070とを有する。これらの各部は、バス1080によって接続される。
 メモリ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が接続される。
 ここで、図6に示すように、ハードディスクドライブ1090は、例えば、OS1091、アプリケーションプログラム1092、プログラムモジュール1093およびプログラムデータ1094を記憶する。前記した実施形態で説明した各種データや情報は、例えばハードディスクドライブ1090やメモリ1010に記憶される。
 そして、CPU1020が、ハードディスクドライブ1090に記憶されたプログラムモジュール1093やプログラムデータ1094を必要に応じてRAM1012に読み出して、上述した各手順を実行する。
 なお、上記のプログラムに係るプログラムモジュール1093やプログラムデータ1094は、ハードディスクドライブ1090に記憶される場合に限られず、例えば、着脱可能な記憶媒体に記憶されて、ディスクドライブ1100等を介してCPU1020によって読み出されてもよい。あるいは、上記のプログラムに係るプログラムモジュール1093やプログラムデータ1094は、LANやWAN(Wide Area Network)等のネットワークを介して接続された他のコンピュータに記憶され、ネットワークインタフェース1070を介してCPU1020によって読み出されてもよい。
10 検索装置
11 入力部
12 制御部
13 記憶部
121 分割部
122 テーブル作成部
123 検索部
124 分割制御部
125 指示部

Claims (7)

  1.  テーブルへの登録対象のデータ群の入力を受け付ける入力部と、
     入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成する分割部と、
     前記データ群の登録時に、前記所定のbit数のハッシュ値とポインタとしてNULLとを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおける前記分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、前記ハッシュテーブルそれぞれをノードとするツリーを構築することにより、前記ハッシュテーブルそれぞれの使用メモリの総量を低減し、前記ハッシュテーブルにおけるハッシュ衝突を低減するテーブル作成部と、
     を備えることを特徴とする検索装置。
  2.  前記テーブル作成部は、
     前記区間ごとに、当該区間に属する前記分割データの種類を集計し、前記集計した分割データの種類が少ない区間の分割データのハッシュテーブルほど、前記ツリーのルート側に配置し、前記集計した分割データの種類が多い区間の分割データのハッシュテーブルほど、前記ツリーの末端側に配置した前記ツリーを構築することにより、登録可能なデータの数を増加させる
     ことを特徴とする請求項1に記載の検索装置。
  3.  前記テーブル作成部は、
     前記ハッシュテーブルに用いられるハッシュ関数として恒等関数を用いることにより、前記ハッシュテーブルにおけるハッシュ衝突を発生させない
     ことを特徴とする請求項1に記載の検索装置。
  4.  前記ツリーの使用メモリの総量が所定値を超える場合、前記区間の数を所定値よりも増加させる分割制御部をさらに備える
     ことを特徴とする請求項1に記載の検索装置。
  5.  前記テーブル作成部は、
     前記ツリーの使用メモリの総量が所定値を超える場合、前記ハッシュテーブルに用いられるハッシュ関数の縮尺度を所定値よりも高める
     ことを特徴とする請求項1に記載の検索装置。
  6.  前記ツリーの使用メモリの総量が所定値を超える場合、記憶部に記憶された設定情報に従い、前記分割制御部に前記区間の数を所定値よりも増加させる指示、または、前記テーブル作成部に、前記ハッシュテーブルに用いられるハッシュ関数の縮尺度を所定値よりも高める指示を行う指示部をさらに備える
     ことを特徴とする請求項4に記載の検索装置。
  7.  検索装置により実行されるハッシュテーブルの作成方法であって、
     テーブルへの登録対象のデータ群の入力を受け付けるステップと、
     入力されたデータ群それぞれを複数の区間に分割することにより所定のbit数の分割データを生成するステップと、
     前記データ群の登録時に、前記所定のbit数のハッシュ値とポインタとしてNULLとを対応付けたハッシュテーブルを作成し、作成したハッシュテーブルにおける前記分割データのハッシュ値に対応付けられるポインタをNULLから、当該分割データの分割元のデータにおいて当該分割データに続く分割データのハッシュテーブルへのポインタに更新し、前記ハッシュテーブルそれぞれをノードとするツリーを構築することにより、前記ハッシュテーブルそれぞれの使用メモリの総量を低減し、前記ハッシュテーブルにおけるハッシュ衝突を低減するステップと、
     を含むことを特徴とするハッシュテーブルの作成方法。
PCT/JP2020/000617 2019-01-25 2020-01-10 検索装置、および、ハッシュテーブルの作成方法 WO2020153154A1 (ja)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2019-011155 2019-01-25
JP2019011155A JP2020119363A (ja) 2019-01-25 2019-01-25 検索装置、および、ハッシュテーブルの作成方法

Publications (1)

Publication Number Publication Date
WO2020153154A1 true WO2020153154A1 (ja) 2020-07-30

Family

ID=71736954

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/000617 WO2020153154A1 (ja) 2019-01-25 2020-01-10 検索装置、および、ハッシュテーブルの作成方法

Country Status (2)

Country Link
JP (1) JP2020119363A (ja)
WO (1) WO2020153154A1 (ja)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6292795B1 (en) * 1998-05-30 2001-09-18 International Business Machines Corporation Indexed file system and a method and a mechanism for accessing data records from such a system
JP2008533570A (ja) * 2005-03-11 2008-08-21 ロックソフト リミテッド 低冗長記憶システムで索引を行う方法
JP2017091432A (ja) * 2015-11-17 2017-05-25 日本電信電話株式会社 辞書検索方法および装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6292795B1 (en) * 1998-05-30 2001-09-18 International Business Machines Corporation Indexed file system and a method and a mechanism for accessing data records from such a system
JP2008533570A (ja) * 2005-03-11 2008-08-21 ロックソフト リミテッド 低冗長記憶システムで索引を行う方法
JP2017091432A (ja) * 2015-11-17 2017-05-25 日本電信電話株式会社 辞書検索方法および装置

Also Published As

Publication number Publication date
JP2020119363A (ja) 2020-08-06

Similar Documents

Publication Publication Date Title
US8027961B2 (en) System and method for composite record keys ordered in a flat key space for a distributed database
US10592531B2 (en) Efficient partitioning of relational data
US20140059094A1 (en) Making use of a file path to determine file locality for applications
CN112930526A (zh) 使用水平聚合SIMD指令对d-堆进行向量化的方法
CN110737663A (zh) 一种数据存储方法、装置、设备及存储介质
WO2021174836A1 (zh) 差分包生成方法方法、装置、计算机设备及存储介质
US11651221B2 (en) Method, device, and computer program product for deep learning
CN114416310A (zh) 一种多处理器负载均衡方法、计算设备及存储介质
US10601711B1 (en) Lens table
CN109302449B (zh) 数据写入方法、数据读取方法、装置和服务器
US10303791B2 (en) Efficient join on dynamically compressed inner for improved fit into cache hierarchy
US8978048B2 (en) Information processing system, control method, and non-transitory computer readable medium storing program
WO2020153154A1 (ja) 検索装置、および、ハッシュテーブルの作成方法
US11379232B2 (en) Method for generic vectorized d-heaps
CN111163060B (zh) 一种基于应用组的转发方法、设备以及系统
US10511531B1 (en) Enhanced lens distribution
JP6189266B2 (ja) データ処理装置、データ処理方法及びデータ処理プログラム
CN107729577B (zh) 一种基于多维哈希表的数据查找方法、终端设备及存储介质
US10355994B1 (en) Lens distribution
US10795873B1 (en) Hash output manipulation
CN108694205B (zh) 匹配目标字段的方法、装置
US10146791B2 (en) Open file rebalance
US11435926B2 (en) Method, device, and computer program product for managing storage system
CN113468529B (zh) 一种数据搜索方法和装置
CN112260951A (zh) 期待连接处理方法、装置、可读存储介质和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20744810

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20744810

Country of ref document: EP

Kind code of ref document: A1