[go: up one dir, main page]

JP2013247389A - Network apparatus and hash function selection method - Google Patents

Network apparatus and hash function selection method Download PDF

Info

Publication number
JP2013247389A
JP2013247389A JP2012117564A JP2012117564A JP2013247389A JP 2013247389 A JP2013247389 A JP 2013247389A JP 2012117564 A JP2012117564 A JP 2012117564A JP 2012117564 A JP2012117564 A JP 2012117564A JP 2013247389 A JP2013247389 A JP 2013247389A
Authority
JP
Japan
Prior art keywords
hash
value
entry
counter
calculated
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
Application number
JP2012117564A
Other languages
Japanese (ja)
Inventor
Hitoshi Kaneko
斉 金子
Kenichi Higuchi
健一 樋口
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 JP2012117564A priority Critical patent/JP2013247389A/en
Publication of JP2013247389A publication Critical patent/JP2013247389A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

【課題】最適ハッシュ関数の選定時間を短くすること。
【解決手段】本発明のネットワーク機器は、ハッシュテーブルと、ハッシュカウンタテーブルと、を有し、エントリの登録/削除要求時毎に、複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリのハッシュテーブルへの登録/削除の成否に応じて当該ハッシュ値のカウンタ値を増減し、複数のハッシュ関数毎に、ハッシュカウンタテーブルにおけるカウンタ値の統計値を求め、複数のハッシュ関数の各々の統計値に基づきハッシュ関数を選定し、選定したハッシュ関数を用いて、ハッシュテーブルに登録された全てのエントリのハッシュ値を計算し、計算したハッシュ値とエントリをハッシュテーブルに展開する。
【選択図】図1
An object of the present invention is to shorten the selection time of an optimal hash function.
A network device of the present invention has a hash table and a hash counter table, and calculates a hash value of the entry using each of a plurality of hash functions for each entry registration / deletion request. Then, the counter value of the hash value is increased / decreased according to the success / failure of registration / deletion of the entry in the hash table, and the statistical value of the counter value in the hash counter table is obtained for each of the plurality of hash functions. A hash function is selected based on each statistic value, and the hash value of all entries registered in the hash table is calculated using the selected hash function, and the calculated hash value and entry are developed in the hash table.
[Selection] Figure 1

Description

本発明は、ネットワーク機器において、複数のハッシュ関数の中から最適なハッシュ関数を選定する技術に関する。   The present invention relates to a technique for selecting an optimum hash function from a plurality of hash functions in a network device.

図13に、ルータ/スイッチ等のネットワーク機器の従来構成を示す。このネットワーク機器は、パケット受信部11と、パケット処理部12と、パケット送信部13と、テーブル(table)14と、テーブル操作部15と、を有している。   FIG. 13 shows a conventional configuration of a network device such as a router / switch. The network device includes a packet receiving unit 11, a packet processing unit 12, a packet transmission unit 13, a table 14, and a table operation unit 15.

図13に示すネットワーク機器では、回線からのパケットをパケット受信部11にて受信すると、パケット処理部12は、テーブル14から該当するentry(エントリ)を検索し、検索したentryにて指定されたパケット処理を実施する。   In the network device shown in FIG. 13, when the packet receiving unit 11 receives a packet from the line, the packet processing unit 12 searches the table 14 for the corresponding entry (entry), and the packet specified by the searched entry. Perform the process.

テーブル14は、上記のパケット処理とは別に、外部サーバ20からのentry登録/削除要求時に、テーブル操作部15によりentryの登録/削除の操作が行われる。従って、パケット処理によるテーブル検索とテーブル操作とが競合し、パケット処理性能とテーブル操作性能に影響を及ぼす可能性がある。   In addition to the packet processing described above, the table operation unit 15 performs entry registration / deletion operations on the table 14 when an entry registration / deletion request is issued from the external server 20. Therefore, there is a possibility that the table search by the packet processing and the table operation compete with each other, and the packet processing performance and the table operation performance are affected.

近年のトラヒック増加に伴い、高い処理性能(パケット転送性能、テーブル操作性能)が望まれるネットワーク機器では、処理競合対策が必要となる。   With the increase in traffic in recent years, network contention measures that require high processing performance (packet transfer performance, table operation performance) require processing contention countermeasures.

ところで、tableの検索技術として、非特許文献1には、線形探索法やHash(ハッシュ)法が開示されている。   By the way, as a table search technique, Non-Patent Document 1 discloses a linear search method and a hash (hash) method.

図14左上側に示すように、線形探索法では、entryをリスト構造でtableに登録しておく。そのため、所望のentryを検索するのに最後尾に登録されたentryの場合、全てのentryとの照合が必要になる(図14左上側の例では、最大で6回の検索が必要)。   As shown in the upper left of FIG. 14, in the linear search method, entries are registered in a table with a list structure. Therefore, in the case of an entry registered at the end for searching for a desired entry, it is necessary to collate with all entries (in the example on the upper left side of FIG. 14, a search is required up to six times).

これに対して、図14左下側に示すように、Hash法では、Hash関数によりのHash値を計算し、Hash値毎にentryをHash tableに登録しておく。このとき、Source portのように元空間が小さい場合、Hash関数として等号関数(y=x)を用いれば、Hash tableの状態がどの様な状態であっても、複数のentryが同一のHash値になる(Hash値の衝突)ことはなく、所望のentryを1回で検索できる。また、この場合にHash tableを作成するのに必要なメモリ容量は高々300KByte程度である。   On the other hand, as shown in the lower left side of FIG. 14, in the Hash method, the Hash value by the Hash function is calculated, and the entry is registered in the Hash table for each Hash value. At this time, if the source space is small like the Source port, if the equality function (y = x) is used as the Hash function, no matter what the state of the Hash table is, multiple entries have the same Hash It does not become a value (Hash value collision), and the desired entry can be searched at once. In this case, the memory capacity required to create the hash table is about 300 KBytes at most.

しかし、図14右側に示すように、5-tuple(416bit)のように元空間が大きい場合は(10の126乗の空間)、Hash関数として等号関数を用いると、Hash tableを作成するのに必要なメモリ容量は10の126乗byteになってしまう。このことから、Hash関数として等号関数を用いることはできず、圧縮関数を用いることになるため、Hash値の衝突が発生する。その結果、図14右側の例では、所望のentryを検索するのに最大で4回の検索が必要になる。   However, as shown on the right side of Fig. 14, when the original space is large, such as 5-tuple (416 bits) (10 126th space), using the equality function as the Hash function creates a Hash table. The required memory capacity is 10 126 bytes. For this reason, the equality function cannot be used as the Hash function, and the compression function is used, so that collision of Hash values occurs. As a result, in the example on the right side of FIG. 14, a maximum of four searches are required to search for a desired entry.

ただし、図15左側に示すように、5-tupleの場合でも、entry群の状態が固定である場合には、Hash値の衝突が少なくなるような、そのentry群に沿った(entry群から逆算した)Hash関数を用いれば、所望のentryの検索回数を1回に近づけることができる(最適なHush関数を選択できたときには、図15左側のように1回の検索にできる可能性がある)。   However, as shown on the left side of FIG. 15, even in the case of 5-tuple, when the state of the entry group is fixed, it follows the entry group that reduces the collision of the Hash value (back calculation from the entry group). If the Hash function is used, the number of searches for the desired entry can be made close to 1 (if the optimal Hush function can be selected, there is a possibility that it can be searched once as shown in the left side of FIG. 15) .

しかし、図15右側に示すように、Pinhole制御用のHash tableのように、entry群の状態が変わる場合には、単一のHash関数を用いた場合、entry群の状態に因っては、Hash値の衝突が発生し、Hash法の効果が落ちるという問題が生じる(図15右側の例では、所望のentryを検索するのに、最大で4回の検索が必要になる)。   However, as shown on the right side of FIG. 15, when the state of the entry group changes as in the Hash table for Pinhole control, when a single Hash function is used, depending on the state of the entry group, There is a problem that Hash value collision occurs and the effect of the Hash method is reduced (in the example on the right side of FIG. 15, a maximum of four searches are required to search for a desired entry).

Pinhole制御用のHash tableのように、entry群が常に変動する場合の衝突回避策として、図16に示すように、予め複数のHash関数を用意しておき(図16の例では16個)、entry群の状態変更に対応して最適なHash関数を選定する方式(以下、本明細書では、この方式をマルチHash方式と称す)がある。   As a Hash table for Pinhole control, as a collision avoidance measure when the entry group constantly fluctuates, as shown in FIG. 16, a plurality of Hash functions are prepared in advance (16 in the example of FIG. 16), There is a method for selecting an optimal Hash function corresponding to the state change of the entry group (hereinafter, this method is referred to as a multi-Hash method).

なお、マルチHash方式の最適Hash関数の選定アルゴリズムとしては、例えば、図17に示すように、入力パケットがHash値を基に検索を行う際に、並んでいるentry数の平均値(図17の例では、Hash値が2のときの1、30000のときの4、65535のときの1、を平均した2)が最小となるHash関数を選定する「平均値」に基づくアルゴリズムや、Hash値毎のentry数のMAX値(図17の例では、Hash値が30000のときの4)が最小となるHash関数を選定する「MAX値」に基づくアルゴリズムがある。   As an algorithm for selecting the optimum Hash function of the multi-Hash method, for example, as shown in FIG. 17, when searching for input packets based on the Hash value, the average value of the number of entries that are arranged (in FIG. 17) In the example, an algorithm based on “average value” that selects the Hash function that minimizes 2) that averages 1 when the Hash value is 2, 4 when it is 30000, and 1 when it is 65535, and for each Hash value There is an algorithm based on “MAX value” that selects the Hash function that minimizes the MAX value of the number of entries (4 in the example of FIG. 17 when the Hash value is 30000).

図16の例では、後者の「MAX値」に基づくアルゴリズムを採用しており、entry群がG〜Lの場合、Hash値毎のentry数のMAX値が最小なのは、MAX値が1となるHash関数10であるため、Hash関数10を選定する。   In the example of FIG. 16, an algorithm based on the latter “MAX value” is adopted, and when the entry group is G to L, the MAX value of the number of entries for each Hash value is the smallest when the MAX value is 1. Since it is the function 10, the Hash function 10 is selected.

神明達哉、外5名、「経路表を用いたIPパケット受信処理」、電子情報通信学会論文誌 2002/8 Vol.J85−B No.8Tatsuya Shinmei, 5 others, “IP packet reception processing using routing table”, IEICE Transactions 2002/8 Vol. J85-B No. 8

しかしながら、マルチHash方式では、図18に示すように、最適なHash関数を選定するに際して、Hash tableへのentryの登録/削除要求があった場合(ステップS1)、Hash tableのtable面を凍結し(ステップS2)、最適なHash関数を選定してHash tableを再構築し(ステップS3)、table面を切り替えてから(ステップS4)、table面の凍結を解除する。   However, in the multi-Hash method, as shown in FIG. 18, when selecting an optimum Hash function, if there is a request to register / delete an entry in the Hash table (step S1), the table surface of the Hash table is frozen. (Step S2), an optimal Hash function is selected and the Hash table is reconstructed (Step S3), the table surface is switched (Step S4), and the freezing of the table surface is released.

そのため、Hash tableが凍結している間は、entryの登録/削除要求に対して対応することができず、待ち行列が発生してしまうという課題がある。   For this reason, while the Hash table is frozen, there is a problem that it is impossible to respond to the entry registration / deletion request and a queue is generated.

本発明の目的は、マルチHash方式を前提とし、最適なHash関数の選定時間を短くし、Hash tableを凍結する時間を短くすることができる技術を提供することにある。   An object of the present invention is to provide a technique capable of shortening the time for freezing the Hash table by shortening the selection time of the optimum Hash function on the premise of the multi-Hash method.

本発明のネットワーク機器は、
複数のハッシュ関数の中からハッシュ関数を選定するネットワーク機器であって、
ハッシュ値毎に、当該ハッシュ値の実データに関するエントリを登録するハッシュテーブルと、
前記複数のハッシュ関数の各々を用いて計算したハッシュ値毎に設定されたカウンタ値を登録するハッシュカウンタテーブルと、
前記ハッシュテーブル及び前記ハッシュカウンタテーブルの操作を行うテーブル操作部と、を有し、
前記テーブル操作部は、
前記エントリの登録/削除要求時毎に、前記複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリの前記ハッシュテーブルへの登録/削除の成否に応じて当該ハッシュ値の前記カウンタ値を増減し、前記複数のハッシュ関数毎に、前記ハッシュカウンタテーブルにおける前記カウンタ値の統計値を求め、
前記複数のハッシュ関数の各々の前記統計値に基づきハッシュ関数を選定し、選定したハッシュ関数を用いて、前記ハッシュテーブルに登録された全てのエントリのハッシュ値を計算し、計算したハッシュ値とエントリを前記ハッシュテーブルに展開する。
The network device of the present invention
A network device that selects a hash function from a plurality of hash functions,
For each hash value, a hash table that registers entries related to the actual data of the hash value,
A hash counter table for registering a counter value set for each hash value calculated using each of the plurality of hash functions;
A table operation unit for operating the hash table and the hash counter table,
The table operating unit is
For each entry registration / deletion request, the hash value of the entry is calculated using each of the plurality of hash functions, and the hash value of the entry is determined according to the success / failure of registration / deletion of the entry in the hash table. Increase or decrease the counter value, and for each of the plurality of hash functions, obtain a statistical value of the counter value in the hash counter table,
A hash function is selected based on the statistical value of each of the plurality of hash functions, the hash value of all entries registered in the hash table is calculated using the selected hash function, and the calculated hash value and entry are calculated. In the hash table.

本発明のハッシュ関数選定方法は、
ネットワーク機器において、複数のハッシュ関数の中からハッシュ関数を選定するためのハッシュ関数選定方法であって、
前記ネットワーク機器は、
ハッシュ値毎に、当該ハッシュ値の実データに関するエントリを登録するハッシュテーブルと、
前記複数のハッシュ関数の各々を用いて計算したハッシュ値毎に設定されたカウンタ値を登録するハッシュカウンタテーブルと、を有するものであり、
前記エントリの登録/削除要求時毎に、前記複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリの前記ハッシュテーブルへの登録/削除の成否に応じて当該ハッシュ値の前記カウンタ値を増減し、前記複数のハッシュ関数毎に、前記ハッシュカウンタテーブルにおける前記カウンタ値の統計値を求め、
前記複数のハッシュ関数の各々の前記統計値に基づきハッシュ関数を選定し、選定したハッシュ関数を用いて、前記ハッシュテーブルに登録された全てのエントリのハッシュ値を計算し、計算したハッシュ値とエントリを前記ハッシュテーブルに展開する。
The hash function selection method of the present invention is:
A hash function selection method for selecting a hash function from a plurality of hash functions in a network device,
The network device is:
For each hash value, a hash table that registers entries related to the actual data of the hash value,
A hash counter table for registering a counter value set for each hash value calculated using each of the plurality of hash functions,
For each entry registration / deletion request, the hash value of the entry is calculated using each of the plurality of hash functions, and the hash value of the entry is determined according to the success / failure of registration / deletion of the entry in the hash table. Increase or decrease the counter value, and for each of the plurality of hash functions, obtain a statistical value of the counter value in the hash counter table,
A hash function is selected based on the statistical value of each of the plurality of hash functions, the hash value of all entries registered in the hash table is calculated using the selected hash function, and the calculated hash value and entry are calculated. In the hash table.

本発明によれば、ハッシュ関数の選定時には、複数のハッシュ関数の各々のカウンタ値の統計値(平均値やMAX値)を検索すれば良いため、選定時間を短くすることができ、ハッシュテーブルを凍結する時間を短くすることができるという効果が得られる。   According to the present invention, when selecting a hash function, it is only necessary to search a statistical value (average value or MAX value) of each counter value of a plurality of hash functions, so that the selection time can be shortened, and a hash table is stored. The effect that the time to freeze can be shortened is acquired.

本実施形態のネットワーク機器の構成を示すブロック図である。It is a block diagram which shows the structure of the network device of this embodiment. 本実施形態のHash関数等の前提条件を説明する図である。It is a figure explaining preconditions, such as a Hash function of this embodiment. 本実施形態のHash tableの面構成及び初期値を説明する図である。It is a figure explaining the surface structure and initial value of the Hash table of this embodiment. 本実施形態のHash tableの運用面にentryが登録されている状態を説明する図である。It is a figure explaining the state where entry is registered into the operation side of Hash table of this embodiment. 本実施形態のHash counter table及び初期値を説明する図である。It is a figure explaining the Hash counter table and initial value of this embodiment. 本実施形態のHash counter table変更処理を説明するフロー図である。It is a flowchart explaining the Hash counter table change process of this embodiment. 本実施形態のHash counter table及び初期値(平均値の場合)を説明する図である。It is a figure explaining the Hash counter table of this embodiment, and an initial value (in the case of an average value). 本実施形態のHash counter table及び初期値(MAX値の場合)を説明する図である。It is a figure explaining the Hash counter table of this embodiment, and an initial value (in the case of MAX value). 本実施形態のHash counter table変更処理(平均値の場合)を説明するフロー図である。It is a flowchart explaining the Hash counter table change process (in the case of an average value) of this embodiment. 本実施形態のHash counter table変更処理(MAX値の場合)を説明するフロー図である。It is a flowchart explaining the Hash counter table change process (in the case of MAX value) of this embodiment. 本実施形態のHash counter table(平均値の場合)を説明する図である。It is a figure explaining Hash counter table (in the case of an average value) of this embodiment. 本実施形態のHash counter table(MAX値の場合)を説明する図である。It is a figure explaining Hash counter table (in the case of MAX value) of this embodiment. 従来のネットワーク機器の構成を示すブロック図である。It is a block diagram which shows the structure of the conventional network device. Hash法とその課題を説明する図である。It is a figure explaining Hash method and its subject. Hash法の圧縮関数を用いた場合の課題を説明する図である。It is a figure explaining the subject at the time of using the compression function of Hash method. マルチHash方式を説明する図である。It is a figure explaining a multi-Hash system. マルチHash方式における最適Hash関数の選定アルゴリズムを説明する図である。It is a figure explaining the selection algorithm of the optimal Hash function in a multi-Hash system. マルチHash方式の課題を説明する図である。It is a figure explaining the subject of a multi-Hash system.

以下に、本発明を実施するための形態について図面を参照して説明する。   EMBODIMENT OF THE INVENTION Below, the form for implementing this invention is demonstrated with reference to drawings.

図1に示すように、本実施形態のネットワーク機器は、テーブル14として利用するHash関数の種類を示すHash関数IDをもつHash table(ハッシュテーブル)16を設けた点と、Hash counter table(ハッシュカウンタテーブル)17を追加した点と、が図13に示したネットワーク機器とは異なる。   As shown in FIG. 1, the network device according to the present embodiment is provided with a Hash table (hash table) 16 having a Hash function ID indicating the type of Hash function used as the table 14, and a Hash counter table (hash counter table). Table) 17 is different from the network device shown in FIG.

Hash table16は、Hash値毎に、当該Hash値の実データ(例えば、5-tupleの実データ)に関するentryを登録したテーブルである。   The Hash table 16 is a table in which entries related to actual data of the Hash value (for example, 5-tuple actual data) are registered for each Hash value.

Hash counter table17は、複数のHash関数の各々を用いて計算したHash値毎に設定されたcounter値を登録したテーブルである。   The Hash counter table 17 is a table in which counter values set for each Hash value calculated using each of a plurality of Hash functions are registered.

テーブル操作部15は、Hash table16に加えて、Hash counter table17の操作も行う。   The table operation unit 15 also operates the Hash counter table 17 in addition to the Hash table 16.

なお、Hash table16及びHash counter table17の詳細は後述する。   Details of the Hash table 16 and the Hash counter table 17 will be described later.

以下、本実施形態のネットワーク機器の具体的な処理について説明する。
(1)処理1
本実施形態では、図2に示すように、5-tuple(source address(L3)、destination address(L3)、source port(L4)、destination port(L4)、protcol(L3))の計13byteにてpinhole制御を行う際に、下記に示す2 byte(0〜65535)のHash関数を用いた高速検索を行うものとする。
Hereinafter, specific processing of the network device according to the present embodiment will be described.
(1) Processing 1
In this embodiment, as shown in FIG. 2, 5-tuple (source address (L3), destination address (L3), source port (L4), destination port (L4), protocol (L3))) is 13 bytes in total. When performing pinhole control, high-speed search using the 2-byte (0 to 65535) Hash function shown below shall be performed.

また、rotation bitを0bit〜15bitとした16個のHash関数を定義し(その数字をそのまま関数IDとする)、これら16個のHash関数の中から、逐次最適なHash関数を選定することを考える。図2の(1)〜(3)では、rotation bitを4 bitとし、#1のデータのHash値を求めるHash関数の例を示している。すなわち、(1)上位4bitをローテーションして下位に移動し、(2)これに#1のデータを加算する。(3)(2)時に17bit目に繰り上がりが生じた場合には1を加算する。これを#1〜#13のデータで13回繰り返す。
(2)処理2
図3に、Pinhole制御を行うためのHash table16の面構成及び初期値を示す。Hash table16は2面から成り適宜片方が運用面となる。初期は0面を運用面とする。
Also, define 16 Hash functions with rotation bits of 0 to 15 bits (the numbers are used as function IDs as they are), and consider selecting the optimal Hash function sequentially from these 16 Hash functions. . (1) to (3) in FIG. 2 show an example of a Hash function for setting the rotation bit to 4 bits and obtaining the Hash value of the data of # 1. That is, (1) the upper 4 bits are rotated and moved to the lower order, and (2) the data of # 1 is added to this. (3) If a carry occurs in the 17th bit at (2), add 1 to it. This is repeated 13 times with the data of # 1 to # 13.
(2) Processing 2
FIG. 3 shows the surface configuration and initial values of the Hash table 16 for performing pinhole control. Hash table 16 consists of two sides, one of which is the operational side as appropriate. Initially, the zero side is the operational side.

Table変更処理を行うテーブル操作部15は、entry登録/削除要求された5-tupleの実データに対して、運用面のHash関数ID部に埋められたHash関数を用いてHash値を計算し、図4に示すように、当該Hash値をindexとする部分chain構造でentryの追加/削除を行う。なお、entryは、Hash値の実データのメモリ上の位置を示すメモリ位置情報になっている。   The table operation unit 15 that performs the table change process calculates the Hash value for the 5-tuple actual data requested for entry registration / deletion by using the Hash function embedded in the Hash function ID portion on the operation side, As shown in FIG. 4, the entry is added / deleted in a partial chain structure with the Hash value as an index. The entry is memory location information indicating the location on the memory of the actual data of the Hash value.

Table検索処理を行うパケット処理部12は、運用面のHash関数ID部に埋められたHash関数を用いてHash値を計算し、当該Hash値をindexとする部分のentryを検索し、自身の情報と一致するものがあった場合には、throughし、無ければ、dropする。
(3)処理3
図5に、Hash counter table17の構成及び初期値を示す。
The packet processing unit 12 that performs the table search processing calculates the Hash value using the Hash function embedded in the Hash function ID portion of the operation side, searches the entry with the Hash value as an index, and searches for its own information. If there is a match, drop through, otherwise drop.
(3) Processing 3
FIG. 5 shows the configuration and initial values of the Hash counter table 17.

図5に示すように、Hash counter table17の初期値は全て0とする。   As shown in FIG. 5, the initial values of the Hash counter table 17 are all 0.

図6に、Hash counter table17の変更処理の具体的なフローを示す。   FIG. 6 shows a specific flow of change processing of the Hash counter table 17.

テーブル操作部15は、entry登録/削除要求時毎に、0〜15のHash関数毎のHash値を計算する(ステップS101)。entry登録要求時には(ステップS102)、登録対象のentryがHash table16に存在しない場合は(ステップS105のNo)、entry登録に成功するため(ステップS106)、当該Hash値のcounter値を入手し(ステップS107)、当該counter値を+1する(ステップS109)。一方、entry削除要求時には(ステップS102)、削除対象のentryがHash table16に存在した場合は(ステップS103のYes)、entry削除に成功するため(ステップS104)、当該Hash値のcounter値を入手し(ステップS107)、当該counter値を-1する(ステップS108)。   The table operation unit 15 calculates a Hash value for each Hash function from 0 to 15 every time an entry registration / deletion request is made (step S101). At the time of entry registration request (step S102), if the entry to be registered does not exist in the Hash table 16 (No in step S105), in order to successfully register the entry (step S106), the counter value of the Hash value is obtained (step S106). S107), the counter value is incremented by 1 (step S109). On the other hand, when an entry deletion request is made (step S102), if the entry to be deleted exists in the Hash table 16 (Yes in step S103), in order to delete the entry successfully (step S104), the counter value of the Hash value is obtained. (Step S107), the counter value is decremented by -1 (Step S108).

なお、図6において、点線で囲んだ部分が本実施形態でentry登録/削除要求時に追加される処理になる。
(4)処理4
マルチHash方式の最適Hash関数の選定アルゴリズムとしては、例えば、図17に示したように、「平均値」に基づくアルゴリズムや、「MAX値」に基づくアルゴリズムがある。
In FIG. 6, the portion surrounded by a dotted line is a process added when entry registration / deletion is requested in this embodiment.
(4) Processing 4
As an algorithm for selecting an optimal Hash function of the multi-Hash method, for example, as shown in FIG. 17, there are an algorithm based on “average value” and an algorithm based on “MAX value”.

本実施形態では、上記の2つのアルゴリズムを対象とし、それぞれの場合に、処理3に追加して以下の処理を行う。
(A)「平均値」に基づくアルゴリズムの場合
平均=全entry数/(counter値が0でないHash値の数)であり、全entry数はHash関数毎に同一であることから、「平均が最小」と「counter値が0であるHash値の数が最小」は同値条件になる。そこで、図7に示すように、Hash counter table17に「 0 entryのHash値の数」欄を設け、初期値は65536とする。処理3でのcounter変更時に、0→1及び1→0に着目し、「 0 entryのHash値の数」の変更を試みる。
(B)「MAX値」に基づくアルゴリズムの場合
図8に示すように、Hash counter table17に「MAX値」の欄と、counter値がMAX値を取るHash値の数である「MAX数」の欄を設け、「MAX数」の初期値は0とする。処理3でのcounter変更時に、全Hash値のcounter値を検索することなく、「MAX値」の変更を試みる。
(5)処理5
図9に、「平均値」に基づくアルゴリズムの場合のHash counter table17の変更処理の具体的なフローを示す。
In the present embodiment, the above two algorithms are targeted, and in each case, the following processing is performed in addition to the processing 3.
(A) In the case of an algorithm based on “average value” Average = total number of entries / (number of Hash values whose counter value is not 0), and since all entry numbers are the same for each Hash function, “average is minimum "And" the minimum number of Hash values with a counter value of 0 "are equivalent conditions. Therefore, as shown in FIG. 7, a column “number of Hash values of 0 entry” is provided in the Hash counter table 17, and the initial value is 65536. At the time of changing the counter in process 3, pay attention to 0 → 1 and 1 → 0, and try to change the “number of 0 entry hash values”.
(B) In the case of an algorithm based on “MAX value” As shown in FIG. 8, the “MAX value” field in the Hash counter table 17 and the “MAX number” field, which is the number of Hash values in which the counter value takes the MAX value. And the initial value of “MAX number” is 0. At the time of changing the counter in process 3, it tries to change the "MAX value" without searching the counter values of all the Hash values.
(5) Processing 5
FIG. 9 shows a specific flow of the changing process of the Hash counter table 17 in the case of the algorithm based on the “average value”.

図9に示すように、まず、テーブル操作部15は、図6のステップS101〜S106までの処理を行い、続いて、当該Hash値のcounter値を入手する(ステップS201)。   As shown in FIG. 9, first, the table operation unit 15 performs the processing from steps S101 to S106 in FIG. 6, and then obtains the counter value of the Hash value (step S201).

entry削除要求時には、テーブル操作部15は、ステップS201で入手したcounter値が1であれば(ステップS202のYes)、「counter値が0であるHash値の数」を+1し(ステップS203)、その後に、ステップS201で入手したcounter値を-1する(ステップS204)。   At the time of entry deletion request, if the counter value obtained in step S201 is 1 (Yes in step S202), the table operation unit 15 increments “the number of Hash values whose counter value is 0” by 1 (step S203). Thereafter, the counter value obtained in step S201 is decremented by -1 (step S204).

一方、entry登録要求時には、テーブル操作部15は、ステップS201で入手したcounter値が0であれば(ステップS205のYes)、「counter値が0であるHash値の数」を-1し(ステップS206)、その後に、ステップS201で入手したcounter値を+1する(ステップS207)。   On the other hand, when the entry registration request is made, if the counter value obtained in step S201 is 0 (Yes in step S205), the table operation unit 15 decrements “the number of Hash values whose counter value is 0” by −1 (step S205). After that, the counter value obtained in step S201 is incremented by 1 (step S207).

以上で、Hash関数毎の「counter値が0であるHash値の数」が得られる。なお、図9において、点線で囲んだ部分が本実施形態でentry登録/削除要求時に追加される処理になる。
(6)処理6
図10に、「MAX値」に基づくアルゴリズムの場合のHash counter table17の変更処理の具体的なフローを示す。
Thus, “the number of Hash values whose counter value is 0” for each Hash function is obtained. In FIG. 9, the portion surrounded by a dotted line is a process added when entry registration / deletion is requested in this embodiment.
(6) Processing 6
FIG. 10 shows a specific flow of change processing of the Hash counter table 17 in the case of the algorithm based on the “MAX value”.

図10に示すように、まず、テーブル操作部15は、図6のステップS101〜S106までの処理を行い、続いて、当該Hash値のcounter値を入手する(ステップS301)。   As shown in FIG. 10, first, the table operation unit 15 performs the processing from steps S101 to S106 in FIG. 6, and then obtains the counter value of the Hash value (step S301).

entry削除要求時には、テーブル操作部15は、ステップS301で入手したcounter値をMAX値と比較し(ステップS302)、一致すれば、MAX数を-1する(ステップS303)。-1したMAX数が0であれば(ステップS304のYes)、MAX値を-1し、MAX値を-1した値と同じcounter値を持つHash値の数をMAX数とする。その後に、ステップS301で入手したcounter値を-1する(ステップS306)。   At the time of entry deletion request, the table operation unit 15 compares the counter value obtained in step S301 with the MAX value (step S302), and if they match, decreases the MAX number by 1 (step S303). If the -1 decremented MAX number is 0 (Yes in step S304), the MAX value is decremented by 1, and the number of Hash values having the same counter value as the value obtained by decrementing the MAX value is decremented to be the MAX number. Thereafter, the counter value obtained in step S301 is decremented by 1 (step S306).

一方、entry登録要求時には、テーブル操作部15は、ステップS301で入手したcounter値をMAX値と比較する(ステップS307)。counter値が、MAX値を-1した値と等しい場合は、MAX数を+1し(ステップS308)、counter値がMAX値と等しい場合は、MAX値を+1し、MAX数を1にし(ステップS309)、その後に、ステップS301で入手したcounter値を+1する(ステップS310)。   On the other hand, at the time of entry registration request, the table operation unit 15 compares the counter value obtained in step S301 with the MAX value (step S307). If the counter value is equal to the value obtained by decrementing the MAX value by -1, the MAX number is incremented by 1 (step S308). If the counter value is equal to the MAX value, the MAX value is incremented by 1 and the MAX number is set to 1 ( Then, the counter value obtained in step S301 is incremented by 1 (step S310).

以上で、Hash関数毎の「MAX値」が得られる。なお、図10において、点線で囲んだ部分が本実施形態でentry登録/削除要求時に追加される処理になる。
(7)処理7
テーブル操作部15は、entry登録/削除要求時に、上述の処理2〜6を行い、一定時間(例として、100msec)経過したら、一旦、entry登録/削除要求をブロッキングし(ブロッキング中に発生したentry登録/削除要求はバッファリングする)、図3のHash table16の運用面を凍結する。その間に、テーブル操作部15は、以下のアルゴリズムで最適なHash関数を選定し、選定したHash関数の関数IDを図3の運用面とは別面のHash関数ID部に埋める。
(A)「平均値」に基づくアルゴリズムの場合
図11の場合は、「0 entryのHash値の数」が最小であるHash関数の関数IDは、関数ID1と関数ID2である。
Thus, the “MAX value” for each Hash function is obtained. In FIG. 10, the portion surrounded by a dotted line is a process added at the time of entry registration / deletion request in this embodiment.
(7) Processing 7
The table operation unit 15 performs the above processes 2 to 6 at the time of entry registration / deletion request, and once the fixed time (for example, 100 msec) elapses, it temporarily blocks the entry registration / deletion request (the entry occurred during blocking). Buffer the registration / deletion request), and freeze the operational aspect of Hash table 16 in FIG. Meanwhile, the table operation unit 15 selects an optimum Hash function using the following algorithm, and embeds the function ID of the selected Hash function in a Hash function ID unit that is different from the operation side of FIG.
(A) Case of Algorithm Based on “Average Value” In the case of FIG. 11, the function IDs of the Hash functions having the smallest “number of Hash values of 0 entry” are the function ID1 and the function ID2.

そのため、テーブル操作部15は、関数ID1または関数ID2のいずれか(図11の例では、関数ID1)を選定する。
(B)「MAX値」に基づくアルゴリズムの場合
図12の場合は、「MAX値」が最小であるHash関数の関数IDは、関数ID2である。
Therefore, the table operation unit 15 selects either function ID1 or function ID2 (function ID1 in the example of FIG. 11).
(B) Case of Algorithm Based on “MAX Value” In the case of FIG. 12, the function ID of the Hash function having the smallest “MAX value” is the function ID2.

そのため、テーブル操作部15は、関数ID2を選定する。   Therefore, the table operation unit 15 selects the function ID2.

テーブル操作部15は、上記にて埋められたHash関数を用いて、Hash table16の運用面の全entryを読み込んで、それぞれのentryについて、上記にて埋められたHash関数を用いてHash値を求め、別面のHash値の部分に図4のように、chain構造で連結していく(別面への書き込みは上書き、あるいは、一旦、全entryを削除してから上記処理を行う)。   The table operation unit 15 reads all the operational entries of the Hash table 16 using the Hash function filled above and obtains a Hash value for each entry using the Hash function filled above. Then, connect to the Hash value part on the other side with a chain structure as shown in Fig. 4 (write to the other side is overwritten, or once all entries are deleted, the above processing is performed).

上記の処理が終了したら、Hash table16の運用面を別面に切り替え、凍結を解除する(ブロッキング中であったentry登録/削除要求に対する処理は、切り替え先の面にて再スタートさせる)。   When the above processing is completed, the operation side of Hash table 16 is switched to another side, and freezing is released (processing for entry registration / deletion requests that were being blocked is restarted on the switching side).

上述したように本実施形態では、entry登録/削除要求時毎に、複数のHash関数の各々を用いてHash値を計算し、当該entry登録/削除の成否に応じて当該Hash値のcounter値を増減し、複数のHash関数毎に、複数のHash関数におけるcounter値の平均値やMAX値(統計値)を求める。   As described above, in this embodiment, for each entry registration / deletion request, a Hash value is calculated using each of the plurality of Hash functions, and the counter value of the Hash value is set according to the success or failure of the entry registration / deletion. Increase / decrease, and for each of the plurality of Hash functions, obtain an average value or MAX value (statistical value) of the counter values in the plurality of Hash functions.

そして、複数のHash関数におけるcounter値の平均値やMAX値に基づきHash関数を選定し、選定したHash関数を用いて、Hash table16に登録された全entryのHash値を計算し、計算したHash値とentryをHash table16に展開する。   Then, select a Hash function based on the average value or MAX value of counter values in multiple Hash functions, use the selected Hash function to calculate the Hash value of all entries registered in Hash table 16, and calculate the calculated Hash value And expand entry to Hash table16.

したがって、最適なHash関数の選定時には、複数のHash関数の各々のcounter値の平均値やMAX値を検索すれば良いため、選定時間を短くすることができ、Hash table16を凍結する時間を短くすることができるという効果が得られる。   Therefore, when selecting the optimal Hash function, it is only necessary to search the average value and MAX value of each counter value of multiple Hash functions, so the selection time can be shortened and the time for freezing the Hash table 16 can be shortened. The effect that it can be obtained.

なお、本実施形態では、上記動作により最適なHash関数の選定時間が短くなる一方で、entry登録/削除要求時に処理が追加されることになる(図6、図9、図10において、点線で囲んだ部分)。   In the present embodiment, while the selection time of the optimum Hash function is shortened by the above operation, processing is added at the time of entry registration / deletion request (in FIG. 6, FIG. 9, FIG. 10, a dotted line). Enclosed part).

しかし、例えば、図9の追加処理では、全entryの測定、平均の計算、全counter値の検索等が不要である。また、図10の追加処理では、全counter値の検索等が不要である。そのため、entry登録/削除要求時の処理負荷が大きく増大することが回避できる。   However, for example, the additional processing of FIG. 9 does not require measurement of all entries, calculation of an average, search of all counter values, and the like. Further, in the addition process of FIG. 10, it is not necessary to search all counter values. For this reason, it is possible to avoid a large increase in the processing load at the time of entry registration / deletion request.

11 パケット受信部
12 パケット処理部
13 パケット送信部
15 テーブル操作部
16 ハッシュテーブル
17 ハッシュカウンタテーブル
11 Packet receiver
12 Packet processor
13 Packet transmitter
15 Table operation section
16 Hash table
17 Hash counter table

Claims (5)

複数のハッシュ関数の中からハッシュ関数を選定するネットワーク機器であって、
ハッシュ値毎に、当該ハッシュ値の実データに関するエントリを登録するハッシュテーブルと、
前記複数のハッシュ関数の各々を用いて計算したハッシュ値毎に設定されたカウンタ値を登録するハッシュカウンタテーブルと、
前記ハッシュテーブル及び前記ハッシュカウンタテーブルの操作を行うテーブル操作部と、を有し、
前記テーブル操作部は、
前記エントリの登録/削除要求時毎に、前記複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリの前記ハッシュテーブルへの登録/削除の成否に応じて当該ハッシュ値の前記カウンタ値を増減し、前記複数のハッシュ関数毎に、前記ハッシュカウンタテーブルにおける前記カウンタ値の統計値を求め、
前記複数のハッシュ関数の各々の前記統計値に基づきハッシュ関数を選定し、選定したハッシュ関数を用いて、前記ハッシュテーブルに登録された全てのエントリのハッシュ値を計算し、計算したハッシュ値とエントリを前記ハッシュテーブルに展開する、
ネットワーク機器。
A network device that selects a hash function from a plurality of hash functions,
For each hash value, a hash table that registers entries related to the actual data of the hash value,
A hash counter table for registering a counter value set for each hash value calculated using each of the plurality of hash functions;
A table operation unit for operating the hash table and the hash counter table,
The table operating unit is
For each entry registration / deletion request, the hash value of the entry is calculated using each of the plurality of hash functions, and the hash value of the entry is determined according to the success / failure of registration / deletion of the entry in the hash table. Increase or decrease the counter value, and for each of the plurality of hash functions, obtain a statistical value of the counter value in the hash counter table,
A hash function is selected based on the statistical value of each of the plurality of hash functions, the hash value of all entries registered in the hash table is calculated using the selected hash function, and the calculated hash value and entry are calculated. To the hash table,
Network equipment.
前記テーブル操作部は、
前記エントリの登録要求時毎に、前記複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリの前記ハッシュテーブルへの登録が成功した場合、当該ハッシュ値の前記カウンタ値を増加させ、
前記エントリの削除要求時毎に、前記複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリの前記ハッシュテーブルからの削除が成功した場合、当該ハッシュ値の前記カウンタ値を減少させる、
請求項1に記載のネットワーク機器。
The table operating unit is
When each entry registration request is made, the hash value of the entry is calculated using each of the plurality of hash functions, and when the entry is successfully registered in the hash table, the counter value of the hash value is calculated. Increase,
For each entry deletion request, the hash value of the entry is calculated using each of the plurality of hash functions, and when the entry is successfully deleted from the hash table, the counter value of the hash value is calculated. Decrease,
The network device according to claim 1.
前記複数のハッシュ関数毎の前記統計値は、当該ハッシュ関数を用いて計算したハッシュ値のうち前記カウンタ値が0であるハッシュ値の数であり、
前記テーブル操作部は、
前記ハッシュ関数を用いて計算したハッシュ値の前記カウンタ値に応じて、前記カウンタ値が0であるハッシュ値の数を増減する、
請求項1または2に記載のネットワーク機器。
The statistical value for each of the plurality of hash functions is the number of hash values whose counter value is 0 among hash values calculated using the hash function,
The table operating unit is
In accordance with the counter value of the hash value calculated using the hash function, the number of hash values whose counter value is 0 is increased or decreased.
The network device according to claim 1 or 2.
前記複数のハッシュ関数毎の前記統計値は、当該ハッシュ関数を用いて計算したハッシュ値のうち前記カウンタ値が最大値を取るハッシュ値の数であり、
前記テーブル操作部は、
前記ハッシュ関数を用いて計算したハッシュ値の前記カウンタ値を、その時点のカウンタ値の最大値と比較し、その比較結果に応じて、前記カウンタ値が最大値を取るハッシュ値の数を増減する、
請求項1または2に記載のネットワーク機器。
The statistical value for each of the plurality of hash functions is the number of hash values for which the counter value takes the maximum value among hash values calculated using the hash function,
The table operating unit is
The counter value of the hash value calculated using the hash function is compared with the maximum value of the counter value at that time, and the number of hash values at which the counter value takes the maximum value is increased or decreased according to the comparison result. ,
The network device according to claim 1 or 2.
ネットワーク機器において、複数のハッシュ関数の中からハッシュ関数を選定するためのハッシュ関数選定方法であって、
前記ネットワーク機器は、
ハッシュ値毎に、当該ハッシュ値の実データに関するエントリを登録するハッシュテーブルと、
前記複数のハッシュ関数の各々を用いて計算したハッシュ値毎に設定されたカウンタ値を登録するハッシュカウンタテーブルと、を有するものであり、
前記エントリの登録/削除要求時毎に、前記複数のハッシュ関数の各々を用いて当該エントリのハッシュ値を計算し、当該エントリの前記ハッシュテーブルへの登録/削除の成否に応じて当該ハッシュ値の前記カウンタ値を増減し、前記複数のハッシュ関数毎に、前記ハッシュカウンタテーブルにおける前記カウンタ値の統計値を求め、
前記複数のハッシュ関数の各々の前記統計値に基づきハッシュ関数を選定し、選定したハッシュ関数を用いて、前記ハッシュテーブルに登録された全てのエントリのハッシュ値を計算し、計算したハッシュ値とエントリを前記ハッシュテーブルに展開する、
ハッシュ関数選定方法。
A hash function selection method for selecting a hash function from a plurality of hash functions in a network device,
The network device is:
For each hash value, a hash table that registers entries related to the actual data of the hash value,
A hash counter table for registering a counter value set for each hash value calculated using each of the plurality of hash functions,
For each entry registration / deletion request, the hash value of the entry is calculated using each of the plurality of hash functions, and the hash value of the entry is determined according to the success / failure of registration / deletion of the entry in the hash table. Increase or decrease the counter value, and for each of the plurality of hash functions, obtain a statistical value of the counter value in the hash counter table,
A hash function is selected based on the statistical value of each of the plurality of hash functions, the hash value of all entries registered in the hash table is calculated using the selected hash function, and the calculated hash value and entry are calculated. To the hash table,
Hash function selection method.
JP2012117564A 2012-05-23 2012-05-23 Network apparatus and hash function selection method Pending JP2013247389A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012117564A JP2013247389A (en) 2012-05-23 2012-05-23 Network apparatus and hash function selection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012117564A JP2013247389A (en) 2012-05-23 2012-05-23 Network apparatus and hash function selection method

Publications (1)

Publication Number Publication Date
JP2013247389A true JP2013247389A (en) 2013-12-09

Family

ID=49846885

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012117564A Pending JP2013247389A (en) 2012-05-23 2012-05-23 Network apparatus and hash function selection method

Country Status (1)

Country Link
JP (1) JP2013247389A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021517414A (en) * 2018-03-26 2021-07-15 新華三技術有限公司New H3C Technologies Co., Ltd. Network address translation
US20230205736A1 (en) * 2021-12-24 2023-06-29 Vast Data Ltd. Finding similarities between files stored in a storage system
US12124588B2 (en) 2021-12-24 2024-10-22 Vast Data Ltd. Securing a storage system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021517414A (en) * 2018-03-26 2021-07-15 新華三技術有限公司New H3C Technologies Co., Ltd. Network address translation
US11201852B2 (en) 2018-03-26 2021-12-14 New H3C Technologies Co., Ltd. Network address translation
US20230205736A1 (en) * 2021-12-24 2023-06-29 Vast Data Ltd. Finding similarities between files stored in a storage system
US12124588B2 (en) 2021-12-24 2024-10-22 Vast Data Ltd. Securing a storage system

Similar Documents

Publication Publication Date Title
KR102301353B1 (en) Method for transmitting packet of node and content owner in content centric network
JP6004299B2 (en) Method and apparatus for matching flow tables and switch
CN109905480B (en) Probabilistic cache content placement method based on content centrality
CN110336891A (en) Data cached location mode, equipment, storage medium and device
JP2007066161A (en) Cash system
CN109617810B (en) Data transmission method and device
US8171163B2 (en) Method for tracking transmission status of data to entities such as peers in a network
CN105208059A (en) Content distribution method, content distribution terminal, server, and content distribution system
US20170005953A1 (en) Hierarchical Packet Buffer System
WO2016175768A1 (en) Map tables for hardware tables
US20200044956A1 (en) Data Transmission Method and Apparatus
JP2014502811A (en) Communication system and communication method
JP2013247389A (en) Network apparatus and hash function selection method
CN105207908B (en) A kind of message processing method and system
CN104579976B (en) The generation method and device of link-state protocol data packet
CN104869062B (en) A kind of data packet forwarding method and equipment
JP5782999B2 (en) Route determining device, node device, and route determining method
CN104954249B (en) A kind of message forwarding method, system and device
CN105553856A (en) Method and device for realizing link-state packet updating
CN1411215A (en) Pacing synchronizing method for rout selecting information in data exchange environmemt
JP2007221514A (en) Router device and route determination method for router device
CN109039896A (en) Method for routing and device suitable for Information Network
JP6266445B2 (en) Packet relay apparatus and packet relay method
KR102060907B1 (en) Method for sharing an FIB table in Named Data Networking and Named Data Network system
JP5588481B2 (en) Network device, network device control method, and network system

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20141031