CONTENT FILTERING METHOD SUPPORTING HYBRID STORAGE SYSTEM
20210182215 ยท 2021-06-17
Assignee
- INSTITUTE OF ACOUSTICS, CHINESE ACADEMY OF SCIENCES (Beijing, CN)
- BEIJING HILI TECHNOLOGY CO. LTD (Beijing, CN)
Inventors
Cpc classification
G06F3/0659
PHYSICS
G06F12/123
PHYSICS
H04L67/5682
ELECTRICITY
H04L67/63
ELECTRICITY
International classification
Abstract
A supported lightweight content filtering method for a hybrid storage system, the method includes: using an LRU queue and a Hash table to filter content, the access frequency of which is lower than a specified threshold (T), the time complexity being O(1). An LRU queue and a Hash table are used to support a quick content filtering method applicable to a hybrid storage system to filter content, the number of times same is accessed being lower than a specified threshold, and to use scarce storage resources to cache hot content that will be frequently accessed, thus improving a cache hit ratio.
Claims
1. A content filtering method, comprising the following steps: determining, by a hybrid storage system, a first message; calculating, by the hybrid storage system, a corresponding hash value according to the first message; and determining, by the hybrid storage system, information of the first message according to the hash value and a least recently used (LRU) queue.
2. The method according to claim 1, wherein the first message comprises: an interest message and a content message.
3. The method according to claim 2, wherein when the first message is an interest message, calculating, by the hybrid storage system, a corresponding hash value according to the first message comprises: calculating, by the hybrid storage system, a corresponding first hash value H.sub.insert according to the interest message.
4. The method according to claim 3, wherein determining, by the hybrid storage system, information of the first message according to the hash value and LRU queue comprises: when the hybrid storage system determines that the LRU queue is full, replacing a second hash value H.sub.replace of an element indexed by tail in the LRU queue with the H.sub.insert; decreasing, by the hybrid storage system, the number of request times recorded in a hash table by one according to the H.sub.replace, the hash table being used for recording the number of content requests; and increasing, by the hybrid storage system, the number of request times recorded by the hash table by one according to the H.sub.insert, and determining the head of the LRU queue according to the tail element.
5. The method according to claim 4, wherein increasing the number of request times recorded by the hash table by one according to the H.sub.insert, and determining the head of the LRU queue according to the tail element comprises: traversing, by the hybrid storage system, buckets of the hash table according to the H.sub.insert to determine a matched first entry.
6. The method according to claim 5, wherein traversing buckets of the hash table according to the H.sub.insert to determine a matched first entry comprises: reading, by the hybrid storage system, a first field in the first entry; if the first field is 1, determining whether a hash value recorded in the first entry is equal to a matched one through comparison; if so, returning the hash value recorded in the first entry; and if not, matching a second entry of the buckets of the hash table.
7. The method according to claim 2, wherein when the first message is a content message, calculating, by the hybrid storage system, a corresponding hash value according to the first message comprises: calculating, by the hybrid storage system, a corresponding third hash value H.sub.lookup according to the content message.
8. The method according to claim 7, wherein determining, by the hybrid storage system, information of the first message according to the hash value and LRU queue comprises: traversing, by the hybrid storage system, buckets of the hash table according to the H.sub.lookup to determine a matched third entry; comparing, by the hybrid storage system, the number of request times in the third entry with a preset threshold to determine information of the first message.
9. The method according to claim 8, wherein comparing, by the hybrid storage system, the number of request times in the third entry with a preset threshold to determine information of the first message comprises: if the number of request times in the third entry is greater than or equal to the preset threshold, caching the content message in the hybrid storage system, and then forwarding the content message from an ingress port of the interest message; and if the number of request times in the third entry is less than the preset threshold, forwarding the content message from the ingress port of the interest message.
10. The method according to claim 1, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
11. The method according to claim 2, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
12. The method according to claim 3, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
13. The method according to claim 4, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
14. The method according to claim 5, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
15. The method according to claim 6, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
16. The method according to claim 7, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
17. The method according to claim 8, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
18. The method according to claim 9, wherein each element in the LRU queue comprises: an index of the previous element, an index of the next element, and one or more of the hash values.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0032]
[0033]
[0034]
[0035]
[0036]
DETAILED DESCRIPTION OF THE EMBODIMENTS
[0037] Technical solutions of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments.
[0038]
[0039] S110: determining, by a hybrid storage system, a first message;
[0040] wherein specifically, the first message includes: an interest message and a content message;
[0041] S120: calculating, by the hybrid storage system, a corresponding hash value according to the first message;
[0042] specifically, when the first message is an interest message, calculating, by the hybrid storage system a corresponding first hash value H.sub.insert according to the interest message; and
[0043] when the first message is a content message, calculating, by the hybrid storage system, a corresponding third hash value H.sub.lookup according to the content message; and
[0044] S130: determining, by the hybrid storage system, information of the first message according to the hash value and a least recently used (LRU) queue;
[0045] specifically, if the first message is an interest message, when the hybrid storage system determines that the LRU queue is full, replacing a hash value, which is denoted as H.sub.replace, of an element indexed by tail in the LRU queue with the H.sub.insert; and at the same time, transversing buckets of the hash table according to the H.sub.replace to find a matched first entry, and decreasing the number of request times recorded in the first entry by one, wherein a hash table is used for recording the number of content requests; transversing buckets of the hash table according to the H.sub.insert to find a matched entry, and increasing the corresponding number of request times by one, and at the same time, setting the index of the element as the head of the LRU;
[0046] wherein transversing buckets of the hash table according to the H.sub.insert to find a matched first entry may include: reading, by the hybrid storage system, a first field in the first entry; if the first field is 1, determining whether a hash value recorded in the first entry is equal to a matched one through comparison; if so, returning the hash value recorded in the first entry; and if not, matching a second entry of the buckets of the hash table; and
[0047] when the first message is a content message, traversing, by the hybrid storage system, buckets of the hash table according to the H.sub.lookup to determine a matched third entry; and comparing, by the hybrid storage system, the number of request times in the third entry with a preset threshold to determine information of the first message;
[0048] wherein comparing, by the hybrid storage system, the number of request times in the third entry with a preset threshold to determine information of the first message includes: if the number of request times in the third entry is greater than or equal to the preset threshold, caching the content message in the hybrid storage system, and then forwarding the content message from an ingress port of the interest message; and if the number of request times in the third entry is less than the preset threshold, forwarding the content message from the ingress port of the interest message.
[0049] Each element in the LRU queue includes one or more of: an index of the previous element, an index of the next element, and the hash value.
[0050] The aforementioned hybrid storage system may be a storage system composed of a DRAM and an SSD. The LRU queue is used for recording interest message information. The hash table is used to record the number of content requests. Specifically, the size of each Entry in the hash table is 8 bytes, wherein 1 byte indicates whether the Entry is occupied, 1 byte is reserved, 2 bytes are used to record the number of request times for a content object, and 4 bytes are used to record a hash value of the requested content object.
[0051]
[0052]
[0053]
[0054]
[0055] The first message may include: an interest message and a content message.
[0056] When the first message is an interest message, the processing module may be specifically configured to replace a second hash value Hreplace of an element indexed by tail in the LRU queue with the Hinser if the LRU queue determined to be full; decrease the number of request times recorded in a hash table by one according to the Hreplace, the hash table being used for recording the number of content requests; and increase the number of request times recorded by the hash table by one according to the Hinsert, and determine the head of the LRU queue according to the tail element.
[0057] The processing module may be specifically configured to traverse buckets of the hash table according to the Hinsert to determine a matched first entry.
[0058] The processing module may be specifically configured to read a first field in the first entry; if the first field is 1, determine whether a hash value recorded in the first entry is equal to a matched one through comparison; if so, return the hash value recorded in the first entry; and if not, match a second entry of the buckets of the hash table.
[0059] When the first message is a content message, the processing module may be specifically configured to calculate a corresponding third hash value Hlookup according to the content message.
[0060] The processing module may be specifically configured to traverse buckets of the hash table according to the Hlookup to determine a matched third entry; and compare the number of request times in the third entry with a preset threshold to determine information of the first message.
[0061] The processing module may be specifically configured to: if the number of request times in the third entry is greater than or equal to the preset threshold, cache the content message in the hybrid storage system, and then forward the content message from an ingress port of the interest message; and if the number of request times in the third entry is less than the preset threshold, forward the content message from the ingress port of the interest message.
[0062] Each element in the LRU queue includes one or more of: an index of the previous element, an index of the next element, and the hash value.
[0063] The present invention provides a lightweight content filtering method supporting a hybrid storage system, to filter content the number of access times of which is below a specified threshold, decrease the number of SSD writes, and improve a cache hit rate of the hybrid storage system. The hybrid storage system can meet the requirements of high capacity and high line speed. Physical characteristics of the SSD determine its limited number of writes. Therefore, decreasing the number of SSD writes can effectively increase the life of the SSD and improve the stability of the hybrid storage system. In addition, as the time complexity of insert and delete operations of the least recently used (LRU) queue is O(1), the size of each bucket of the Hash table is aligned with a CPU cache line, which may guarantee that the entire bucket can be placed in the CPU cache by one read operation, and thus the traversal of the hash table only requires one memory access operation, thus greatly reducing latency caused by memory reads.
[0064] Those of ordinary skill in the art can further appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination thereof. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example are described generally in terms of functions in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to go beyond the scope of the present application.
[0065] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented by hardware, a software module executed by a processor, or a combination thereof. The software module may be placed in a random access memory (RAM), an internal memory, a read-only memory (ROM), an electrically programmable (ROM), an electrically erasable programmable (ROM), a register, a hard disk, a removable disk, a CD-ROM, or a storage medium in any other form known in the technical field.
[0066] The foregoing specific embodiments further describe the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that described above are only specific embodiments of the present invention, which are not intended to limit the protection scope of the present invention, and all modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be encompassed within the protection scope of the present invention.