CN106302178B - Route query method and device - Google Patents

Route query method and device Download PDF

Info

Publication number
CN106302178B
CN106302178B CN201510260256.0A CN201510260256A CN106302178B CN 106302178 B CN106302178 B CN 106302178B CN 201510260256 A CN201510260256 A CN 201510260256A CN 106302178 B CN106302178 B CN 106302178B
Authority
CN
China
Prior art keywords
routing
storage structure
level tree
routing table
cluster
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.)
Active
Application number
CN201510260256.0A
Other languages
Chinese (zh)
Other versions
CN106302178A (en
Inventor
严敏
王涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE 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 ZTE Corp filed Critical ZTE Corp
Priority to CN201510260256.0A priority Critical patent/CN106302178B/en
Priority to PCT/CN2015/095448 priority patent/WO2016184069A1/en
Publication of CN106302178A publication Critical patent/CN106302178A/en
Application granted granted Critical
Publication of CN106302178B publication Critical patent/CN106302178B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery

Abstract

The invention discloses a route query method and a device, based on a pre-established two-stage tree-shaped storage structure, a first route cluster associated with a route table item to be queried is searched in a first-stage tree-shaped storage structure, then first route equipment associated with the route table item to be queried is searched under the first route cluster, then the route table item to be queried is searched under the first route equipment, and the query structure is returned, wherein the first route equipment is a leaf node in the first-stage tree-shaped storage structure and a root node in a second-stage tree-shaped storage structure. Therefore, the query structure of the route table entry to be queried can be obtained only by three searching processes, and the query speed of the route is greatly improved.

Description

Route query method and device
Technical Field
The present invention relates to the field of route optimization, and in particular, to a route query method and apparatus.
Background
The packet forwarding capability of the high-speed router at least reaches more than 20Mpps, and the number of supported forwarding routes is at least more than 25 ten thousand. Under the condition that a single router cannot be continuously expanded to adapt to the requirement, the clustering technology is developed. The cluster system can work cooperatively between the single routers, greatly expands the capacity of the routers, and simplifies and clears the network topology and routing strategy because the cluster router only represents one router to the outside. However, the router cluster system has more related equipment individuals, and when the system runs at full load, the router query speed is exchanged among a plurality of routers while high reliability and high stability are ensured, so that the router cluster system plays a vital role in the performance of high-speed routers.
After learning a certain routing table entry, the switching device stores the routing table into a software layer routing table for the CPU to perform soft forwarding, and then issues the routing table to a hardware layer routing table in the forwarding chip for implementing hardware layer forwarding. When a certain routing table entry needs to be updated or deleted, the CPU needs to first query the routing table entry from the software layer routing table, then update or delete the routing table entry, and finally update or delete the hardware layer routing table in the forwarding chip. Therefore, the query efficiency of the software layer routing table entry directly affects the progress of the routing table entry issued to the hardware layer, thereby affecting the progress of message hardware layer forwarding. The efficiency of querying the software layer routing table entry generally depends on the storage manner of the routing table entry. The cluster system routing table storage mode has more obvious influence on the routing query efficiency.
Most of the existing IP routing storage modes are based on tree forms, a public network and each VPN respectively occupy a tree, and an IP address prefix is used as a tree node. For an IP address prefix with a maximum length of 32 bits, the depth of the tree is 32 layers, and then when a routing table entry is searched by sequentially traversing each layer from a root node of the tree by using an IP address, a target node corresponding to the routing table entry to be searched can be found only by searching 32 times at most, so that the query efficiency is low.
Disclosure of Invention
In order to solve the technical problems, the invention provides a route query method and a device, which solve the problems of low route query speed and low query efficiency in the prior art.
According to an aspect of the present invention, there is provided a route query method, including:
according to the routing table entry to be inquired, in a first-level tree-shaped storage structure formed by a plurality of routing devices under a single routing cluster, searching a root node associated with the routing table entry to be inquired to obtain a first routing cluster; the routing cluster is a root node of a first-level tree-shaped storage structure, and the routing equipment is a leaf node of the first-level tree-shaped storage structure;
in a second-level tree storage structure formed by a plurality of routing table items under a single routing device, searching a root node associated with the routing table item to be inquired to obtain a first routing device; the leaf nodes of the first-level tree-shaped storage structure are root nodes of the second-level tree-shaped storage structure, and the routing table entries are leaf nodes of the second-level tree-shaped storage structure;
and searching leaf nodes which are the same as the routing table items to be inquired under the root nodes of the second-level tree-shaped storage structure, and returning the inquiry result.
Further, according to the route table entry to be queried, in a first-level tree storage structure formed by a plurality of routing devices under a single route cluster, a root node associated with the route table entry to be queried is searched, and the step of obtaining the first route cluster includes:
in the first-level tree storage structure, taking a routing table item to be queried as a keyword, and calculating according to a first preset hash function to obtain a first hash address; the first hash address stores a routing cluster associated with a routing table entry to be queried;
and reading a corresponding candidate route cluster from the first hash address, and taking the candidate route cluster as the first route cluster if the candidate route cluster comprises a route table item to be inquired.
Further, in a second-level tree storage structure formed by a plurality of routing table entries in a single routing device, the step of searching a root node associated with a routing table entry to be queried to obtain a first routing device includes:
in the second-level tree-shaped storage structure, taking a routing table item to be queried as a keyword, and calculating according to a second preset hash function to obtain a second hash address; the second hash address stores routing equipment associated with a routing table entry to be queried;
and reading corresponding candidate routing equipment from the second hash address, and taking the candidate routing equipment as the first routing equipment if the candidate routing equipment comprises a routing table entry to be inquired.
Further, the steps of searching the leaf node which is the same as the route table entry to be inquired under the root node of the second-level tree-shaped storage structure and returning to the inquiry structure include:
in a second-level tree-shaped storage structure with the first routing equipment as a root node, taking a routing table item to be inquired as a keyword, and calculating according to a third preset hash function to obtain a third hash address; all routing table entries of the first routing equipment are stored in the third hash address;
reading a corresponding candidate routing table entry in the third hash address, and if the candidate routing table entry is a routing table entry to be inquired, successfully searching; otherwise, traversing the linear linked list to search the route list item to be inquired.
Further, before the step of searching a root node associated with the route entry to be queried in a first-level tree storage structure formed by a plurality of routing devices under a single route cluster according to the route entry to be queried to obtain the first route cluster, the method further includes:
acquiring a routing table item to be inquired, and judging whether the routing table item to be inquired is a preset frequent item or not; the preset frequent item is a routing table item with the occupancy rate higher than a preset threshold value;
if not, traversing the linear linked list to search the routing list items to be inquired;
if so, searching the first routing cluster in the first-level tree storage structure.
Further, before the step of searching a root node associated with the route entry to be queried in a first-level tree storage structure formed by a plurality of routing devices under a single route cluster according to the route entry to be queried to obtain the first route cluster, the method further includes:
acquiring frequent items in a plurality of routing devices under a single routing cluster, creating a first-level tree-shaped storage structure of the routing devices under the routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree-shaped storage structure;
according to a second preset hash function, a second-level tree-shaped storage structure of routing table items under the routing equipment corresponding to the frequent items is created, and the routing equipment is stored in leaf nodes in the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure;
and storing the routing table entry in a leaf node of the second-level tree-shaped storage structure according to a third preset hash function.
Further, according to a first preset hash function, a first-level tree storage structure of a plurality of routing devices under the routing cluster corresponding to the frequent items is created, and the step of storing the routing cluster in a root node in the first-level tree storage structure includes:
taking the frequent item as a keyword, calculating according to a first preset hash function to obtain a first hash address, and storing a corresponding routing cluster in the first hash address;
a plurality of first Hash addresses of different routing clusters are stored and constructed as a root node of a first-level tree storage structure.
Further, according to a second preset hash function, a second-level tree storage structure of the routing table entry under the routing device corresponding to the frequent entry is created, and the routing device is stored in a leaf node in the first-level tree storage structure or a root node of the second-level tree storage structure, including:
taking the frequent item as a keyword, calculating according to a second preset hash function to obtain a second hash address, and storing the corresponding routing equipment in the second hash address;
and a plurality of second hash addresses of different routing devices are stored and constructed as leaf nodes of the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure.
Further, the step of storing the routing table entry in the leaf node of the second-level tree storage structure according to a third preset hash function includes:
taking the routing table item as a keyword, calculating according to a third preset hash function to obtain a third hash address, and storing the corresponding routing table item in the third hash address;
and a plurality of third hash addresses storing different routing table entries are constructed as leaf nodes of a second-level tree storage structure.
Further, after the steps of creating a first-level tree storage structure of a plurality of routing devices in a routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree storage structure, the method further includes:
when a new route cluster is added, acquiring frequent items of the new route cluster;
and taking the frequent item as a keyword, calculating according to a first preset hash function to obtain a first hash address, storing the corresponding new routing cluster in the first hash address, and updating the root node of the first-level tree-shaped storage structure.
Further, after the steps of creating a first-level tree storage structure of a plurality of routing devices in a routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree storage structure, the method further includes:
and when the routing clusters are reduced, deleting the routing clusters in the corresponding first hash addresses, and updating the root nodes of the first-level tree storage structure.
Further, after the step of creating a second-level tree storage structure of the routing table entry under the routing device corresponding to the frequent entry according to a second preset hash function, and storing the routing device in the leaf node in the first-level tree storage structure or the root node in the second-level tree storage structure, the method further includes:
when a new routing device is added, acquiring frequent items of the new routing device;
and taking the frequent item as a keyword, calculating according to a second preset hash function to obtain a second hash address, storing the corresponding new routing equipment in the second new hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Further, after the steps of creating a second-level tree storage structure of the routing table entry under the routing device corresponding to the frequent entry according to a second preset hash function, and storing the routing device in the leaf node in the first-level tree storage structure or the root node of the second-level tree storage structure, the method further includes:
and when the routing equipment is reduced, deleting the routing equipment stored in the corresponding second hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Further, after the step of storing the routing table entry in the leaf node of the second-level tree-shaped storage structure according to the third preset hash function, the method further includes:
when a new routing table entry is added, acquiring a frequent entry of the new routing table entry;
and taking the frequent items as keywords, calculating according to a third preset hash function to obtain a third hash address, storing a corresponding new routing table item in the third hash address, and updating the leaf nodes of the second-level tree-shaped storage structure.
Further, after the step of storing the routing table entry in the leaf node of the second-level tree-shaped storage structure according to the third preset hash function, the method further includes:
and when the routing table entry is reduced, deleting the routing table entry stored in the corresponding third hash address, and updating the leaf node of the second-level tree-shaped storage structure.
According to another aspect of the present invention, there is also provided a route query apparatus, including:
the first searching module is used for searching a root node associated with the routing table item to be inquired in a first-level tree-shaped storage structure formed by a plurality of routing devices under a single routing cluster according to the routing table item to be inquired to obtain a first routing cluster; the routing cluster is a root node of a first-level tree-shaped storage structure, and the routing equipment is a leaf node of the first-level tree-shaped storage structure;
the second searching module is used for searching a root node associated with the routing table item to be inquired in a second-level tree-shaped storage structure formed by a plurality of routing table items under a single routing device to obtain a first routing device; the leaf nodes of the first-level tree-shaped storage structure are root nodes of the second-level tree-shaped storage structure, and the routing table entries are leaf nodes of the second-level tree-shaped storage structure;
and the third searching module is used for searching the leaf nodes which are the same as the routing table items to be searched under the root nodes of the second-level tree-shaped storage structure and returning the searching results.
Further, the first lookup module includes:
the first searching unit is used for taking a routing table item to be inquired as a keyword in the first-level tree-shaped storage structure and calculating according to a first preset hash function to obtain a first hash address; the first hash address stores a routing cluster associated with a routing table entry to be queried;
and the first reading unit is used for reading the corresponding candidate route cluster in the first hash address, and if the candidate route cluster comprises the route table item to be inquired, the candidate route cluster is used as the first route cluster.
Further, the second lookup module includes:
the second searching unit is used for taking a routing table item to be inquired as a keyword in the second-level tree-shaped storage structure and calculating according to a second preset hash function to obtain a second hash address; the second hash address stores routing equipment associated with a routing table entry to be queried;
and the second reading unit is used for reading the corresponding candidate routing equipment in the second hash address, and if the candidate routing equipment comprises the routing table entry to be inquired, the candidate routing equipment is taken as the first routing equipment.
Further, the third searching module comprises:
the third searching unit is used for taking a routing table item to be searched as a keyword in a second-level tree-shaped storage structure with the first routing equipment as a root node, and calculating according to a third preset hash function to obtain a third hash address; all routing table entries of the first routing equipment are stored in the third hash address;
a third reading unit, configured to read a corresponding candidate routing table entry in the third hash address, where if the candidate routing table entry is a routing table entry to be queried, the lookup is successful; otherwise, traversing the linear linked list to search the route list item to be inquired.
Further, the routing query apparatus further includes:
the judging module is used for acquiring a routing table item to be inquired and judging whether the routing table item to be inquired is a preset frequent item; the preset frequent item is a routing table item with the occupancy rate higher than a preset threshold value;
if not, traversing the linear linked list to search the routing list items to be inquired;
if so, searching the first routing cluster in the first-level tree storage structure.
Further, the routing query apparatus further includes:
the first creation module is used for acquiring frequent items in a plurality of routing devices in a single routing cluster, creating a first-level tree-shaped storage structure of the plurality of routing devices in the routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree-shaped storage structure;
the second creation module is used for creating a second-level tree-shaped storage structure of the routing table items under the routing equipment corresponding to the frequent items according to a second preset hash function, and storing the routing equipment in leaf nodes in the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure;
and the third creating module is used for storing the routing table entry into the leaf node of the second-level tree-shaped storage structure according to a third preset hash function.
Further, the first creating module includes:
the first calculation unit is used for calculating according to a first preset hash function by taking the frequent items as keywords to obtain a first hash address, and storing the corresponding routing cluster in the first hash address;
the first creating unit is used for constructing a plurality of first hash addresses storing different routing clusters as a root node of a first-level tree storage structure.
Further, the second creating module includes:
the second calculation unit is used for calculating according to a second preset hash function by taking the frequent items as keywords to obtain a second hash address, and storing the corresponding routing equipment in the second hash address;
and the second creating unit is used for constructing a plurality of second hash addresses storing different routing devices into leaf nodes of the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure.
Further, the third creating module includes:
the third calculation unit is used for calculating according to a third preset hash function by taking the routing table item as a keyword to obtain a third hash address, and storing the corresponding routing table item in the third hash address;
and the third creating unit is used for constructing a plurality of third hash addresses storing different routing table entries into leaf nodes of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
the first acquisition module is used for acquiring frequent items of the new routing cluster when the new routing cluster is added;
and the first updating module is used for calculating according to a first preset hash function by taking the frequent items as keywords to obtain a first hash address, storing the corresponding new routing cluster in the first hash address, and updating the root node of the first-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
and the second updating module is used for deleting the routing cluster in the corresponding first hash address and updating the root node of the first-level tree-shaped storage structure when the routing clusters are reduced.
Further, the routing query apparatus further includes:
the second acquisition module is used for acquiring frequent items of the new routing equipment when the new routing equipment is added;
and the third updating module is used for calculating according to a second preset hash function by taking the frequent items as keywords to obtain a second hash address, storing the corresponding new routing equipment in the second new hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
and the fourth updating module is used for deleting the routing equipment stored in the corresponding second hash address when the routing equipment is reduced, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
the third acquisition module is used for acquiring frequent items of the new routing table items when the new routing table items are added;
and the fifth updating module is used for calculating according to a third preset hash function by taking the frequent items as the keywords to obtain a third hash address, storing the corresponding new routing table item in the third hash address, and updating the leaf nodes of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
and the sixth updating module is used for deleting the routing table entry stored in the corresponding third hash address and updating the leaf node of the second-level tree-shaped storage structure when the routing table entry is reduced.
The embodiment of the invention has the beneficial effects that: a route query method and a device are based on a pre-established two-stage tree storage structure, a first route cluster associated with a route table item to be queried is searched in a first-stage tree storage structure, then first route equipment associated with the route table item to be queried is searched under the first route cluster, then the route table item to be queried is searched under the first route equipment, and the query structure is returned, wherein the first route equipment is a leaf node in the first-stage tree storage structure and a root node in a second-stage tree storage structure. Therefore, the query structure of the route table entry to be queried can be obtained only by three searching processes, and the query speed of the route is greatly improved.
Drawings
FIG. 1 is a flow chart diagram illustrating a route query method of the present invention;
FIG. 2 shows a schematic flow chart of step 10 in FIG. 1;
FIG. 3 shows a schematic flow chart of step 20 in FIG. 1;
FIG. 4 shows a schematic flow chart of step 30 in FIG. 1;
FIG. 5 is a schematic flow chart of FIG. 1 before step 10 is performed;
FIG. 6 is a flow chart illustrating creation of a tree storage structure according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of the routing query apparatus according to the present invention.
Wherein in the figure: 101. a first searching module 102, a second searching module 103 and a third searching module.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Examples
Under the condition that the network demand is increasing, the cluster concept is generally applied to various network topologies, and a routing cluster is introduced for expanding the capacity of a router, but because the routing cluster has more routing devices, the speed of routing query affects the overall performance, and for improving the query speed, as shown in fig. 1, an embodiment of the present invention provides a routing query method, which specifically includes the following steps:
step 10: according to the routing table entry to be queried, a root node associated with the routing table entry to be queried is searched in a first-level tree storage structure formed by a plurality of routing devices under a single routing cluster to obtain a first routing cluster.
The routing cluster forms a root node of the first-level tree-shaped storage structure, and the routing equipment forms a leaf node of the first-level tree-shaped storage structure. When a certain routing table entry needs to be queried, a routing cluster associated with the routing table entry needs to be found in the first-level tree storage structure.
Step 20: in a second-level tree storage structure formed by a plurality of routing table entries under a single routing device, a root node associated with the routing table entry to be queried is searched to obtain a first routing device.
The leaf nodes of the first-level tree-shaped storage structure are root nodes of the second-level tree-shaped storage structure, and the routing table entries are leaf nodes of the second-level tree-shaped storage structure; namely, the routing device is not only a leaf node of the first-level tree-shaped storage structure, but also a root node of the second-level tree-shaped storage structure. That is, each routing cluster forms a first-level tree-shaped storage structure, and each routing device forms a second-level tree-shaped storage structure, so that after the first routing cluster is found, the first routing device associated with the routing table entry to be queried can be found in the first routing cluster.
Step 30: and searching leaf nodes which are the same as the routing table items to be inquired under the root nodes of the second-level tree-shaped storage structure, and returning the inquiry result.
After the corresponding first routing device is found, the leaf node which is the same as the routing table entry to be queried is found in the first routing device, that is, whether the routing table entry to be queried exists in the first routing device is found, if so, the finding is successful, and if not, the finding is failed.
The routing query method in the embodiment of the invention is based on a pre-established two-stage tree-shaped storage structure, a first routing cluster associated with a routing table item to be queried is searched in a first-stage tree-shaped storage structure, then first routing equipment associated with the routing table item to be queried is searched under the first routing cluster, then the routing table item to be queried is searched under the first routing equipment, and the query structure is returned, wherein the first routing equipment is a leaf node in the first-stage tree-shaped storage structure and a root node in a second-stage tree-shaped storage structure. Therefore, the query structure of the route table entry to be queried can be obtained only by three searching processes, and the query speed of the route is greatly improved.
Further, the hash tree is simple in structure, fast in search speed and capable of conveniently replacing the hash algorithm, so that the hash tree is often used for storing key data. Wherein, the step 10 can be implemented by referring to the steps shown in fig. 2:
step 11: in the first-level tree storage structure, a routing table entry to be queried is used as a keyword, and calculation is performed according to a first preset hash function to obtain a first hash address.
Here, the first hash address stores a routing cluster associated with a routing table entry to be queried; taking the route table item to be inquired as a key word K, and substituting the K into the first level of establishmentFirst preset Hash function H adopted when root nodes of tree-shaped storage structure1Calculating a first hash address H1(K)。
Step 12: and reading a corresponding candidate route cluster from the first hash address, and taking the candidate route cluster as the first route cluster if the candidate route cluster comprises a route table item to be inquired.
Here, at the first hash address H1(K) And reading the corresponding candidate route cluster, judging whether the candidate route cluster has a route item to be inquired, and if so, taking the candidate route cluster as a first route cluster.
Further, the specific implementation manner of finding the first routing device in step 20 is similar to the specific implementation manner of finding the first routing cluster in step 10, and may be roughly implemented with reference to the steps shown in fig. 3:
step 21: and in the second-level tree-shaped storage structure, taking the routing table item to be inquired as a keyword, and calculating according to a second preset hash function to obtain a second hash address.
Here, the second hash address stores the routing device associated with the routing table entry to be queried; taking the route table item to be inquired as a key word K, and substituting the key word K into a second preset Hash function H adopted when a leaf node of the first-level tree-shaped storage structure or a root node of the second-level tree-shaped storage structure is established2Calculating a second hash address H2(K)。
Step 22: and reading corresponding candidate routing equipment from the second hash address, and taking the candidate routing equipment as the first routing equipment if the candidate routing equipment comprises a routing table entry to be inquired.
Here, at the second hash address H2(K) And determining whether the candidate routing device has a routing table entry to be queried, and if so, using the candidate routing device as the first routing device.
Further, step 30 may be implemented with specific reference to the steps shown in fig. 4:
step 31: in the second-level tree-shaped storage structure with the first routing equipment as a root node, the routing table entry to be inquired is used as a keyword, and calculation is performed according to a third preset hash function to obtain a third hash address.
Wherein, the third hash address stores all routing table items of the first routing device, takes the routing table item to be inquired as a key word K, and substitutes the K into a third preset hash function H adopted when creating the leaf node of the second-level tree-shaped storage structure3Calculating a third hash address H3(K)
Step 32: reading a corresponding candidate routing table entry in the third hash address, and if the candidate routing table entry is a routing table entry to be inquired, successfully searching; otherwise, traversing the linear linked list to search the route list item to be inquired.
Here, at the third hash address H3(K) Reading the corresponding routing table item, comparing the routing table item with the routing table item to be inquired, if the routing table item is equal to the routing table item to be inquired, successfully searching, and feeding back an inquiry structure; if the addresses are not equal to each other, the next address is searched according to a method for processing conflicts set when the tree-shaped storage structure is created, the search is stopped until the routing table entry stored in a certain address is found to be the same as the routing table entry to be searched or the certain address is found to be unoccupied.
Further, for the routing table entry with low use or search frequency, a linear linked list storage mode can also be adopted, preferably, frequent items for query or use can be stored in a tree-shaped storage structure to improve the query speed, and for infrequent items, the linear linked list storage mode is used to reduce the complexity of routing query. Based on the above, as shown in fig. 5, the route searching method according to the embodiment of the present invention may further include, before step 10:
step 01: and acquiring a routing table entry to be queried, and judging whether the routing table entry to be queried is a preset frequent entry.
For example, the preset threshold may be set to 0.001, so that when the entire routing system includes 10 ten thousand routing table entries, the number of times of occurrence of the routing table entry a is greater than or equal to 100, and then the routing table entry a is the frequent entry.
Step 02: if not, traversing the linear linked list to search the routing list items to be inquired; if so, searching the first routing cluster in the first-level tree storage structure.
Further, before step 10, a step of creating a tree storage structure as shown in fig. 6 is also included.
Step 0A: the method comprises the steps of obtaining frequent items in a plurality of routing devices under a single routing cluster, creating a first-level tree storage structure of the routing devices under the routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree storage structure.
Further, step 0A can be specifically implemented by referring to the following steps:
and taking the frequent items as keywords, calculating according to a first preset hash function to obtain a first hash address, and storing the corresponding routing cluster in the first hash address. Here, the first preset hash function is H1Every frequent item KiAre all substituted into a first preset hash function H1In (3), obtain a first hash address H1(Ki) And will include frequent item KiIs stored in a first hash address H1(Ki) In (1).
A plurality of first Hash addresses of different routing clusters are stored and constructed as a root node of a first-level tree storage structure.
Step 0B: and according to a second preset hash function, creating a second-level tree storage structure of the routing table items under the routing equipment corresponding to the frequent items, and storing the routing equipment in leaf nodes in the first-level tree storage structure or root nodes of the second-level tree storage structure.
Further, step 0B may be specifically implemented with reference to the following steps:
taking the frequent item as a keyword, and calculating according to a second preset hash function to obtain a second hash functionAnd two hash addresses, and storing the corresponding routing equipment in the second hash address. Here, the second preset hash function is H2Every frequent item KiAre all substituted into a second preset hash function H2In (3), obtain a second hash address H2(Ki) And will include frequent item KiIs stored in the second hash address H2(Ki) In (1).
And a plurality of second hash addresses of different routing devices are stored and constructed as leaf nodes of the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure.
Step 0C: and storing the routing table entry in a leaf node of the second-level tree-shaped storage structure according to a third preset hash function.
Further, step 0C may be specifically implemented with reference to the following steps:
and taking the routing table item as a keyword, calculating according to a third preset hash function to obtain a third hash address, and storing the corresponding routing table item in the third hash address. Here, the third preset hash function is H3Every frequent item KiAre all substituted into a third preset hash function H3To obtain a third hash address H3(Ki) And will include frequent item KiIs stored in the third hash address H3(Ki) In (1).
And a plurality of third hash addresses storing different routing table entries are constructed as leaf nodes of a second-level tree storage structure.
That is to say, the routing table entries of a single routing device are stored in a tree structure mode, the routing table entries serve as leaf nodes of the tree structure, and when a routing table entry K to be queried exists on a certain routing device, K needs to be substituted into a third preset hash function H adopted in tree building3Calculating a third hash address H3(K) And reading the routing table entry stored under the address, comparing the routing table entry with the routing table entry K to be inquired, if the routing table entry is equal to the routing table entry K to be inquired, inquiring successfully, and otherwise, traversing the linear linked list until the searching fails or succeeds.
Dividing a plurality of routing devices into a plurality of routing clusters, counting the support degree of each routing table item in each routing cluster, performing parallel calculation to obtain frequent items with the support degree higher than a preset threshold value, performing descending order on the support degree of the frequent items, grouping the routing devices according to the ordered frequent item list, and then, in the grouped groups, according to a routing table item K and according to a second preset hash function H2And calculating a second hash address, and storing the corresponding routing device in the second hash address, that is to say, a complete tree storage structure is formed in each routing cluster separately.
Regarding the routing cluster as a whole, a plurality of different routing clusters are processed by a preset first hash function H1Stored in a different first hash address.
Further, after the tree-shaped storage structure is built, when a frequent item, a routing device or a routing cluster changes, the tree-shaped storage structure changes, which relates to the update problem of the tree-shaped storage structure.
The first condition is as follows: when the frequent item changes, deleting the data stored in the first hash address, the second hash address and the third hash address under the mapping relation of the old frequent item, and adding the data stored in the first hash address, the second hash address and the third hash address under the mapping relation of the new frequent item, so as to realize the updating of the data in the tree-shaped storage structure. The method can be realized by the following steps:
1) calculating LΔ1=L1′-L1In the formula, L1' is the item set of the frequent item routing table item 1 of the original routing cluster under the new frequent item, L1Is a frequent 1-item set of the original cluster equipment route under the original threshold value;
2) judging the difference LΔ1If the set is an empty set, if yes, executing step 04), otherwise, executing step 03):
3) by the difference LΔ1Updating the first-level tree storage structure;
4) and the updated first-level tree-shaped storage structure is the same as the original first-level tree-shaped storage structure.
Step 3 can be specifically carried out in the following manner:
01) judging difference set LΔ1If the current set is an empty set, ending the process;
02) updating frequent item list L1′=L1∪LΔ1
03) List L of updated frequent items1' sorting in descending order;
04) executing nItem-L to any item t in the original cluster device route set1' ∩ t, extracting the route list item intersected with the frequent item list in the route list items to be inquired;
05) executing nNode-nItem ∩ LΔ1The route table item to be inquired in the route set appearing in the frequent list and the difference set LΔ1Intersecting to obtain a new nNode;
06) and inserting the new nNode into the address corresponding to the tree-shaped storage structure, and finishing the updating.
Case two: when the frequent item changes when a new routing cluster is added, the frequent item of the new routing cluster is obtained, the frequent item is used as a keyword, calculation is carried out according to a first preset hash function to obtain a first hash address, the corresponding new routing cluster is stored in the first hash address, and a root node of the first-stage tree-shaped storage structure is updated. First, calculate LΔ2=LDP1+LdP1-L1In the formula, LDP1Is an entry set, L, of routing entry 1 in the original routing cluster under new frequent entriesDP1Is the item set, L, of the routing table item 1 of the newly added routing cluster under the new frequent items1Is an item set of a routing table item 1 of an original routing cluster under an original frequent item; then by the difference LΔ2The routing cluster stored in the first hash address is updated.
Here, the frequent item may be changed due to the addition of the routing cluster, so that the frequent item needs to be acquired again, and the specific step of mining the frequent item may refer to the following description:
11) initializing k to 1;
12) order tok is k +1, adopts Apriori algorithm, and utilizes the newly-added routing cluster to make frequent item set L of item 1 of routing tableDP1Wherein, l is k-1, generating an item set c of the candidate frequent item routing table item k of the newly added routing setdkJudging the item set c of the candidate frequent item routing table item k of the newly added routing setdkIf the data is an empty set, the mining is finished if the data is the empty set;
13) execution of cΔk=cdk-LkCalculating the item set c of the candidate frequent item routing item k of the newly added routing setdkItem set L of original routing cluster frequent item routing item k under original frequent itemkThe difference, the judgment difference cΔkIf the current set is an empty set, if the current set is the empty set, executing the step 15), otherwise executing the step 14);
14) for the difference c obtained in step 3)ΔkCalculating the support number of each path through the updated tree-shaped storage structure for each item in the tree-shaped storage structure; by judging cΔkAnd whether the support number of the items in the list is not less than a new threshold value s' or not is judged, and an item set of a newly added frequent item routing list item k is obtained.
15) By judging cdkWhether the support number of the items in the cluster is not less than a new threshold value s' or not is judged, and an item set L of the frequent item routing table items k of the newly-added routing cluster is obtaineddP1
Case three: and when the routing clusters are reduced, deleting the routing clusters in the corresponding first hash addresses, and updating the root nodes of the first-level tree storage structure.
Case four: when a new routing device is added, acquiring frequent items of the new routing device;
and taking the frequent item as a keyword, calculating according to a second preset hash function to obtain a second hash address, storing the corresponding new routing equipment in the second new hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure. The specific implementation is similar to that of case two, and therefore, the detailed description is omitted here.
Case five: and when the routing equipment is reduced, deleting the routing equipment stored in the corresponding second hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Case six: when a new routing table entry is added, acquiring a frequent entry of the new routing table entry;
and taking the frequent items as keywords, calculating according to a third preset hash function to obtain a third hash address, storing a corresponding new routing table item in the third hash address, and updating the leaf nodes of the second-level tree-shaped storage structure.
Case seven: and when the routing table entry is reduced, deleting the routing table entry stored in the corresponding third hash address, and updating the leaf node of the second-level tree-shaped storage structure.
According to another aspect of the embodiments of the present invention, there is also provided a route query apparatus, as shown in fig. 7, including:
a first searching module 101, configured to search, according to a to-be-searched routing table entry, a root node associated with the to-be-searched routing table entry in a first-level tree storage structure formed by multiple routing devices in a single routing cluster, so as to obtain a first routing cluster; the routing cluster is a root node of a first-level tree-shaped storage structure, and the routing equipment is a leaf node of the first-level tree-shaped storage structure;
a second searching module 102, configured to search a root node associated with a routing table entry to be queried in a second-level tree storage structure formed by multiple routing table entries in a single routing device, so as to obtain a first routing device; the leaf nodes of the first-level tree-shaped storage structure are root nodes of the second-level tree-shaped storage structure, and the routing table entries are leaf nodes of the second-level tree-shaped storage structure;
and the third searching module 103 is configured to search a leaf node that is the same as the route entry to be queried under the root node of the second-level tree storage structure, and return a query result.
Further, the first lookup module 101 includes:
the first searching unit is used for taking a routing table item to be inquired as a keyword in the first-level tree-shaped storage structure and calculating according to a first preset hash function to obtain a first hash address; the first hash address stores a routing cluster associated with a routing table entry to be queried;
and the first reading unit is used for reading the corresponding candidate route cluster in the first hash address, and if the candidate route cluster comprises the route table item to be inquired, the candidate route cluster is used as the first route cluster.
Further, the second lookup module 102 includes:
the second searching unit is used for taking a routing table item to be inquired as a keyword in the second-level tree-shaped storage structure and calculating according to a second preset hash function to obtain a second hash address; the second hash address stores routing equipment associated with a routing table entry to be queried;
and the second reading unit is used for reading the corresponding candidate routing equipment in the second hash address, and if the candidate routing equipment comprises the routing table entry to be inquired, the candidate routing equipment is taken as the first routing equipment.
Further, the third searching module 103 includes:
the third searching unit is used for taking a routing table item to be searched as a keyword in a second-level tree-shaped storage structure with the first routing equipment as a root node, and calculating according to a third preset hash function to obtain a third hash address; all routing table entries of the first routing equipment are stored in the third hash address;
a third reading unit, configured to read a corresponding candidate routing table entry in the third hash address, where if the candidate routing table entry is a routing table entry to be queried, the lookup is successful; otherwise, traversing the linear linked list to search the route list item to be inquired.
Further, the routing query apparatus further includes:
the judging module is used for acquiring a routing table item to be inquired and judging whether the routing table item to be inquired is a preset frequent item; the preset frequent item is a routing table item with the occupancy rate higher than a preset threshold value;
if not, traversing the linear linked list to search the routing list items to be inquired;
if so, searching the first routing cluster in the first-level tree storage structure.
Further, the routing query apparatus further includes:
the first creation module is used for acquiring frequent items in a plurality of routing devices in a single routing cluster, creating a first-level tree-shaped storage structure of the plurality of routing devices in the routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree-shaped storage structure;
the second creation module is used for creating a second-level tree-shaped storage structure of the routing table items under the routing equipment corresponding to the frequent items according to a second preset hash function, and storing the routing equipment in leaf nodes in the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure;
and the third creating module is used for storing the routing table entry into the leaf node of the second-level tree-shaped storage structure according to a third preset hash function.
Further, the first creating module includes:
the first calculation unit is used for calculating according to a first preset hash function by taking the frequent items as keywords to obtain a first hash address, and storing the corresponding routing cluster in the first hash address;
the first creating unit is used for constructing a plurality of first hash addresses storing different routing clusters as a root node of a first-level tree storage structure.
Further, the second creating module includes:
the second calculation unit is used for calculating according to a second preset hash function by taking the frequent items as keywords to obtain a second hash address, and storing the corresponding routing equipment in the second hash address;
and the second creating unit is used for constructing a plurality of second hash addresses storing different routing devices into leaf nodes of the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure.
Further, the third creating module includes:
the third calculation unit is used for calculating according to a third preset hash function by taking the routing table item as a keyword to obtain a third hash address, and storing the corresponding routing table item in the third hash address;
and the third creating unit is used for constructing a plurality of third hash addresses storing different routing table entries into leaf nodes of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
the first acquisition module is used for acquiring frequent items of the new routing cluster when the new routing cluster is added;
and the first updating module is used for calculating according to a first preset hash function by taking the frequent items as keywords to obtain a first hash address, storing the corresponding new routing cluster in the first hash address, and updating the root node of the first-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
and the second updating module is used for deleting the routing clusters in the corresponding first hash addresses when the routing clusters are reduced, and updating the root nodes of the first-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
the second acquisition module is used for acquiring frequent items of the new routing equipment when the new routing equipment is added;
and the third updating module is used for calculating according to a second preset hash function by taking the frequent items as keywords to obtain a second hash address, storing the corresponding new routing equipment in the second new hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
and the fourth updating module is used for deleting the routing equipment stored in the corresponding second hash address when the routing equipment is reduced, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
the third acquisition module is used for acquiring frequent items of the new routing table items when the new routing table items are added;
and the fifth updating module is used for calculating according to a third preset hash function by taking the frequent items as the keywords to obtain a third hash address, storing the corresponding new routing table item in the third hash address, and updating the leaf nodes of the second-level tree-shaped storage structure.
Further, the routing query apparatus further includes:
and the sixth updating module is used for deleting the routing table entry stored in the corresponding third hash address and updating the leaf node of the second-level tree-shaped storage structure when the routing table entry is reduced.
It should be noted that the route query apparatus is an apparatus corresponding to the route query method, and all implementation manners in the method embodiments are applicable to the embodiment of the apparatus, and the same technical effect can be achieved.
While the preferred embodiments of the present invention have been described, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the following claims.

Claims (28)

1. A method for routing queries, comprising:
according to a routing table entry to be queried, searching a root node associated with the routing table entry to be queried in a first-level tree storage structure formed by a plurality of routing devices under a single routing cluster to obtain a first routing cluster; the routing cluster is a root node of the first-level tree-shaped storage structure, and the routing equipment is a leaf node of the first-level tree-shaped storage structure;
in a second-level tree storage structure formed by a plurality of routing table entries under a single routing device, searching a root node associated with the routing table entry to be inquired to obtain a first routing device; the leaf nodes of the first-level tree-shaped storage structure are root nodes of the second-level tree-shaped storage structure, and the routing table entries are leaf nodes of the second-level tree-shaped storage structure;
searching leaf nodes which are the same as the routing table items to be inquired under the root nodes of the second-level tree-shaped storage structure, and returning inquiry results;
before the step of searching a root node associated with a routing table entry to be queried in a first-level tree storage structure formed by a plurality of routing devices under a single routing cluster according to the routing table entry to be queried to obtain a first routing cluster, the method further comprises the following steps:
acquiring a routing table item to be inquired, and judging whether the routing table item to be inquired is a preset frequent item or not; the preset frequent item is a routing table item with the occupancy rate higher than a preset threshold value;
if not, traversing the linear linked list to search the routing list item to be inquired;
if yes, searching a first routing cluster in the first-level tree-shaped storage structure.
2. The routing query method of claim 1, wherein the step of finding, according to the routing table entry to be queried, a root node associated with the routing table entry to be queried in a first-level tree storage structure formed by a plurality of routing devices under a single routing cluster to obtain the first routing cluster comprises:
in the first-stage tree storage structure, taking the routing table entry to be queried as a keyword, and calculating according to a first preset hash function to obtain a first hash address; the first hash address stores a routing cluster associated with the routing table entry to be queried;
and reading a corresponding candidate routing cluster from the first hash address, and if the candidate routing cluster comprises the routing table item to be inquired, taking the candidate routing cluster as a first routing cluster.
3. The routing query method of claim 1, wherein the step of finding a root node associated with the routing entry to be queried in a second-level tree storage structure formed by a plurality of routing entries under a single routing device to obtain the first routing device comprises:
in the second-level tree-shaped storage structure, the routing table entry to be inquired is used as a keyword, and calculation is carried out according to a second preset hash function to obtain a second hash address; the second hash address stores the routing equipment associated with the routing table entry to be queried;
and reading corresponding candidate routing equipment in the second hash address, and if the candidate routing equipment comprises the routing table entry to be inquired, taking the candidate routing equipment as the first routing equipment.
4. The routing query method of claim 1, wherein the step of searching for a leaf node under the root node of the second-level tree storage structure that is the same as the routing table entry to be queried and returning to the query structure comprises:
in a second-level tree storage structure with the first routing equipment as a root node, taking the routing table item to be inquired as a keyword, and calculating according to a third preset hash function to obtain a third hash address; all routing table entries of the first routing device are stored in the third hash address;
reading a corresponding candidate routing table entry in the third hash address, and if the candidate routing table entry is the routing table entry to be queried, finding successfully; otherwise, traversing the linear linked list to search the routing list item to be inquired.
5. The route query method according to any one of claims 1 to 4, wherein before the step of searching, according to the route entry to be queried, a root node associated with the route entry to be queried in a first-level tree storage structure formed by a plurality of routing devices under a single route cluster to obtain a first route cluster, the method further comprises:
acquiring frequent items in a plurality of routing devices under a single routing cluster, creating a first-level tree-shaped storage structure of the routing devices under the routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree-shaped storage structure;
according to a second preset hash function, a second-level tree-shaped storage structure of the routing table items under the routing equipment corresponding to the frequent items is created, and the routing equipment is stored in leaf nodes in the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure;
and storing the routing table entry in a leaf node of the second-level tree-shaped storage structure according to a third preset hash function.
6. The routing query method according to claim 5, wherein the step of creating, according to a first preset hash function, a first-level tree storage structure of the plurality of routing devices in the routing cluster corresponding to the frequent item, and storing the routing cluster in a root node in the first-level tree storage structure includes:
calculating according to a first preset hash function by taking the frequent item as a keyword to obtain a first hash address, and storing a corresponding routing cluster in the first hash address;
a plurality of first Hash addresses of different routing clusters are stored and constructed as a root node of a first-level tree storage structure.
7. The routing query method according to claim 5, wherein the step of creating, according to a second preset hash function, a second-level tree storage structure of the routing table entry under the routing device corresponding to the frequent item, and storing the routing device in a leaf node in the first-level tree storage structure or a root node in the second-level tree storage structure includes:
calculating according to a second preset hash function by taking the frequent item as a keyword to obtain a second hash address, and storing the corresponding routing equipment in the second hash address;
and a plurality of second hash addresses of different routing devices are stored and constructed as leaf nodes of the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure.
8. The routing query method according to claim 5, wherein the step of storing the routing table entry in the leaf node of the second-level tree storage structure according to a third predetermined hash function comprises:
taking a routing table item as a keyword, calculating according to a third preset hash function to obtain a third hash address, and storing a corresponding routing table item in the third hash address;
and a plurality of third hash addresses storing different routing table entries are constructed as leaf nodes of a second-level tree storage structure.
9. The routing query method according to claim 6, wherein after the step of creating, according to a first preset hash function, a first-level tree storage structure of a plurality of routing devices in the routing cluster corresponding to the frequent item, and storing the routing cluster in a root node in the first-level tree storage structure, the method further includes:
when a new routing cluster is added, acquiring frequent items of the new routing cluster;
and calculating according to a first preset hash function by taking the frequent item as a keyword to obtain a first hash address, storing a corresponding new routing cluster in the first hash address, and updating the root node of the first-stage tree-shaped storage structure.
10. The routing query method according to claim 6, wherein after the step of creating a first-level tree storage structure of the plurality of routing devices in the routing cluster corresponding to the frequent item according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree storage structure, the method further includes:
and when the routing clusters are reduced, deleting the routing clusters in the corresponding first hash addresses, and updating the root nodes of the first-level tree storage structure.
11. The routing query method according to claim 7, wherein, after the step of creating, according to a second preset hash function, a second-level tree storage structure of the routing table entry under the routing device corresponding to the frequent entry, and storing the routing device in a leaf node in the first-level tree storage structure or a root node in the second-level tree storage structure, the method further includes:
when a new routing device is added, acquiring frequent items of the new routing device;
and calculating according to a second preset hash function by taking the frequent item as a keyword to obtain a second hash address, storing the corresponding new routing equipment in the second hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
12. The routing query method according to claim 7, after the steps of creating, according to a second preset hash function, a second-level tree storage structure of routing table entries under the routing device corresponding to the frequent entry, and storing the routing device in a leaf node in the first-level tree storage structure or a root node in the second-level tree storage structure, the method further includes:
and when the routing equipment is reduced, deleting the routing equipment stored in the corresponding second hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
13. The method according to claim 8, wherein after the step of storing the routing table entry in the leaf node of the second-level tree storage structure according to a third predetermined hash function, the method further comprises:
when a new routing table entry is added, acquiring a frequent entry of the new routing table entry;
and calculating according to a third preset hash function by taking the frequent item as a keyword to obtain a third hash address, storing a corresponding new routing table item in the third hash address, and updating the leaf node of the second-level tree-shaped storage structure.
14. The routing query method according to claim 8, after the step of storing the routing table entry in the leaf node of the second-level tree storage structure according to a third preset hash function, further comprising:
and when the routing table entry is reduced, deleting the routing table entry stored in the corresponding third hash address, and updating the leaf node of the second-level tree-shaped storage structure.
15. A routing query device, comprising:
the first searching module is used for searching a root node associated with the routing table item to be inquired in a first-level tree-shaped storage structure formed by a plurality of routing devices under a single routing cluster according to the routing table item to be inquired to obtain a first routing cluster; the routing cluster is a root node of the first-level tree-shaped storage structure, and the routing equipment is a leaf node of the first-level tree-shaped storage structure;
the second searching module is used for searching a root node associated with the routing table item to be inquired in a second-level tree-shaped storage structure formed by a plurality of routing table items under a single routing device to obtain a first routing device; the leaf nodes of the first-level tree-shaped storage structure are root nodes of the second-level tree-shaped storage structure, and the routing table entries are leaf nodes of the second-level tree-shaped storage structure;
a third searching module, configured to search, under the root node of the second-level tree-shaped storage structure, a leaf node that is the same as the route entry to be queried, and return a query result;
the judging module is used for acquiring a routing table item to be inquired and judging whether the routing table item to be inquired is a preset frequent item; the preset frequent item is a routing table item with the occupancy rate higher than a preset threshold value;
if not, traversing the linear linked list to search the routing list item to be inquired;
if yes, searching a first routing cluster in the first-level tree-shaped storage structure.
16. The apparatus of claim 15, wherein the first lookup module comprises:
the first searching unit is used for taking the routing table item to be inquired as a keyword in the first-level tree-shaped storage structure and calculating according to a first preset hash function to obtain a first hash address; the first hash address stores a routing cluster associated with the routing table entry to be queried;
and the first reading unit is used for reading a corresponding candidate routing cluster in the first hash address, and if the candidate routing cluster comprises the routing table entry to be inquired, the candidate routing cluster is used as the first routing cluster.
17. The apparatus of claim 15, wherein the second lookup module comprises:
the second searching unit is used for taking the routing table item to be inquired as a keyword in the second-level tree-shaped storage structure and calculating according to a second preset hash function to obtain a second hash address; the second hash address stores the routing equipment associated with the routing table entry to be queried;
and the second reading unit is used for reading corresponding candidate routing equipment in the second hash address, and if the candidate routing equipment comprises the routing table entry to be inquired, the candidate routing equipment is used as the first routing equipment.
18. The apparatus according to claim 15, wherein the third searching module comprises:
a third searching unit, configured to use the route table entry to be queried as a keyword in a second-level tree storage structure in which the first routing device is a root node, and perform calculation according to a third preset hash function to obtain a third hash address; all routing table entries of the first routing device are stored in the third hash address;
a third reading unit, configured to read a corresponding candidate routing table entry in the third hash address, where if the candidate routing table entry is the routing table entry to be queried, the lookup is successful; otherwise, traversing the linear linked list to search the routing list item to be inquired.
19. The route query device according to any one of claims 15 to 18, further comprising:
the first creation module is used for acquiring frequent items in a plurality of routing devices under a single routing cluster, creating a first-level tree-shaped storage structure of the plurality of routing devices under the routing cluster corresponding to the frequent items according to a first preset hash function, and storing the routing cluster in a root node in the first-level tree-shaped storage structure;
a second creating module, configured to create a second-level tree storage structure of the routing table entry under the routing device corresponding to the frequent entry according to a second preset hash function, and store the routing device in a leaf node in the first-level tree storage structure or a root node of the second-level tree storage structure;
and the third creating module is used for storing the routing table entry into a leaf node of the second-level tree-shaped storage structure according to a third preset hash function.
20. The routing query device of claim 19, wherein the first creation module comprises:
the first calculation unit is used for calculating according to a first preset hash function by taking the frequent item as a keyword to obtain a first hash address, and storing the corresponding routing cluster in the first hash address;
the first creating unit is used for constructing a plurality of first hash addresses storing different routing clusters as a root node of a first-level tree storage structure.
21. The routing query device of claim 19, wherein the second creation module comprises:
the second calculation unit is used for calculating according to a second preset hash function by taking the frequent item as a keyword to obtain a second hash address, and storing the corresponding routing equipment in the second hash address;
and the second creating unit is used for constructing a plurality of second hash addresses storing different routing devices into leaf nodes of the first-level tree-shaped storage structure or root nodes of the second-level tree-shaped storage structure.
22. The routing query device of claim 19, wherein the third creation module comprises:
the third calculation unit is used for calculating according to a third preset hash function by taking the routing table item as a keyword to obtain a third hash address, and storing the corresponding routing table item in the third hash address;
and the third creating unit is used for constructing a plurality of third hash addresses storing different routing table entries into leaf nodes of the second-level tree-shaped storage structure.
23. The route query device of claim 20, further comprising:
the first acquisition module is used for acquiring frequent items of a new routing cluster when the new routing cluster is added;
and the first updating module is used for calculating according to a first preset hash function by taking the frequent item as a keyword to obtain a first hash address, storing the corresponding new routing cluster in the first hash address, and updating the root node of the first-level tree-shaped storage structure.
24. The route query device of claim 20, further comprising:
and the second updating module is used for deleting the routing cluster in the corresponding first hash address and updating the root node of the first-level tree storage structure when the routing cluster is reduced.
25. The route query device of claim 21, further comprising:
the second acquisition module is used for acquiring frequent items of the new routing equipment when the new routing equipment is added;
and the third updating module is used for calculating according to a second preset hash function by taking the frequent item as a keyword to obtain a second hash address, storing the corresponding new routing equipment in the second hash address, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
26. The route query device of claim 21, further comprising:
and the fourth updating module is used for deleting the routing equipment stored in the corresponding second hash address when the number of the routing equipment is reduced, and updating the leaf node of the first-level tree-shaped storage structure or the root node of the second-level tree-shaped storage structure.
27. The route query device of claim 22, further comprising:
the third acquisition module is used for acquiring frequent items of the new routing table items when the new routing table items are added;
and the fifth updating module is used for calculating according to a third preset hash function by taking the frequent item as a keyword to obtain a third hash address, storing a corresponding new routing table item in the third hash address, and updating the leaf node of the second-level tree-shaped storage structure.
28. The route query device of claim 22, further comprising:
and the sixth updating module is used for deleting the routing table entry stored in the corresponding third hash address when the routing table entry is reduced, and updating the leaf node of the second-level tree-shaped storage structure.
CN201510260256.0A 2015-05-20 2015-05-20 Route query method and device Active CN106302178B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201510260256.0A CN106302178B (en) 2015-05-20 2015-05-20 Route query method and device
PCT/CN2015/095448 WO2016184069A1 (en) 2015-05-20 2015-11-24 Route lookup method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510260256.0A CN106302178B (en) 2015-05-20 2015-05-20 Route query method and device

Publications (2)

Publication Number Publication Date
CN106302178A CN106302178A (en) 2017-01-04
CN106302178B true CN106302178B (en) 2020-02-21

Family

ID=57319399

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510260256.0A Active CN106302178B (en) 2015-05-20 2015-05-20 Route query method and device

Country Status (2)

Country Link
CN (1) CN106302178B (en)
WO (1) WO2016184069A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714347A (en) * 2018-12-29 2019-05-03 杭州迪普科技股份有限公司 Storage, querying method and the device of tactful hit results, equipment and medium
CN112749208A (en) * 2020-12-30 2021-05-04 普华云创科技(北京)有限公司 Distributed storage searching method and system based on secondary routing
CN114513449B (en) * 2022-02-23 2024-04-26 北京慧橙信息科技有限公司 Intra-domain routing optimization method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159658A (en) * 2007-11-02 2008-04-09 华为技术有限公司 Virtual private network routing search method and device
CN101902388A (en) * 2009-05-26 2010-12-01 北京风格九州文化传播有限公司 Expandable fast discovery technology for multi-stage sequencing resources
CN102511151A (en) * 2011-04-27 2012-06-20 华为技术有限公司 Router, virtual cluster router system and establishing method thereof
CN102571599A (en) * 2012-02-08 2012-07-11 福建三元达通讯股份有限公司 Rapid storage method of routing table entry

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7797348B2 (en) * 2003-05-01 2010-09-14 The Hong Kong Polytechnic University Data structure and system for IP address lookup and IP address lookup system
US9608898B2 (en) * 2010-08-05 2017-03-28 Alcatel Lucent Method and apparatus for performing multicast traces in MPLS networks
CN103107945B (en) * 2013-01-10 2016-01-27 中国科学院信息工程研究所 A kind of system and method for fast finding IPV6 route
US9467302B2 (en) * 2013-10-07 2016-10-11 Avaya Inc. Quality of service aware hybrid multicast networks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159658A (en) * 2007-11-02 2008-04-09 华为技术有限公司 Virtual private network routing search method and device
CN101902388A (en) * 2009-05-26 2010-12-01 北京风格九州文化传播有限公司 Expandable fast discovery technology for multi-stage sequencing resources
CN102511151A (en) * 2011-04-27 2012-06-20 华为技术有限公司 Router, virtual cluster router system and establishing method thereof
CN102571599A (en) * 2012-02-08 2012-07-11 福建三元达通讯股份有限公司 Rapid storage method of routing table entry

Also Published As

Publication number Publication date
CN106302178A (en) 2017-01-04
WO2016184069A1 (en) 2016-11-24

Similar Documents

Publication Publication Date Title
CN104866502B (en) Data matching method and device
US9269411B2 (en) Organizing data in a hybrid memory for search operations
EP2772040B1 (en) Prefix and predictive search in a distributed hash table
US10771386B2 (en) IP routing search
JP3570323B2 (en) How to store prefixes for addresses
CN103051543A (en) Route prefix processing, lookup, adding and deleting method
CN107948060A (en) A kind of new routing table is established and IP method for searching route and device
CN102880628A (en) Hash data storage method and device
CN106302178B (en) Route query method and device
US8914574B2 (en) Content addressable memory and method of searching data thereof
CN106789859B (en) Message matching method and device
KR100965552B1 (en) Method for Generating Packet Classification Table by Using Range Cutting and Packet Classification Method and Packet Classifier
KR100999408B1 (en) Method for searching an ??? using hash tree
CN110995876B (en) Method and device for storing and searching IP
CN106709045B (en) Node selection method and device in distributed file system
KR101587756B1 (en) Apparatus and method for searching string data using bloom filter pre-searching
Lin et al. A multi-index hybrid trie for lookup and updates
KR102279323B1 (en) Method and device for grape spasification using edge prunning
WO2013108333A1 (en) Search device, search method, and search program
Alimohammadi et al. Clustering-based many-field packet classification in software-defined networking
US10476785B2 (en) IP routing search
CN113328947B (en) Variable-length route searching method and device based on application of controllable prefix extension bloom filter
Zhian et al. Parallel processing priority trie-based IP lookup approach
CN115714752A (en) Packet classification method and device, forwarding chip and electronic equipment
Li et al. An IPv6 Routing Lookup Algorithm Based on Hash Table and HOT

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant