P
US10133679B2ActiveUtilityPatentIndex 35

Read cache management method and apparatus based on solid state drive

Assignee: HUAWEI TECH CO LTDPriority: Dec 30, 2014Filed: Jun 29, 2017Granted: Nov 20, 2018
Est. expiryDec 30, 2034(~8.5 yrs left)· nominal 20-yr term from priority
Inventors:CHAI YUNPENGSUN DONGWANG
G06F 12/0871G06F 2212/313G06F 12/0868G06F 2212/222G06F 12/0684G06F 12/0246G06F 12/127G06F 12/126G06F 12/0804G06F 12/06G06F 12/123G06F 2212/1036
35
PatentIndex Score
0
Cited by
17
References
14
Claims

Abstract

A read cache management method and apparatus based on a solid state drive, and the method includes: determining whether a read request hits a first queue and a second queue (S101); if both the first queue and the second queue are missed, selecting and deleting an eliminated data block from the first queue (S102); if the eliminated data block is in a stored state, inserting the eliminated data block into the second queue (S103); and determining a target data block in a lower-level storage medium, and inserting the target data block into the first queue, (S104). According to the foregoing read cache management method and apparatus based on the solid state drive, a hit ratio of the solid state drive can be increased, a data write count of the solid state drive can be reduced, and service life of the solid state drive can be extended.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A read cache management method based on a solid state drive, wherein the solid state drive (SSD) comprises a first queue and a second queue, and the method comprises:
 receiving a read request, and determining whether the read request hits the first queue and the second queue; 
 if both the first queue and the second queue are missed, selecting and deleting an eliminated data block from the first queue according to a cache replacement algorithm; 
 if the eliminated data block is in a stored state, inserting the eliminated data block into the second queue; and 
 determining a target data block corresponding to the read request in a lower-level storage medium, and inserting the target data block into the first queue, wherein the target data block is in a non-stored state. 
 
     
     
       2. The method according to  claim 1 , further comprising:
 if the eliminated data block is in the non-stored state, deleting the eliminated data block from the first queue, and deleting the eliminated data block from the SSD. 
 
     
     
       3. The method according to  claim 1 , further comprising:
 if the read request misses the first queue, but hits the second queue, deleting, from the second queue, a hit data block corresponding to the read request; and 
 inserting the hit data block into the first queue. 
 
     
     
       4. The method according to  claim 2 , further comprising:
 calculating an idle time of a to-be-processed data block in the second queue, wherein the to-be-processed data block is any one of data blocks in the second queue; 
 when non-accessed duration of the to-be-processed data block is greater than the idle time of the to-be-processed data block, deleting the to-be-processed data block from the second queue; and 
 obtaining an identity of the to-be-processed data block, and inserting the identity of the to-be-processed data block into a third queue. 
 
     
     
       5. The method according to  claim 4 , wherein the calculating an idle time of a to-be-processed data block in the second queue comprises:
 collecting statistics on hit count M of the to-be-processed data block in the first queue and hit count N of the to-be-processed data block in the second queue, wherein M and N are integers greater than 0; and 
 calculating the idle time of the to-be-processed data block according to the hit count M and the hit count N. 
 
     
     
       6. The method according to  claim 3 , wherein the inserting the eliminated data block into the second queue comprises:
 obtaining identity information of the eliminated data block; and 
 if the identity information of the eliminated data block is not in a third queue, inserting the eliminated data block into the second queue; or 
 if the identity information of the eliminated data block is in the third queue, determining whether elimination duration of the eliminated data block is greater than a preset time threshold; and if the elimination duration of the eliminated data block is greater than the preset time threshold, inserting the eliminated data block into the second queue. 
 
     
     
       7. The method according to  claim 1 , wherein after the deleting the to-be-processed data block from the second queue when non-accessed duration of the to-be-processed data block is greater than the idle time of the to-be-processed data block, the method further comprises:
 searching the first queue for the first data block in the non-stored state; and 
 writing the first data block in the non-stored state into the SSD, and setting the data block to the stored state after a write operation is completed; or 
 determining the first K data blocks that are in the non-stored state and that are in the first queue, wherein K is an integer greater than 0; and 
 writing a data block that has a maximum access count and that is in the K data blocks into the SSD, and setting the data block that has the maximum access count to the stored state after a write operation is completed. 
 
     
     
       8. A read cache management apparatus based on a solid state drive, wherein the SSD comprises a first queue and a second queue, and the apparatus comprises:
 a processor and a non-transitory computer-readable medium having processor-executable instructions stored thereon, wherein the processor-executable instructions, when executed by the processor, facilitate performance of the following: 
 receive a read request, and determine whether the read request hits the first queue and the second queue; 
 if both the first queue and the second queue are missed, select and delete an eliminated data block from the first queue according to a cache replacement algorithm; 
 if the eliminated data block is in a stored state, insert the eliminated data block into the second queue; and 
 determine a target data block corresponding to the read request in a lower-level storage medium, and insert the target data block into the first queue, wherein the target data block is in a non-stored state. 
 
     
     
       9. The apparatus according to  claim 8 , wherein the processor-executable instructions, when executed, are further configured to facilitate:
 if the eliminated data block is in the non-stored state, delete the eliminated data block from the first queue, and delete the eliminated data block from the SSD. 
 
     
     
       10. The apparatus according to  claim 9 , wherein the processor-executable instructions, when executed, are further configured to facilitate:
 if the read request misses the first queue, but hits the second queue, delete, from the second queue, a hit data block corresponding to the read request; and 
 insert the hit data block into the first queue. 
 
     
     
       11. The apparatus according to  claim 9 , wherein the processor-executable instructions, when executed, are further configured to facilitate:
 calculate an idle time of a to-be-processed data block in the second queue, wherein the to-be-processed data block is any one of data blocks in the second queue; 
 when non-accessed duration of the to-be-processed data block is greater than the idle time of the to-be-processed data block, delete the to-be-processed data block from the second queue; and 
 obtain an identity of the to-be-processed data block, and insert the identity of the to-be-processed data block into a third queue. 
 
     
     
       12. The apparatus according to  claim 11 , wherein the processor-executable instructions, when executed, are configured to facilitate:
 a statistics collecting unit, configured to collect statistics on hit count M of the to-be-processed data block in the first queue and hit count N of the to-be-processed data block in the second queue, wherein M and N are integers greater than 0; and 
 a calculation unit, configured to calculate the idle time of the to-be-processed data block according to the hit count M and the hit count N. 
 
     
     
       13. The apparatus according to  claim 10 , wherein the processor-executable instructions, when executed, are configured to facilitate:
 obtain identity information of the eliminated data block; and 
 if the identity information of the eliminated data block is not in a third queue, insert the eliminated data block into the second queue; or 
 if the identity information of the eliminated data block is in the third queue, determine whether elimination duration of the eliminated data block is greater than a preset time threshold; and if the elimination duration of the eliminated data block is greater than the preset time threshold, insert the eliminated data block into the second queue. 
 
     
     
       14. The apparatus according to  claim 8 , wherein the processor-executable instructions, when executed, are further configured to facilitate:
 search the first queue for the first data block in the non-stored state; and 
 write the first data block in the non-stored state into the SSD, and set the data block to the stored state after a write operation is completed; or 
 determine the first K data blocks that are in the non-stored state and that are in the first queue, wherein K is an integer greater than 0; and 
 write a data block that has a maximum access count and that is in the K data blocks into the SSD, and set the data block that has the maximum access count to the stored state after write operation is completed.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.