CN116627989A - Information query method and related device for topic subscription relation - Google Patents
Information query method and related device for topic subscription relation Download PDFInfo
- Publication number
- CN116627989A CN116627989A CN202310710584.0A CN202310710584A CN116627989A CN 116627989 A CN116627989 A CN 116627989A CN 202310710584 A CN202310710584 A CN 202310710584A CN 116627989 A CN116627989 A CN 116627989A
- Authority
- CN
- China
- Prior art keywords
- topic
- information
- queried
- hash table
- hash
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 63
- 230000006870 function Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 10
- 230000011218 segmentation Effects 0.000 claims description 9
- 230000008569 process Effects 0.000 claims description 6
- 238000004364 calculation method Methods 0.000 claims description 4
- 238000000354 decomposition reaction Methods 0.000 claims description 4
- 230000009467 reduction Effects 0.000 abstract description 7
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 7
- 238000012986 modification Methods 0.000 description 6
- 230000004048 modification Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 3
- 238000013507 mapping Methods 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2255—Hash tables
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2457—Query processing with adaptation to user needs
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses an information query method of topic subscription relation, comprising the following steps: decomposing the received subject request to be queried to obtain a plurality of subjects to be queried; matching each topic to be queried through a bloom filter; and if the topic information is matched with the topic information corresponding to the topic to be queried, searching in a corresponding topic hash table based on the hash value of the topic information to obtain a corresponding client information hash table. Instead of adopting the tree structure to store the theme and the client information, the efficiency reduction of the tree structure caused by the larger depth and width is avoided, and the client information query efficiency under the theme subscription relationship is improved. The application also discloses an information inquiry device, a server and a computer readable storage medium of the topic subscription relation, which have the beneficial effects.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to an information query method, an information query device, a server, and a computer readable storage medium for a topic subscription relationship.
Background
With the continuous development of the internet of things, the MQTT (Message Queuing Telemetry Transport, message queue telemetry transmission) protocol is increasingly widely used due to the characteristics of light weight, simplicity, development and easy implementation, and is a Client and Broker (proxy) based message publishing and subscribing protocol, the Client responsibility is to establish connection with a Broker and maintain heartbeat, correct transmission of messages is ensured, and the Broker responsibility is to manage massive Client connection information and topic subscription information, so that quick routing of messages is ensured.
In the related technology, for the current subscription tree structure, the concurrent modification and query efficiency of a large number of topics are the greatest problems, many open source clients adopt a locking mode to modify the tree structure in a single thread mode, the query efficiency is related to the matching of the depth of the tree and the wild cards, the longer the topic is, the larger the depth of the tree is, the greater the diversity of each segmentation node of the topic is (the more wild cards of each node are matched), and the query efficiency is lower.
Therefore, how to improve the efficiency of client information query under topic subscription relationship is a key issue for those skilled in the art.
Disclosure of Invention
The application aims to provide an information query method, an information query device, a server and a computer readable storage medium for topic subscription relationship, so as to improve the efficiency of client information query under topic subscription relationship.
In order to solve the technical problems, the application provides an information query method of topic subscription relation, comprising the following steps:
decomposing the received subject request to be queried to obtain a plurality of subjects to be queried;
matching each topic to be queried through a bloom filter;
and if the topic information is matched with the topic information corresponding to the topic to be queried, searching in a corresponding topic hash table based on the hash value of the topic information to obtain a corresponding client information hash table.
Optionally, decomposing the received topic request to be queried to obtain a plurality of topics to be queried, including:
receiving the subject request to be queried;
and decomposing the topic request to be queried through topic segmentation symbols to obtain the multiple topics to be queried.
Optionally, matching each topic to be queried through a bloom filter includes:
acquiring a plurality of hash functions in the bloom filter;
and matching each topic to be queried through the plurality of hash functions.
Optionally, searching in the corresponding topic hash table based on the hash value of the topic information to obtain the corresponding client information hash table, which includes:
performing slot position value calculation based on the hash value of the subject information to obtain a corresponding slot position value;
and determining a client information hash table corresponding to the theme information based on the theme hash table corresponding to the slot value.
Optionally, when the client information hash table is obtained, the method further includes:
and returning client information combination data based on the subject information and the content of the client information hash table.
Optionally, the process of generating the subject hash table includes:
calculating a hash value of the subject information, and calculating a corresponding slot value based on the hash value;
judging whether a corresponding subject hash table exists or not based on the slot position value;
if yes, inserting new client information into the corresponding client information hash table;
if not, a new client information hash table is established based on the topic information, and the topic information is added to the bloom filter.
Optionally, the method further comprises:
calculating a hash value of the subject information to be deleted, and calculating a corresponding slot value based on the hash value;
judging whether a corresponding subject hash table exists or not based on the slot position value;
if yes, deleting the client information hash table corresponding to the theme hash table;
and deleting the corresponding topic information when the topic hash table does not have the corresponding subscription client.
The application also provides an information inquiry device of the topic subscription relation, which comprises:
the topic decomposition module is used for decomposing the received topic request to be queried to obtain a plurality of topics to be queried;
the topic matching module is used for matching each topic to be queried through a bloom filter;
and the hash table searching module is used for searching in the corresponding topic hash table based on the hash value of the topic information if the topic information corresponding to the topic to be queried is matched, so as to obtain the corresponding client information hash table.
The application also provides a server, comprising:
a memory for storing a computer program;
and a processor for implementing the steps of the information query method as described above when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the information query method as described above.
The application provides an information query method of topic subscription relation, which comprises the following steps: decomposing the received subject request to be queried to obtain a plurality of subjects to be queried; matching each topic to be queried through a bloom filter; and if the topic information is matched with the topic information corresponding to the topic to be queried, searching in a corresponding topic hash table based on the hash value of the topic information to obtain a corresponding client information hash table.
The method comprises the steps of decomposing a received topic request to be queried to obtain a plurality of topics to be queried, matching the topics to be queried through a bloom filter, namely querying, and finally searching a corresponding client information hash table to realize an information query method for client information instead of storing the topics and the client information by adopting a tree structure, so that the efficiency reduction of the tree structure caused by the larger depth and width is avoided, and the efficiency of querying the client information under the topic subscription relation is improved.
The application also provides an information inquiry device, a server and a computer readable storage medium of the topic subscription relation, which have the beneficial effects and are not described herein.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for querying information about topic subscription relationships according to an embodiment of the present application;
fig. 2 is a schematic diagram of a bloom filter in an information query method according to an embodiment of the present application;
FIG. 3 is a hash representation intent of an information query method according to an embodiment of the present application;
fig. 4 is an information adding schematic diagram of an information query method according to an embodiment of the present application;
fig. 5 is an information matching schematic diagram of an information query method according to an embodiment of the present application;
fig. 6 is a schematic diagram of information deletion of an information query method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an information query device for topic subscription relationship according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The core of the application is to provide an information query method, an information query device, a server and a computer readable storage medium for topic subscription relationship, so as to improve the efficiency of client information query under topic subscription relationship.
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the related technology, for the current subscription tree structure, the concurrent modification and query efficiency of a large number of topics are the greatest problems, many open source clients adopt a locking mode to modify the tree structure in a single thread mode, the query efficiency is related to the matching of the depth of the tree and the wild cards, the longer the topic is, the larger the depth of the tree is, the greater the diversity of each segmentation node of the topic is (the more wild cards of each node are matched), and the query efficiency is lower.
Therefore, the application provides an information query method of topic subscription relation, which is characterized in that a plurality of topics to be queried are obtained by decomposing a received topic request to be queried, then matching is carried out on the topics to be queried through a bloom filter, namely query is carried out, and finally a corresponding client information hash table is searched, so that the information query method of client information is realized, instead of storing the topics and the client information by adopting a tree structure, the efficiency reduction of the tree structure caused by the larger depth and width is avoided, and the efficiency of querying the client information under the topic subscription relation is improved.
The following describes an information query method for topic subscription relations provided by the application through an embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a method for querying information about topic subscription relationships according to an embodiment of the present application.
In this embodiment, the method may include:
s101, decomposing a received subject request to be queried to obtain a plurality of subjects to be queried;
the method aims at decomposing the received subject request to be queried to obtain a plurality of subjects to be queried.
The topic request to be queried refers to a topic needing to be queried on a subscription client. The subject request to be queried typically includes a single or multiple subjects to be queried. Therefore, in this step, the topic request to be queried needs to be decomposed, and then a plurality of topics to be queried are obtained.
The topics in the topic request to be queried can be connected by adopting special symbols, and the topics can be isolated in a form of a table. Thus, different topics can be separated based on different connection modes in the step.
Further, the step may include:
step 1, receiving a theme request to be queried;
and 2, decomposing the topic request to be queried through topic segmentation symbols to obtain a plurality of topics to be queried.
The present alternative is mainly to explain how to acquire the subject to be queried. In the alternative scheme, a theme request to be queried is received; and decomposing the topic request to be queried through topic segmentation symbols to obtain a plurality of topics to be queried. The topic segmentation symbol may be "/", may be "< >", or may be "[ ]". It can be seen that the specific form of the topic segmentation symbol in this embodiment is not limited, and different topics may be segmented.
S102, matching each topic to be queried through a bloom filter;
on the basis of S101, this step aims at matching each topic to be queried by means of a bloom filter.
Where the bloom filter is a very long binary vector and a series of random mapping functions, the bloom filter can be used to retrieve whether an element is in a set. Therefore, whether the theme exists, that is, whether the theme data matched with the theme exists or not can be judged directly through the bloom filter. Because the bloom filter is matched at a higher speed and higher efficiency, the efficiency of matching the theme can be improved.
Further, the length and accuracy of the bloom filter may be selected based on the actual application, and are not specifically limited herein.
Further, the step may include:
step 1, obtaining a plurality of hash functions in a bloom filter;
and 2, matching each theme to be queried through a plurality of hash functions.
It can be seen that this alternative is mainly illustrative of how the matching is performed. In this alternative, the matching is mainly performed by using a bloom filter. And obtaining a plurality of hash functions in the bloom filter, and then matching each topic to be queried through the plurality of hash functions. Wherein the hash function is a random mapping function of the bloom filter.
And S103, if the topic information is matched with the topic information corresponding to the topic to be queried, searching in a corresponding topic hash table based on the hash value of the topic information to obtain a corresponding client information hash table.
On the basis of S102, this step aims to search in a corresponding topic hash table based on the hash value of the topic information if the topic information corresponding to the topic to be queried is matched, so as to obtain a corresponding client information hash table.
Wherein the subject information is stored in a hash table, each slot of the hash table representing one subject information.
Further, the step may include:
step 1, calculating a slot position value based on a hash value of subject information to obtain a corresponding slot position value;
and step 2, determining a client information hash table corresponding to the theme information based on the theme hash table corresponding to the slot value.
It can be seen that the present alternative is mainly to explain how to find the corresponding client information hash table. In the alternative scheme, slot position value calculation is carried out based on hash values of the subject information, and corresponding slot position values are obtained; and determining a client information hash table corresponding to the theme information based on the theme hash table corresponding to the slot value.
Further, in this embodiment, when the client information hash table is obtained, the method may further include:
and returning the client information combination data based on the subject information and the content of the client information hash table.
That is, the topic information and the corresponding client information are returned as a combination, so that the information query efficiency is improved.
Further, in this embodiment, the process of generating the theme hash table may include:
step 1, calculating a hash value of the subject information, and calculating a corresponding slot position value based on the hash value;
step 2, judging whether a corresponding subject hash table exists or not based on the slot position value;
step 3, if yes, inserting new client information into the corresponding client information hash table;
and step 4, if not, a new client information hash table is established based on the topic information, and the topic information is added to the bloom filter.
It can be seen that this alternative is mainly illustrative of how new information can be added. Calculating a hash value of the subject information, and calculating a corresponding slot value based on the hash value; judging whether a corresponding subject hash table exists or not based on the slot position value; if yes, inserting new client information into the corresponding client information hash table; if not, a new client information hash table is established based on the topic information, and the topic information is added to the bloom filter.
Further, in this embodiment, the method may further include:
step 1, calculating a hash value of subject information to be deleted, and calculating a corresponding slot value based on the hash value;
step 2, judging whether a corresponding subject hash table exists or not based on the slot position value;
step 3, if yes, deleting the client information hash table corresponding to the theme hash table;
and step 4, deleting the corresponding topic information when the topic hash table does not have the corresponding subscription client.
This alternative is mainly to explain how to delete the subject information. In the alternative scheme, a hash value of the subject information to be deleted is calculated, and a corresponding slot value is calculated based on the hash value; judging whether a corresponding subject hash table exists or not based on the slot position value; if yes, deleting the client information hash table corresponding to the theme hash table; and deleting the corresponding topic information when the topic hash table does not have the corresponding subscription client.
In summary, the embodiment decomposes the received topic request to be queried to obtain a plurality of topics to be queried, then matches the topics to be queried through a bloom filter, namely queries, and finally searches the corresponding client information hash table to realize the information query method of the client information instead of storing the topics and the client information by adopting a tree structure, thereby avoiding the efficiency reduction of the tree structure caused by the larger depth and width and improving the efficiency of querying the client information under the topic subscription relation.
The information query method of the topic subscription relationship provided by the application is further described below through another specific embodiment.
In this embodiment, the requirement of fast modification and matching is achieved through a Hash (Hash) large table and a bloom filter according to the requirement of fast modification and matching under a massive subject.
The Hash table is a data structure accessed according to a key value, a function f (key) exists in a given table M, and if the function is substituted into any given key value key, the address of the key recorded in the table can be obtained, so that the query speed is increased. Bloom filters are a very long binary vector and a series of random mapping functions that can be used to retrieve whether an element is in a set, returning two structures: may or may not be present and the query efficiency is fast.
Referring to fig. 2, fig. 2 is a schematic diagram of a bloom filter in an information query method according to an embodiment of the present application.
Therefore, in this embodiment, the bloom filter may be first established, and the length and accuracy may be designed according to actual requirements. As shown in fig. 2, the bloom filter is used to check whether the subject information exists in the hash table, and the check is a preliminary check, and because of the characteristics of the bloom filter, the check may have a certain error: and checking the non-existing theme as existing, and further checking the error when the hash table is queried for the second time, wherein the theme subscription relationship is rarely changed frequently in the scene of the Internet of things, and the subscription relationship is generally established at the beginning of equipment starting, so that the probability of change is small, and the error of the bloom filter is small.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a hash of an information query method according to an embodiment of the present application.
Secondly, an array storage hash table is established, and the multi-hash table can solve the concurrency problem that the subscription relation is frequently changed, as shown in fig. 3. Calculating a hash value according to the ID of the client, taking a modulus according to the length of the array, putting the hash table into a corresponding slot, wherein the key of the hash table is a theme, the value is a client information set subscribing the theme, and the information set of the client is also a hash table, so that the client information can be conveniently and quickly queried.
Referring to fig. 4, fig. 4 is an information adding schematic diagram of an information query method according to an embodiment of the present application.
As can be seen, the process of adding topic subscription relationships is shown in fig. 4, which may include:
step 1, calculating a hash value of a theme;
step 2, calculating a slot position value according to the array length;
step 3, obtaining a theme hash table according to the slot position value;
step 4, checking whether the theme exists;
step 4.1, if the client exists, acquiring a client set and inserting new client information;
and 4.2, if the topic information does not exist, inserting topic information, creating a client information hash table, synchronously inserting, and writing the topic information by using a bloom filter.
Referring to fig. 5, fig. 5 is an information matching schematic diagram of an information query method according to an embodiment of the present application.
As can be seen, the matching topic subscription relationship flow is shown in fig. 5, and the process may include:
step 1, decomposing the topics by '/' to gather out the possibly matched topics of each layer and returning to the topic group;
step 2, matching is carried out through a bloom filter, and whether each theme exists or not is checked;
step 3, returning the existing theme information, and if all the theme information does not exist, directly returning;
step 4, traversing each piece of theme information and calculating a hash value;
step 5, obtaining a slot position value;
step 6, obtaining a hash table corresponding to the slot position, thereby obtaining client information corresponding to the theme;
and 7, returning the client information combination.
Referring to fig. 6, fig. 6 is an information deleting schematic diagram of an information query method according to an embodiment of the present application.
As can be seen, the delete topic subscription relationship flow is shown in fig. 6, and the process may include:
step 1, calculating a hash value of a theme;
step 2, calculating an operation value according to the array length;
step 3, obtaining a theme hash table according to the slot position value;
step 4, checking whether the theme exists or not, and returning directly if the theme does not exist;
step 5, obtaining the client group information of the topic subscription;
step 6, deleting the client information;
step 7, checking whether a subscribed client exists under the theme, and if so, directly returning;
and 8, deleting the subject information of the hash table and returning.
It can be seen that, in this embodiment, the received topic request to be queried is decomposed to obtain multiple topics to be queried, then the topics to be queried are matched through the bloom filter, that is, queried, and finally the corresponding client information hash table is found, so that the information query method for the client information is implemented, instead of storing the topics and the client information by adopting a tree structure, the efficiency reduction of the tree structure due to the greater depth and width is avoided, and the efficiency of querying the client information under the topic subscription relationship is improved.
The following describes the information query device of the topic subscription relationship provided by the embodiment of the present application, and the information query device of the topic subscription relationship described below and the information query method of the topic subscription relationship described above may be referred to correspondingly.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an information query apparatus for topic subscription relationship according to an embodiment of the present application.
In this embodiment, the apparatus may include:
the topic decomposition module 100 is configured to decompose the received topic request to be queried to obtain a plurality of topics to be queried;
the topic matching module 200 is configured to match each topic to be queried through a bloom filter;
the hash table searching module 300 is configured to, if the hash value of the topic information matches the topic information corresponding to the topic to be queried, search in the corresponding topic hash table based on the hash value of the topic information, and obtain a corresponding client information hash table.
Optionally, the topic decomposition module 100 is specifically configured to receive a topic request to be queried; and decomposing the topic request to be queried through topic segmentation symbols to obtain a plurality of topics to be queried.
Optionally, the topic matching module 200 is specifically configured to obtain a plurality of hash functions in the bloom filter; and matching each topic to be queried through a plurality of hash functions.
Optionally, the hash table lookup module 300 is specifically configured to perform slot value calculation based on the hash value of the subject information to obtain a corresponding slot value; and determining a client information hash table corresponding to the theme information based on the theme hash table corresponding to the slot value.
Optionally, the apparatus may further include:
and the information combination module is used for returning the client information combination data based on the subject information and the content of the client information hash table.
Optionally, the apparatus may further include:
the topic hash table generation module is used for calculating hash values of topic information and calculating corresponding slot values based on the hash values; judging whether a corresponding subject hash table exists or not based on the slot position value; if yes, inserting new client information into the corresponding client information hash table; if not, a new client information hash table is established based on the topic information, and the topic information is added to the bloom filter.
Optionally, the apparatus may further include:
the hash value deleting module is used for calculating a hash value of the subject information to be deleted and calculating a corresponding slot value based on the hash value; judging whether a corresponding subject hash table exists or not based on the slot position value; if yes, deleting the client information hash table corresponding to the theme hash table; and deleting the corresponding topic information when the topic hash table does not have the corresponding subscription client.
It can be seen that, in this embodiment, the received topic request to be queried is decomposed to obtain multiple topics to be queried, then the topics to be queried are matched through the bloom filter, that is, queried, and finally the corresponding client information hash table is found, so that the information query method for the client information is implemented, instead of storing the topics and the client information by adopting a tree structure, the efficiency reduction of the tree structure due to the greater depth and width is avoided, and the efficiency of querying the client information under the topic subscription relationship is improved.
The present application also provides a server, please refer to fig. 8, fig. 8 is a schematic structural diagram of a server provided in an embodiment of the present application, and the server may include:
a memory for storing a computer program;
and the processor is used for realizing the steps of the information inquiry method of any topic subscription relation when executing the computer program.
As shown in fig. 8, which is a schematic diagram of a composition structure of a server, the server may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all complete communication with each other through a communication bus 13.
In an embodiment of the present application, the processor 10 may be a central processing unit (Central Processing Unit, CPU), an asic, a dsp, a field programmable gate array, or other programmable logic device, etc.
Processor 10 may call a program stored in memory 11, and in particular, processor 10 may perform operations in an embodiment of an abnormal IP identification method.
The memory 11 is used for storing one or more programs, and the programs may include program codes including computer operation instructions, and in the embodiment of the present application, at least the programs for implementing the following functions are stored in the memory 11:
decomposing the received subject request to be queried to obtain a plurality of subjects to be queried;
matching each topic to be queried through a bloom filter;
and if the topic information is matched with the topic information corresponding to the topic to be queried, searching in a corresponding topic hash table based on the hash value of the topic information to obtain a corresponding client information hash table.
In one possible implementation, the memory 11 may include a storage program area and a storage data area, where the storage program area may store an operating system, and at least one application program required for functions, etc.; the storage data area may store data created during use.
In addition, the memory 11 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device or other volatile solid-state storage device.
The communication interface 12 may be an interface of a communication module for interfacing with other devices or systems.
Of course, it should be noted that the structure shown in fig. 8 is not limited to the server in the embodiment of the present application, and the server may include more or less components than those shown in fig. 8, or may combine some components in practical applications.
It can be seen that, in this embodiment, the received topic request to be queried is decomposed to obtain multiple topics to be queried, then the topics to be queried are matched through the bloom filter, that is, queried, and finally the corresponding client information hash table is found, so that the information query method for the client information is implemented, instead of storing the topics and the client information by adopting a tree structure, the efficiency reduction of the tree structure due to the greater depth and width is avoided, and the efficiency of querying the client information under the topic subscription relationship is improved.
The application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program can realize the steps of the information inquiry method of any topic subscription relation when being executed by a processor.
The computer readable storage medium may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
For the description of the computer-readable storage medium provided by the present application, refer to the above method embodiments, and the disclosure is not repeated here.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The information query method, the information query device, the server and the computer readable storage medium for topic subscription relation provided by the application are described in detail above. The principles and embodiments of the present application have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present application and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the application can be made without departing from the principles of the application and these modifications and adaptations are intended to be within the scope of the application as defined in the following claims.
Claims (10)
1. The information query method of the topic subscription relation is characterized by comprising the following steps:
decomposing the received subject request to be queried to obtain a plurality of subjects to be queried;
matching each topic to be queried through a bloom filter;
and if the topic information is matched with the topic information corresponding to the topic to be queried, searching in a corresponding topic hash table based on the hash value of the topic information to obtain a corresponding client information hash table.
2. The information query method of claim 1, wherein decomposing the received topic request to be queried to obtain a plurality of topics to be queried comprises:
receiving the subject request to be queried;
and decomposing the topic request to be queried through topic segmentation symbols to obtain the multiple topics to be queried.
3. The information query method of claim 1, wherein matching each of the topics to be queried by a bloom filter comprises:
acquiring a plurality of hash functions in the bloom filter;
and matching each topic to be queried through the plurality of hash functions.
4. The information query method of claim 1, wherein searching in the corresponding subject hash table based on the hash value of the subject information to obtain the corresponding client information hash table comprises:
performing slot position value calculation based on the hash value of the subject information to obtain a corresponding slot position value;
and determining a client information hash table corresponding to the theme information based on the theme hash table corresponding to the slot value.
5. The information query method of claim 1, wherein when the client information hash table is obtained, further comprising:
and returning client information combination data based on the subject information and the content of the client information hash table.
6. The information query method of claim 1, wherein the process of generating the subject hash table comprises:
calculating a hash value of the subject information, and calculating a corresponding slot value based on the hash value;
judging whether a corresponding subject hash table exists or not based on the slot position value;
if yes, inserting new client information into the corresponding client information hash table;
if not, a new client information hash table is established based on the topic information, and the topic information is added to the bloom filter.
7. The information query method of claim 1, further comprising:
calculating a hash value of the subject information to be deleted, and calculating a corresponding slot value based on the hash value;
judging whether a corresponding subject hash table exists or not based on the slot position value;
if yes, deleting the client information hash table corresponding to the theme hash table;
and deleting the corresponding topic information when the topic hash table does not have the corresponding subscription client.
8. An information query apparatus for topic subscription relationships, comprising:
the topic decomposition module is used for decomposing the received topic request to be queried to obtain a plurality of topics to be queried;
the topic matching module is used for matching each topic to be queried through a bloom filter;
and the hash table searching module is used for searching in the corresponding topic hash table based on the hash value of the topic information if the topic information corresponding to the topic to be queried is matched, so as to obtain the corresponding client information hash table.
9. A server, comprising:
a memory for storing a computer program;
processor for implementing the steps of the information query method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the information query method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310710584.0A CN116627989A (en) | 2023-06-15 | 2023-06-15 | Information query method and related device for topic subscription relation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310710584.0A CN116627989A (en) | 2023-06-15 | 2023-06-15 | Information query method and related device for topic subscription relation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116627989A true CN116627989A (en) | 2023-08-22 |
Family
ID=87638199
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310710584.0A Pending CN116627989A (en) | 2023-06-15 | 2023-06-15 | Information query method and related device for topic subscription relation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116627989A (en) |
-
2023
- 2023-06-15 CN CN202310710584.0A patent/CN116627989A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6754799B2 (en) | System and method for indexing and retrieving cached objects | |
US6952730B1 (en) | System and method for efficient filtering of data set addresses in a web crawler | |
US7523171B2 (en) | Multidimensional hashed tree based URL matching engine using progressive hashing | |
US7277885B2 (en) | Systems and methods for filter processing using hierarchical data and data structures | |
US9935919B2 (en) | Directory partitioned system and method | |
US8892677B1 (en) | Manipulating objects in hosted storage | |
US20070244920A1 (en) | Hash-Based Access To Resources in a Data Processing Network | |
US8041893B1 (en) | System and method for managing large filesystem-based caches | |
US7676553B1 (en) | Incremental web crawler using chunks | |
US9928178B1 (en) | Memory-efficient management of computer network resources | |
CN108228799B (en) | Object index information storage method and device | |
US8521696B2 (en) | Structure of an alternative evaluator for directory operations | |
CN110929194B (en) | Abstract algorithm-based static resource file cache control method and system | |
US10552411B2 (en) | Email service adapter | |
CN105227386B (en) | For dividing the method, apparatus and system of population statistics online user number | |
CN113672624A (en) | Data processing method, system and storage medium | |
JP2007109237A (en) | Data retrieval system, method and program | |
CN116627989A (en) | Information query method and related device for topic subscription relation | |
CN107092529B (en) | OLAP service method, device and system | |
CN115827280A (en) | Message processing method and device, electronic equipment and storage medium | |
US20030115202A1 (en) | System and method for processing a request using multiple database units | |
CN115935101A (en) | Data processing method about MQTT-Topic | |
CN113839940A (en) | URL pattern tree-based defense method and device, electronic equipment and readable storage medium | |
US11055266B2 (en) | Efficient key data store entry traversal and result generation | |
US8583596B2 (en) | Multi-master referential integrity |
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 |