CN115934727A - Information query method and device and computer readable storage medium - Google Patents

Information query method and device and computer readable storage medium Download PDF

Info

Publication number
CN115934727A
CN115934727A CN202211710608.4A CN202211710608A CN115934727A CN 115934727 A CN115934727 A CN 115934727A CN 202211710608 A CN202211710608 A CN 202211710608A CN 115934727 A CN115934727 A CN 115934727A
Authority
CN
China
Prior art keywords
information
query
target
memory
storage
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
CN202211710608.4A
Other languages
Chinese (zh)
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.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
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 Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202211710608.4A priority Critical patent/CN115934727A/en
Publication of CN115934727A publication Critical patent/CN115934727A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides an information query method, an information query device and a computer readable storage medium, and relates to the technical field of network data processing. The method comprises the following steps: inquiring in a target memory in the internal memory according to the inquiry information; if the corresponding target information is inquired in the target memory, feeding back a first inquiry result of which the inquiry information is not in an information table in the external memory; if the corresponding target information is not inquired in the target memory, inquiring in the information table according to the inquiry information; if the corresponding target information is inquired in the information table, feeding back a second inquiry result of the inquiry information in the information table; the information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive with the first information. The method and the device have the advantages that different information is stored in the information table and the target memory respectively, and the inquiry is carried out in a sequential inquiry mode, so that the efficiency of inquiring the large-capacity information table is effectively improved.

Description

Information query method and device and computer readable storage medium
Technical Field
The present application relates to the field of network data processing technologies, and in particular, to an information query method, an information query device, and a computer-readable storage medium.
Background
In a computer network, a large-capacity information table occupies a large storage space, the whole information table cannot be stored in an internal storage device of a CPU/chip, such as an on-chip memory in a network processor, and the whole information table needs to be stored in a slow memory outside the chip, such as a DRAM. In network access control equipment, such as network firewalls and network traffic monitoring equipment, information related to flows needing to control and sample specific traffic is stored in an information table, and most search results are negative and cannot be matched with contents in the information table.
The speed of accessing the external memory by the CPU/chip is slower than the speed of accessing the in-chip memory, and in order to increase the speed of information processing, a commonly used method at present is to increase a filtering operation before table lookup, so that the network device and the application system can reduce the number of access information tables, thereby increasing the information processing capability. For example, information that is not in the table may be filtered out using a Bloom Filter or a Cuckoo hash Filter. However, since the size of the space and the information table is proportional to the occupied space of the data structure of the filter, when the occupied space of the data structure of the filter exceeds the available space of the on-chip memory, or the number of the occupied spaces of each piece of information is reduced, the information filtering is not available, the filtering performance is poor, and the like, so that the efficiency of querying the large-capacity information table is low, and the current network access control requirement cannot be met.
Disclosure of Invention
In view of the above, embodiments of the present invention provide an information query method, an information query apparatus, and a computer readable storage medium, so as to solve the problem of low efficiency in querying an information table in the prior art.
In order to solve the foregoing problem, in a first aspect, an embodiment of the present application provides an information query method, where the method includes:
inquiring in a target memory in the internal memory according to the inquiry information;
if the corresponding target information is inquired in the target memory, feeding back a first inquiry result of the inquiry information which is not in an information table in an external memory;
if the corresponding target information is not inquired in the target memory, inquiring in the information table according to the inquiry information;
if the corresponding target information is inquired in the information table, feeding back a second inquiry result of the inquiry information in the information table;
the information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive with the first information.
In the implementation process, mutually exclusive different information is respectively stored in the target memory in the internal memory and the information table in the external memory, and the query efficiency in the internal memory is higher than that of the external memory, so that the effectiveness and the accuracy of various query results are improved by sequentially querying in the target memory in the internal memory and then in the information table in the external memory, the efficiency of querying whether the query information is in the information table can be effectively improved, the performance of network security equipment and an application system and the like during information query is optimized, and various network access control requirements are met.
Optionally, wherein the first information is stored in the information table according to a control requirement;
the second information is stored in the target memory according to the information table.
In the above implementation, different information may be stored in the information table and the target memory so that the information table and the data in the target memory do not conflict with each other when the information table and the data in the target memory are queried. The first information stored in the information table is determined by the control requirements of the network access, while the information stored in the target memory is determined by the information table, i.e. the data stored in the target memory is not present in the information table. The repeated phenomenon during query can be reduced by respectively storing the mutually exclusive data in the information table and the target memory, so that the accuracy of the first query result and the second query result is improved.
Optionally, the information table includes a first storage table and a second storage table;
the first information is stored in the information table by:
determining a plurality of original first information according to the control requirement;
determining a first position of each first information in the first storage table and a second position of each first information in the second storage table based on a hash function and fingerprint information of each first information;
storing the corresponding first information based on the first location or the second location.
In the implementation process, in order to reduce the conflict between data storage and query in the information table, two storage tables with the same structure may be provided in the information table. Through the control requirement of network access, a plurality of original first information with information specific content are determined, calculation is carried out based on a hash function and fingerprint information of each first information, two storage positions of each first information in two storage tables are determined, a proper position is selected from the two storage positions, the original first information is stored, and the efficiency and effectiveness of storing the first information in the information tables are effectively improved. In addition, because the original first information is specific information content and occupies a large storage space, the information table can be stored in an external memory with low query efficiency to be used as a target for performing query for the second time.
Optionally, wherein the target memory includes a third storage table and a fourth storage table;
the second information is stored in the target storage by:
determining a plurality of non-stored information mutually exclusive with the first information;
extracting original fingerprint information of the non-stored information as the second information;
determining a third position of each second information in the third storage table and a fourth position in the fourth storage table based on a hash function;
storing the corresponding second information based on the third location or the fourth location.
In the implementation process, in order to reduce the conflict between data storage and query in the target memory, two storage tables with the same structure may be arranged in the target memory. By determining the non-stored information which is not overlapped with and mutually exclusive from the first information to extract the compressed fingerprint information of a plurality of pieces of non-stored information as the second information, and performing calculation based on the hash function and each piece of second information to determine two storage positions of each piece of second information in two storage tables, selecting a proper position from the two storage positions to store the compressed second information, the efficiency and effectiveness of storing the second information in the target memory are effectively improved. In addition, the second information is compressed information of specific information content, the occupied storage space is small, and the requirement of the target storage on the storage space can be reduced, so that the target storage can be stored in an internal storage with high query efficiency to serve as a target for first query, and the query efficiency is improved.
Optionally, the querying in the target storage in the internal storage according to the query information includes:
determining corresponding query fingerprint information based on the query information;
determining a corresponding first query location in the target storage based on a hash function and the query fingerprint information;
and if the second information stored in the first query position is the same as the query fingerprint information, taking the second information as the queried target information.
In the implementation process, when the query is performed in the target memory according to the query information, the query fingerprint information corresponding to the query information may be determined based on the query information, the query fingerprint information is calculated according to a hash function, a corresponding first query position is determined in the target memory, the second information stored in the first query position is compared with the query fingerprint information, and the second information identical to the query fingerprint information is used as the queried target information. If the second information is different from the query fingerprint information, the target information is not queried in the representation target memory, and the storage position of the query information theory can be determined, so that the compressed data comparison is carried out, and the efficiency and the accuracy of the query result in the target memory are effectively improved.
Optionally, the querying in the information table according to the query information includes:
determining corresponding query fingerprint information based on the query information;
determining a corresponding second query position in the information table based on a hash function and the query fingerprint information;
and if the first information stored in the second query position is the same as the query information, taking the first information as the queried target information.
In the implementation process, when corresponding target information is not queried in the target memory, the secondary query can be performed on the information table according to the query information 5. When the query is carried out for the second time, the query information can be firstly determined
Determining corresponding inquiry fingerprint information, calculating the inquiry fingerprint information according to a hash function, determining a corresponding second inquiry position in an information table, comparing first information stored in the second inquiry position with original inquiry information, and taking the first information which is the same as the inquiry information as an inquired target
And (4) information. If the first information is different from the query information, the target information is not queried in the representation information table, and 0 can determine the storage position of the query information theory, so that the original data comparison is carried out, and the efficiency and the accuracy of the query result in the query in the information table are effectively improved.
Optionally, the method further comprises:
if the corresponding target information is not inquired in the information table, acquiring verification fingerprint information of each first information stored in the second inquiry position;
if the inquiry fingerprint information is different from all the verification fingerprint information, determining the corresponding storage position of the inquiry fingerprint information in the target storage according to the hash function;
storing the query fingerprint information in the storage location of the target memory to update the query information in the target memory.
In the implementation process, when the corresponding target information is not queried in the information table, the query information representing 0 is not stored in the target memory or the information table. In order to enlarge the data range during query and improve the query efficiency, the verification fingerprint information of each piece of first information stored in the second storage location may be compared with the query fingerprint information to verify whether the query information has false negative conflict, and the query fingerprint information is different from all the verification fingerprint information, that is, the query fingerprint information is not the same as all the verification fingerprint information
If the condition of conflict exists, the storage position of the inquiry fingerprint information in the target memory is calculated according to the hash function, and the inquiry fingerprint information is stored in the corresponding storage position in the target memory,
so as to update the related information which is not inquired in the target memory. The data in the target memory can be updated according to the actual query result, and the data range in the target memory is effectively expanded, so that the query result can be directly determined in the target memory when the same query information is subsequently queried, and the query efficiency is further improved.
Optionally, the method further comprises:
determining updating information according to the updating requirement of the information table;
inquiring in the target memory according to the updating information;
if the second information corresponding to the updating information is not inquired in the target memory, adding the updating information into the information table for updating;
and if the second information corresponding to the updated information is inquired in the target memory, deleting the second information, and adding the updated information into the information table for updating.
In the implementation process, because the data in the information table can also be changed in various ways such as updating, when the information table is updated, the information table can be firstly inquired in the target memory according to the updating information to determine whether the target memory has the second information corresponding to the updating information, if not, the representation updating information is not stored in the target memory, and the updating information can be directly added into the information table for updating; if yes, the representation updating information is stored in the target memory, and the updating information is added to the information table for updating after the second information stored in the target memory is deleted. When the information table is updated in real time, repeated data can not exist in the information table and the target memory, and therefore validity and accuracy of query results are guaranteed.
In a second aspect, an embodiment of the present application further provides an information query apparatus, where the apparatus includes: the system comprises a first query module, a first feedback module, a second query module and a second feedback module;
the first query module is used for querying in a target memory in the internal memory according to query information;
the first feedback module is used for feeding back a first query result of the query information which is not in an information table in an external memory when the first query module queries corresponding target information in the target memory;
the second query module is used for querying the information table according to the query information when the first query module does not query the corresponding target information in the target memory;
the second feedback module is used for feeding back a second query result of the query information in the information table when the second query module queries the corresponding target information in the information table;
the information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive from the first information.
In the implementation process, mutually exclusive different information is stored in a target memory in an internal memory and an information table in an external memory respectively, the target memory in the internal memory is inquired firstly through a first inquiry module, a corresponding first inquiry result is fed back according to the inquiry condition of the first inquiry module through a first feedback module, the information table in the external memory is inquired for the second time through a second inquiry module, and a corresponding second inquiry result is fed back according to the inquiry condition of the second inquiry module through a second feedback module.
In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, where computer program instructions are stored in the computer-readable storage medium, and when the computer program instructions are read and executed by a processor, the steps in any implementation manner of the information query method are executed.
In summary, the embodiments of the present application provide an information query method, an information query device, and a computer readable storage medium, which store different information in an information table in an external memory and a target memory in an internal memory, and effectively improve efficiency when querying a large-capacity information table by querying in the target memory with a faster query speed and then querying in the information table when no corresponding data is queried.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic block diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a first information query method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a second information query method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a third information query method according to an embodiment of the present application;
fig. 5 is a detailed flowchart of a step S200 according to an embodiment of the present disclosure;
fig. 6 is a detailed flowchart of a step S400 provided in an embodiment of the present application;
fig. 7 is a schematic flowchart of a fourth information query method according to an embodiment of the present application;
fig. 8 is a flowchart illustrating a fifth information query method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an information query device according to an embodiment of the present application.
Icon: 100-an electronic device; 111-a memory; 112-a memory controller; 113-a processor; 114-peripheral interfaces; 115-input/output unit; 116-a display unit; 800-information inquiry means; 810-a first query module; 820-a first feedback module; 830-a second query module; 840-second feedback module.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are only a few of the embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without any creative effort belong to the protection scope of the embodiments of the present application.
In computer networks, network devices and applications require access to large tables of information, such as: the internet router needs to search a routing table storing up to millions of routes to determine a forwarding path of a data packet; in a large network address translation device (NAT), a billion-level connection table needs to track the state of active connection, and network address translation is realized according to the state of connection; in network security devices such as firewalls, it is necessary to look up large access control lists to implement control of network access and the like.
Therefore, in the network device and the application system, it is necessary to access a large-capacity information table at high speed to control network access. The large-capacity information table occupies a large storage space, the whole information table cannot be stored in an internal storage device of a CPU/chip, such as an on-chip memory in a network processor, and the whole information table needs to be stored in a slow memory outside the chip, such as a DRAM. Because the speed of accessing the external memory by the CPU/chip is slower than the speed of accessing the on-chip memory, and in the network access control type device, such as a network firewall and a network traffic monitoring device, the information related to the flow which needs to control and sample a specific traffic is stored in the information table, most of the search results are negative and cannot be matched with the content in the information table. Therefore, in order to increase the speed of information processing, a common method at present is to reduce the number of access to the information table by adding a filtering operation before table lookup, so as to improve the information processing capability. For example, a Bloom Filter (a probabilistic based data structure, mainly used to determine whether an element is in a set) or a Cuckoo Hash Filter (Cuckoo Filter, an improved algorithm based on Cuckoo Hash, mainly used to determine whether an element is in a set) may be used to Filter out information that is not in a table.
Therefore, the applicant finds that, when the space occupied by the filter data structure exceeds the available space of the on-chip memory, or the number of spaces occupied by each piece of information in the filter data structure is reduced, the information filtering is unavailable or the filtering performance is poor, and the efficiency of querying a large-capacity information table is low, and the current network access control requirement cannot be met.
In order to solve the above problem, an embodiment of the present invention provides an information query method, which is applied to a server, where the server may be an electronic device having a logic computation function, such as a Personal Computer (PC), a tablet PC, a smart phone, a Personal Digital Assistant (PDA), and the like, and can store different information in an information table of a target memory and an external memory in an internal memory, respectively, so as to improve efficiency of querying a large-capacity information table by querying the information table first in the target memory and then in the information table.
Optionally, referring to fig. 1, fig. 1 is a block schematic diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 100 may include a memory 111, a memory controller 112, a processor 113, a peripheral interface 114, an input-output unit 115, and a display unit 116. It will be understood by those of ordinary skill in the art that the structure shown in fig. 1 is merely exemplary and is not intended to limit the structure of the electronic device 100. For example, electronic device 100 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The aforementioned components of the memory 111, the memory controller 112, the processor 113, the peripheral interface 114, the input/output unit 115 and the display unit 116 are electrically connected to each other directly or indirectly, so as to implement data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The processor 113 is used to execute the executable modules stored in the memory.
The Memory 111 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 111 is used for storing a program, and the processor 113 executes the program after receiving an execution instruction, and the method executed by the electronic device 100 defined by the process disclosed in any embodiment of the present application may be applied to the processor 113, or implemented by the processor 113.
The processor 113 may be an integrated circuit chip having signal processing capability. The Processor 113 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. Can realize or
Perform the methods, steps, and logic blocks disclosed in the embodiments of the present application. The general purpose processor 5 may be a microprocessor, any conventional processor, etc.
The peripheral interface 114 couples various input/output devices to the processor 113 and memory 111. In some embodiments, the peripheral interface 114, the processor 113, and the memory controller 112 may be implemented in a single chip. In other examples, they may be implemented separately from the individual chips.
0 the above-mentioned input-output unit 115 is for providing the user with input data. Input/output unit 115
May be, but is not limited to, a mouse, a keyboard, and the like.
The display unit 116 provides an interactive interface (e.g., a user interface) between the electronic device 100 and a user or is used for displaying image data to the user for reference. In the present embodiment, the display sheet
The cell may be a liquid crystal display or a touch display. In the case of a touch display, the display can be a capacitive touch screen or a resistive touch screen supporting single-point and multi-5-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations simultaneously generated from one or more positions on the touch display, and the sensed touch operations are sent to the processor for calculation and processing. In this embodiment, the display unit 116 may display information stored in the target storage and the information table, and corresponding information such as the first query result and the second query result.
The electronic device in this embodiment may be configured to execute each step in each information query method provided in this embodiment. The following describes in detail the implementation process of the information query method by several embodiments.
Referring to fig. 2, fig. 2 is a schematic flowchart of a first information query method according to an embodiment of the present disclosure, where the method may include steps S200 to S500.
And 5, S200, inquiring in a target memory in the internal memory according to the inquiry information.
The internal memory may be a target memory, and the internal memory may be a memory in the CPU or an on-chip memory, such as an SRAM, and the target memory may be various types of caches (cache memories). When the query is performed, the corresponding query information can be obtained through analysis according to the received data packet, so that the first query is performed in the target storage according to the query information.
Step S300, if the corresponding target information is queried in the target memory, feeding back a first query result of which query information is not in the information table in the external memory.
Wherein the information table may be stored in an external memory, such as a DRAM or the like. Because the data stored in the external memory occupies a larger space and the data stored in the internal memory occupies a smaller space, the efficiency of the query in the internal memory is higher than that of the query in the external memory, so that the query times of the information table in the information query process can be reduced by the mode of performing the query in the internal memory and then performing the query in the external memory, and the efficiency of the information table query of the network firewall equipment is improved. The information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive from the first information, namely, the information table and the data stored in the target memory have no duplication. Therefore, if the target information corresponding to the query information is queried in the target memory, the representation query information is not in the information table, and the corresponding first query result can be fed back.
Step S400, if the corresponding target information is not inquired in the target memory, inquiring in the information table according to the inquiry information.
Wherein. If the target information corresponding to the query information is not queried in the target memory, the representation query information is not in the target memory, and a second query needs to be performed in the information table to determine whether the query information is in the information table.
Step S500, if the corresponding target information is inquired in the information table, feeding back a second inquiry result of the inquiry information in the information table.
If the corresponding target information is inquired in the information table, the representation inquiry information is in the information table, and a corresponding second inquiry result can be fed back.
It should be noted that, the first information is stored in the information table according to the control requirement; the second information is stored in the target memory according to the information table. In order to prevent data from conflicting when the information table and the target memory are queried, different information may be stored in the information table and the target memory. The first information stored in the information table is determined by the control requirements of the network access, while the information stored in the target memory is determined by the information table, i.e. the data stored in the target memory is not present in the information table. The repeated phenomenon during query can be reduced by respectively storing the mutually exclusive data in the information table and the target memory, so that the accuracy of the first query result and the second query result is improved.
In the embodiment shown in fig. 2, the query is performed in a sequential query manner of first querying in the target memory in the internal memory and then querying in the information table in the external memory, so that the validity and accuracy of various query results are improved, and the efficiency of querying whether the query information is in the result of the information table can be effectively improved, so as to optimize the performance of the network security device and the application system when performing information query, and meet various network access control requirements.
Optionally, in order to reduce the conflict between data storage and query in the information table, two storage tables may be provided in the information table, that is, the information table may include a first storage table and a second storage table. The first memory table and the second memory table may have the same structure, for example, the two memory tables have the same number of rows, and each row has four memory cells, each memory cell being capable of storing one first information. Referring to fig. 3, fig. 3 is a flowchart illustrating a second information query method according to an embodiment of the present application, where the method may further include steps S610 to S630.
Step S610, determining a plurality of original first information according to the control requirement.
Optionally, since the information table is stored in an external memory with a large storage space, the data stored therein is specific information content, and a plurality of original first information can be determined according to control requirements. For example, when the information table is an identity information table that needs to perform network interception, the corresponding first information is a variety of specific information such as an address and an account that need to perform interception.
In step S620, a first location of each first information in the first storage table and a second location in the second storage table are determined based on the hash function and the fingerprint information of each first information.
The hash function may include a uniform hash function selected according to sizes of the first storage table and the second storage table, and the fingerprint information of each piece of first information may be calculated first, and the fingerprint information is used as a query key when querying, so that a first position of the first information in the first storage table and a second position of the first information in the second storage table are calculated respectively according to the hash function in combination with the fingerprint information.
Alternatively, the first location may be denoted as h1 (x), h1 (x) = hash (x), and the second location may be denoted as h2 (x), h2 (x) = h1 (x) xor hash (fp (x)), where fp (x) is fingerprint information of the first information, fp (x) = hash2 (x), and hash2 is another hash function different from the hash function, for example, hash2 may be an available hash function, and the like.
Step S630, storing the corresponding first information based on the first location or the second location.
The first position and the second position can directly calculate the other position through XOR processing, so that the conflict situation of the positions when the information is stored can be effectively reduced, and the alternative position for storing the information element does not need to be additionally calculated. In the first position or the second position, a blank memory cell may be selected to store correspondingly, for example, when the memory cell corresponding to the first position stores data, and the memory cell corresponding to the second position does not store data, the corresponding specific first information may be stored to the second position.
In the embodiment shown in fig. 3, the original first information can be correspondingly calculated and stored in the information table, and the efficiency and effectiveness of storing the first information in the information table are effectively improved.
Optionally, in order to reduce the conflict when data storage and query are performed in the target memory, two storage tables may be set in the target memory, that is, the target memory may include a third storage table and a fourth storage table. The third storage table and the fourth storage table may have the same structure, for example, the two storage tables have the same row number, and each row has four storage units, each storage unit being capable of storing one second information. Referring to fig. 4, fig. 4 is a schematic flowchart of a third information query method according to the embodiment of the present application, where the method may further include steps S640-S670.
In step S640, a plurality of pieces of non-stored information mutually exclusive from the first information are determined.
Among the plurality of related data, the plurality of original information which is mutually exclusive with the first information, that is, which is not stored in the information table, may be regarded as the non-stored information.
In step S650, fingerprint information of the original non-stored information is extracted as the second information.
The target memory is stored in an internal memory with a small storage space, so that the stored data is fingerprint information for compressing specific information content. Fingerprint information of the non-stored information may be extracted, and as the corresponding second information, the second information may be denoted as fp ' (x), and the calculation manner of fp ' (x) and fp (x) may be the same, or the second information, that is, fp ' (x) = fp (x) = hash2 (x), may be calculated by a corresponding hash function, for example, hash 2.
In step S660, a third position of each second information in the third storage table and a fourth position in the fourth storage table are determined based on the hash function.
The hash function may include a uniform hash function selected according to sizes of the first storage table and the second storage table, the second information is used as a query key when querying, and a third position of the second information in the third storage table and a fourth position of the second information in the fourth storage table are respectively calculated according to the hash function and the second information.
Alternatively, the third location may be denoted as h3 (x), h3 (x) = hash (x), and the fourth location may be denoted as h4 (x), h4 (x) = h3 (x) xor hash (fp' (x)).
Optionally, the third position and the fourth position can also be divided into an upper part and a lower part, h31 (x), h32 (x); h41 (x), h42 (x). h31 (x) as the position of the storage line of the information x in the third storage table, and h42 (x) as the position of the storage line of the information x in the fourth storage table. Fp '(x) = fp (x) and h12 (x) of the second information stored in the storage unit in the third storage table, and fp' (x) = fp (x) and h22 (x) of the information stored in the storage unit in the fourth storage table. By dividing the calculation results of h3 (x) and h4 (x) into an upper part and a lower part, taking the upper part of the result as a storage location, and storing the lower part of the result and fp (x) in the storage unit together, the target memory can be applied to a scene with limited space of a high-speed memory, and simultaneously, the function of directly calculating another alternative location of the target memory by using exclusive OR is maintained.
And step S670, storing the corresponding second information based on the third position or the fourth position.
The fingerprint storage device comprises two storage positions, and the third position and the fourth position can directly calculate the other position through XOR processing, so that the conflict situation of the positions when information is stored can be effectively reduced, and the alternative position for storing fingerprint information does not need to be additionally calculated. In the third position or the fourth position, a blank memory cell may be selected for storing correspondingly, for example, when the memory cell corresponding to the third position stores data, and the memory cell corresponding to the fourth position does not store data, the corresponding compressed second information may be stored to the fourth position.
Optionally, the second information is corresponding fingerprint information, and the fingerprint information is a hash value obtained by compressing the original information, so that the requirement of a storage space when the second information is stored can be effectively reduced, and the size of the occupied space of the target memory is reduced.
It should be noted that h1 (x), h2 (x), and fp (x) in the information table and h3 (x), h4 (x), and fp' (x) in the target memory may be calculated by using the same calculation method, that is, the target memory and the information table share a set of hash functions hash and hash2 with the same property, which reduces the difficulty of finding suitable hash functions for the target memory and the information table, respectively.
In the embodiment shown in fig. 4, the compressed second information can be correspondingly calculated and stored in the target memory, which effectively improves the efficiency and effectiveness of storing the second information in the target memory.
Optionally, referring to fig. 5, fig. 5 is a detailed flowchart of step S200 according to an embodiment of the present disclosure, and step S200 may include steps S210 to S230.
Step S210, determining corresponding query fingerprint information based on the query information.
When querying is performed in the target storage according to the query information, the query fingerprint information corresponding to the query information may be determined based on a calculation manner such as a hash function.
Step S220, determining a corresponding first query location in the target storage based on the hash function and the query fingerprint information.
The query fingerprint information may be calculated according to a hash function, and a corresponding first query location may be determined in the target memory. It should be noted that, since the target memory may include two storage tables, the first query location may also include locations of two storage rows in the two storage tables.
In step S230, if the second information stored in the first query location is the same as the query fingerprint information, the second information is used as the queried target information.
The second information which is the same as the inquiry fingerprint information is stored in the target memory, the second information which is the same as the inquiry fingerprint information can be used as a corresponding key value, namely the inquired target information, and if the second information is different from the inquiry fingerprint information, the inquiry information is not stored in the target memory.
In the embodiment shown in fig. 5, the storage location of the query information theory can be determined, so that compressed data comparison is performed, and the efficiency and the accuracy of the query result when the query is performed in the target storage are effectively improved.
Optionally, referring to fig. 6, fig. 6 is a detailed flowchart of step S400 provided in the present embodiment, and step S400 may include steps S410 to S430.
And step S410, determining corresponding query fingerprint information based on the query information.
When the corresponding target information is not inquired in the target memory, the secondary inquiry can be carried out in the information table according to the inquiry information. In the second query, the query fingerprint information corresponding to the query information may be determined based on a hash function and other calculation methods.
In step S420, a corresponding second query location is determined in the information table based on the hash function and the query fingerprint information.
The query fingerprint information may be calculated according to a hash function, and a corresponding second query location may be determined in the information table. It should be noted that, since the information table may include two storage tables, the second query location may also include locations of two storage lines in the two storage tables.
In step S430, if the first information stored in the second query location is the same as the query information, the first information is used as the queried target information.
The first information and the query information stored in the positions of the two storage rows in the second query position can be compared with each other in a character string manner to determine whether the first information is the same as the query information or not, the representation query information is stored in the information table when the first information is the same as the query information, the first information which is the same as the query information can be used as a corresponding key value, namely the queried target information, and if the first information is different from the query information, the representation information table does not store the query information.
When the query is performed in the information table, a corresponding filter table may be further set in the information table, so as to quickly determine a query result that is not in the information table. Although the query filter table is also stored in the external memory, frequent access to the information table stored in the external memory is avoided due to a simple algorithm, and the query performance of the information table with a large capacity is improved.
In the embodiment shown in fig. 6, the storage location of the query information theory can be determined, so that the original data comparison is performed, and the efficiency of querying in the information table and the accuracy of the query result are effectively improved.
Optionally, referring to fig. 7, fig. 7 is a flowchart illustrating a fourth information query method according to an embodiment of the present application, where the method may further include steps S710-S730.
Step S710, if the corresponding target information is not queried in the information table, obtaining the verification fingerprint information of each first information stored in the second query location.
And when the corresponding target information is not inquired in the information table, the representation inquiry information is not stored in the target memory or the information table. In order to expand the data range during query and improve the efficiency of query, the condition that the query information is not in the information table can be verified firstly. During verification, the verification fingerprint information of the plurality of first information stored in the two storage rows in the second query position may be obtained first.
Step S720, if the inquiry fingerprint information is different from all the verification fingerprint information, determining the corresponding storage position of the inquiry fingerprint information in the target storage according to the hash function.
The verification fingerprint information and the inquiry fingerprint information can be compared to verify whether the inquiry information has false negative conflict condition.
Step S730, storing the query fingerprint information in a storage location of the target memory to update the query information in the target memory.
When the query fingerprint information is different from all the verification fingerprint information, namely none of the first information in the representation information table is matched with the query information and no conflict exists, the corresponding storage position of the query fingerprint information in the target memory can be calculated according to the hash function, so that the query fingerprint information is stored in the corresponding storage position in the target memory, and the related information which is not queried is updated in the target memory.
Alternatively, the storage location may be a first query location determined when querying the query information in the target storage.
By adding the information which is not inquired in the information table into the target memory, when a subsequently received data packet with the same information is hung, only the target memory is inquired to obtain a first inquiry result which is not in the information table. And because the target memory is stored in the high-speed external memory, the query speed is high, the time-consuming operation of querying the information table every time is effectively avoided, and the efficiency of querying the information table is improved.
In the embodiment shown in fig. 7, the data in the target memory can be updated according to the actual result of the query, and the data range in the target memory is effectively expanded, so that the query result can be directly determined in the target memory when the same query information is subsequently queried, and the efficiency during query is further improved.
Optionally, referring to fig. 8, fig. 8 is a schematic flowchart of a fifth information query method according to an embodiment of the present application, where the method may further include steps S740 to S770.
Step S740, determining the update information according to the update requirement of the information table.
Since the data in the information table may also be changed in many ways, when the information table is updated, the corresponding update information may be determined according to the update requirement, where the update requirement may be to intercept part of the information, for example, to intercept network access with an address xx, and the corresponding update information is the corresponding data such as the network address and the identity information.
And step S750, inquiring in the target memory according to the updated information.
The query may be performed in the target memory according to the update information, and the query may be performed in the same manner as the query performed on the query information in the target memory, that is, whether the update information is stored in the target memory is determined, which is not described in detail.
In step S760, if the second information corresponding to the update information is not found in the target storage, the update information is added to the information table for updating.
If the second information corresponding to the update information is not inquired in the target memory, that is, the update information is not stored in the representation target memory, the update information can be directly added to the information table for updating.
In step S770, if the second information corresponding to the updated information is found in the target storage, the second information is deleted, and the updated information is added to the information table for updating.
If the second information corresponding to the update information is queried in the target memory, that is, the update information is stored in the representation target memory, in order to ensure mutual exclusivity between the information table and the data stored in the target memory, the second information stored in the target memory needs to be deleted and then the update information is added to the information table for updating.
In the embodiment shown in fig. 8, while the information table is updated in real time, it can be ensured that no repeated data exists in the information table and the target memory, so that the information in the information table is not queried in the target memory, and the validity and accuracy of the query result are ensured.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an information query apparatus according to an embodiment of the present disclosure, where the information query apparatus 800 may include: a first query module 810, a first feedback module 820, a second query module 830, and a second feedback module 840;
the first query module 810 is configured to query the target storage in the internal storage according to the query information;
the first feedback module 820 is used for feeding back a first query result of the query information which is not in the information table in the external memory when the first query module 810 queries corresponding target information in the target memory;
the second query module 830 is configured to query the information table according to the query information when the first query module 810 does not query the corresponding target information in the target storage;
the second feedback module 840 is configured to feed back a second query result of the query information in the information table when the second query module 830 queries corresponding target information in the information table;
the information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive with the first information.
In an optional embodiment, the first information is stored in an information table according to the control requirement; the second information is stored in the target memory according to the information table.
In an optional embodiment, the information table includes a first storage table and a second storage table; the information query device 800 may further include a first storage module, configured to determine a plurality of original first information according to the control requirement; determining a first position of each first information in the first storage table and a second position of each first information in the second storage table based on the hash function and the fingerprint information of each first information; based on the first location or the second location, corresponding first information is stored.
In an optional embodiment, the target memory includes a third storage table and a fourth storage table; the information query device 800 may further include a second storage module, configured to determine a plurality of pieces of non-stored information mutually exclusive from the first information; extracting fingerprint information of original non-stored information as second information; determining a third position of each second information in the third storage table and a fourth position in the fourth storage table based on the hash function; based on the third location or the fourth location, corresponding second information is stored.
In an optional implementation, the first query module 810 is specifically configured to: determining corresponding query fingerprint information based on the query information; determining a corresponding first query location in the target memory based on the hash function and the query fingerprint information; and if the second information stored in the first query position is the same as the query fingerprint information, taking the second information as the queried target information.
In an optional implementation manner, the second query module 830 is specifically configured to: determining corresponding query fingerprint information based on the query information; determining a corresponding second query position in the information table based on the hash function and the query fingerprint information; and if the first information stored in the second query position is the same as the query information, taking the first information as the queried target information.
In an optional embodiment, the information querying device 800 may further include a first updating module, configured to, when the second querying module 830 does not query the corresponding target information in the information table, obtain verification fingerprint information of each first information stored in the second querying location; if the inquiry fingerprint information is different from all the verification fingerprint information, determining the corresponding storage position of the inquiry fingerprint information in the target storage according to the hash function; storing the query fingerprint information in a storage location of the target memory to update the query information in the target memory.
In an optional implementation manner, the information querying device 800 may further include a second updating module, configured to determine the update information according to the update requirement of the information table; inquiring in the target memory according to the updated information; if the second information corresponding to the updating information is not inquired in the target memory, the updating information is added into the information table for updating; and if the second information corresponding to the updated information is inquired in the target memory, deleting the second information, and adding the updated information into the information table for updating.
Since the principle of the information query device 800 in the embodiment of the present application for solving the problem is similar to that in the foregoing embodiment of the information query method, the implementation of the information query device 800 in the embodiment of the present application can refer to the description in the foregoing embodiment of the information query method, and repeated details are not repeated.
The embodiment of the present application further provides a computer-readable storage medium, where computer program instructions are stored in the computer-readable storage medium, and when the computer program instructions are read and executed by a processor, the steps in any one of the information query methods provided in the embodiment are executed.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. The apparatus embodiments described above are merely illustrative, and for example, the block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of devices according to various embodiments of the present application. In this regard, each block in the block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams, and combinations of blocks in the block diagrams, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising 8230; \8230;" comprises 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. An information query method, the method comprising:
inquiring in a target memory in the internal memory according to the inquiry information;
if the corresponding target information is inquired in the target memory, feeding back a first inquiry result of the inquiry information which is not in an information table in an external memory;
if the corresponding target information is not inquired in the target memory, inquiring in the information table according to the inquiry information;
if the corresponding target information is inquired in the information table, feeding back a second inquiry result of the inquiry information in the information table;
the information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive from the first information.
2. The method according to claim 1, wherein the first information is stored in the information table according to a control demand;
the second information is stored in the target memory according to the information table.
3. The method according to claim 2, wherein the information table comprises a first storage table and a second storage table;
the first information is stored in the information table by:
determining a plurality of original first information according to the control requirement;
determining a first position of each first information in the first storage table and a second position of each first information in the second storage table based on a hash function and fingerprint information of each first information;
storing the corresponding first information based on the first location or the second location.
4. The method of claim 2, wherein a third memory table and a fourth memory table are included in the target memory;
the second information is stored in the target storage by:
determining a plurality of non-stored information mutually exclusive from the first information;
extracting original fingerprint information of the non-stored information as the second information;
determining a third location of each of the second information in the third storage table and a fourth location in the fourth storage table based on a hash function;
storing the corresponding second information based on the third location or the fourth location.
5. The method according to any one of claims 1-4, wherein said querying in a target storage in an internal storage according to query information comprises:
determining corresponding query fingerprint information based on the query information;
determining a corresponding first query location in the target memory based on a hash function and the query fingerprint information;
and if the second information stored in the first query position is the same as the query fingerprint information, taking the second information as the queried target information.
6. The method according to any one of claims 1-4, wherein said querying in the information table according to the query information comprises:
determining corresponding query fingerprint information based on the query information;
determining a corresponding second query position in the information table based on a hash function and the query fingerprint information;
and if the first information stored in the second query position is the same as the query information, taking the first information as the queried target information.
7. The method of claim 6, further comprising:
if the corresponding target information is not inquired in the information table, acquiring verification fingerprint information of each first information stored in the second inquiry position;
if the inquiry fingerprint information is different from all the verification fingerprint information, determining the corresponding storage position of the inquiry fingerprint information in the target storage according to the hash function;
storing the query fingerprint information in the storage location of the target memory to update the query information in the target memory.
8. The method of claim 1, further comprising:
determining updating information according to the updating requirement of the information table;
inquiring in the target memory according to the updating information;
if the second information corresponding to the updating information is not inquired in the target memory, adding the updating information into the information table for updating;
and if the second information corresponding to the updated information is inquired in the target memory, deleting the second information, and adding the updated information into the information table for updating.
9. An information query device, the device comprising: the system comprises a first query module, a first feedback module, a second query module and a second feedback module;
the first query module is used for querying in a target memory in the internal memory according to query information;
the first feedback module is used for feeding back a first query result of the query information which is not in an information table in an external memory when the first query module queries corresponding target information in the target memory;
the second query module is used for querying the information table according to the query information when the first query module does not query the corresponding target information in the target memory;
the second feedback module is used for feeding back a second query result of the query information in the information table when the second query module queries the corresponding target information in the information table;
the information table stores a plurality of first information, and the target memory stores a plurality of second information mutually exclusive from the first information.
10. A computer-readable storage medium, having stored thereon computer program instructions, which, when executed by a processor, perform the steps of the method of any one of claims 1-7.
CN202211710608.4A 2022-12-29 2022-12-29 Information query method and device and computer readable storage medium Pending CN115934727A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211710608.4A CN115934727A (en) 2022-12-29 2022-12-29 Information query method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211710608.4A CN115934727A (en) 2022-12-29 2022-12-29 Information query method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN115934727A true CN115934727A (en) 2023-04-07

Family

ID=86699001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211710608.4A Pending CN115934727A (en) 2022-12-29 2022-12-29 Information query method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115934727A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117496866A (en) * 2023-10-27 2024-02-02 广东美创希科技有限公司 Thin film transistor TFT screen driving system, method and display device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117496866A (en) * 2023-10-27 2024-02-02 广东美创希科技有限公司 Thin film transistor TFT screen driving system, method and display device

Similar Documents

Publication Publication Date Title
CN102402605B (en) Mixed distribution model for search engine indexing
US20160065534A1 (en) System for correlation of domain names
US11675760B2 (en) Detection of duplicate values during index generation
CN101043421B (en) Memory based method for searching quickly the longest matching of IP address
US10783153B2 (en) Efficient internet protocol prefix match support on No-SQL and/or non-relational databases
US10275486B2 (en) Multi-system segmented search processing
US10311093B2 (en) Entity resolution from documents
CN115934727A (en) Information query method and device and computer readable storage medium
CN112579595A (en) Data processing method and device, electronic equipment and readable storage medium
CN111914020A (en) Data synchronization method and device and data query method and device
US9760836B2 (en) Data typing with probabilistic maps having imbalanced error costs
US11954086B2 (en) Index data structures and graphical user interface
CN111259056A (en) Block chain data query method, system and related equipment
US11361195B2 (en) Incremental update of a neighbor graph via an orthogonal transform based indexing
CN108763458B (en) Content characteristic query method, device, computer equipment and storage medium
CN105574010B (en) Data query method and device
CN113297266B (en) Data processing method, device, equipment and computer storage medium
US20100191764A1 (en) In-memory data optimization system
CN110515979B (en) Data query method, device, equipment and storage medium
CN112256704A (en) Quick join method, storage medium and computer
CN110210222B (en) Data processing method, data processing apparatus, and computer-readable storage medium
WO2017095421A1 (en) Automatic selection of neighbor lists to be incrementally updated
CN111209304A (en) Data processing method, device and system
CN116628037A (en) Data processing method, device, electronic equipment and computer readable storage medium
CN115022242B (en) Network layer identification method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination