This application claims priority of Chinese patent application No. 201711375346.X filed on Dec. 19, 2017, entitled “Content Filtering Method Supporting Hybrid Storage System”, which is hereby incorporated by reference.
The present invention relates to the technical field of information centric networking, and in particular, to a lightweight content filtering method supporting a hybrid storage system.
In the field of information centric networking (ICN), a single storage medium often cannot meet the requirements of high-speed forwarding and terabyte (TB) level caching at the same time. For example, a dynamic random access memory (DRAM) currently meeting O (10 Gbps) can only provide O (10 GB) storage space, while a solid state drive (SSD) that can provide TB level storage space cannot meet the requirement of O (10 Gbps) line speed.
In addition, a typical load request characteristic at present is that most of content may be accessed only once in a long period time. For example, analysis on the URL access log of Wikipedia on Sep. 20, 2007 shows that 63% of the content was requested only once. Further, although hybrid storage provides more storage space, it still seems insignificant as compared with the huge content space in the network. Storing the content that may be accessed only once wastes valuable storage space, and furthermore, the cache hit rate cannot be improved. At the same time, processing of the less requested content may also increase the processing pressure of an ICN router.
An objective of the present invention is to filter content the number of access times of which is below a specified threshold, and use scarce storage resources to cache hot content that may be frequently accessed, thus improving the cache hit rate.
To achieve the aforementioned objective, in an aspect, the present invention provides a lightweight content filtering method supporting a hybrid storage system, specifically including: determining, by a hybrid storage system, a first message; calculating a corresponding hash value according to the first message; and determining information of the first message according to the hash value and a least recently used (LRU) queue.
In an optional implementation, the aforementioned “first message” may include: an interest message and a content message.
In another optional implementation, when the aforementioned “first message” is an interest message, the aforementioned “calculating, by the hybrid storage system, a corresponding hash value according to the first message” may include: calculating, by the hybrid storage system a corresponding first hash value Hinsert according to the interest message.
In yet another optional implementation, the aforementioned “determining, by the hybrid storage system, information of the first message according to the hash value and a least recently used (LRU) queue” includes:
when the hybrid storage system determines that the LRU queue is full, replacing a second hash value Hreplace of an element indexed by tail in the LRU queue with the Hinsert; decreasing, by the hybrid storage system, 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 increasing, by the hybrid storage system, the number of request times recorded by the hash table by one according to the Hinsert, and determining the head of the LRU queue according to the tail element.
In still yet another optional implementation, the aforementioned “increasing the number of request times recorded by the hash table by one according to the Hinsert, and determining the head of the LRU queue according to the tail element” may include:
traversing, by the hybrid storage system, buckets of the hash table according to the Hinsert to determine a matched first entry.
In still yet another optional implementation, the aforementioned “traversing buckets of the hash table according to the Hinsert to determine a matched first entry” may include:
reading 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.
In still yet another optional implementation, when the aforementioned “first message” is a content message, the aforementioned “calculating, by the hybrid storage system, a corresponding hash value according to the first message” may include:
calculating, by the hybrid storage system, a corresponding third hash value Hlookup according to the content message.
In still yet another optional implementation, the aforementioned “determining, by the hybrid storage system, information of the first message according to the hash value and a least recently used (LRU) queue” may include:
traversing, by the hybrid storage system, buckets of the hash table according to the Hlookup 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.
In still yet another optional implementation, the aforementioned “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” may include:
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.
In still yet another optional implementation, each element in the aforementioned “LRU queue” includes one or more of: an index of the previous element, an index of the next element, and the hash value.
In another aspect, the present invention provides a supported hybrid storage system, specifically including a receiving module configured to determine a first message; and a processing module configured to calculate a corresponding hash value according to the first message. The processing module is further configured to determining, by the hybrid storage system, information of the first message according to the hash value and a least recently used (LRU) queue.
In an optional implementation, the aforementioned “first message” may include: an interest message and a content message.
In another optional implementation, when the first message is an interest message, the aforementioned “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 Hinsert 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.
In yet another optional implementation, the aforementioned “processing module” may be specifically configured to traverse buckets of the hash table according to the Hinsert to determine a matched first entry.
In still yet another optional implementation, the aforementioned “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.
In still yet another optional implementation, when the first message is a content message, the aforementioned “processing module” may be specifically configured to calculate a corresponding third hash value Hlookup according to the content message.
In still yet another optional implementation, the aforementioned “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.
In still yet another optional implementation, the aforementioned “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.
In still yet another optional implementation, each element in the aforementioned “LRU queue” includes one or more of: an index of the previous element, an index of the next element, and the hash value.
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.
Technical solutions of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments.
S110: determining, by a hybrid storage system, a first message;
wherein specifically, the first message includes: an interest message and a content message;
S120: calculating, by the hybrid storage system, a corresponding hash value according to the first message;
specifically, when the first message is an interest message, calculating, by the hybrid storage system a corresponding first hash value Hinsert according to the interest message; and
when the first message is a content message, calculating, by the hybrid storage system, a corresponding third hash value Hlookup according to the content message; and
S130: determining, by the hybrid storage system, information of the first message according to the hash value and a least recently used (LRU) queue;
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 Hreplace, of an element indexed by tail in the LRU queue with the Hinsert; and at the same time, transversing buckets of the hash table according to the Hreplace 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 Hinsert 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;
wherein transversing buckets of the hash table according to the Hinsert 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
when the first message is a content message, traversing, by the hybrid storage system, buckets of the hash table according to the Hlookup 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;
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.
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.
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.
The first message may include: an interest message and a content message.
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.
The processing module may be specifically configured to traverse buckets of the hash table according to the Hinsert to determine a matched first entry.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Number | Date | Country | Kind |
---|---|---|---|
201711375346.X | Dec 2017 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2018/121491 | 12/17/2018 | WO | 00 |