Data migration method and device, computer equipment, readable storage medium and program product
By setting an index information queue in the solid-state drive, hot data and cold data are judged based on the access frequency, the residence time of hot data in the solid-state drive is extended, and the response speed reduction caused by weak mechanical disk performance is solved, and the overall performance of the CDN cache system is improved.
Patent Information
- Application Number
- CN202510899751.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-08-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing CDN cache systems, the performance of mechanical disks is weak, especially during peak business periods, which leads to a decrease in response speed and affects service quality.
By setting an index information queue in the solid-state drive, the hot data and cold data are judged based on the access frequency of the cached data, the hot data retention time in the solid-state drive is extended, and the dependence on the mechanical disk is reduced.
It improves the response speed of cached data, reduces the load on the mechanical disk, and improves the overall performance of the system.
Smart Images

Figure CN120407545A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of cache storage, and particularly to a data migration method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] A Content Delivery Network (CDN) is a distributed server network designed to cache content at edge nodes around the world, enabling users to obtain data from the nearest server, thereby reducing latency, improving access speed, and alleviating the load on the origin server.
[0003] Currently, the proxy and cache server (Apache Traffic server, ATS) components of CDN caching are divided into two levels in the disk cache writing part. One level is the mechanical disk with slower read and write speeds, and the other level is the solid-state drive (SSD) disk with better read and write performance. When caching is written to the disk, it is first written to the mechanical disk. When the request popularity reaches a threshold, the cached resources are migrated to the SSD disk. For the cache of the SSD disk, it is written in sequence. When the disk is full, it starts overwriting from the beginning of the disk. In this way, when the overwritten data is accessed again, it needs to be read from the mechanical disk again and then migrated to the SSD disk after the resource access times reach the threshold.
[0004] However, due to the weak performance of the mechanical disk, especially during peak business hours when the mechanical disk has a high load, rereading from the mechanical disk will lead to a decline in service quality and reduce the response speed of cached data. Summary of the Invention
[0005] Based on this, it is necessary to provide a data migration method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the response speed for the above technical problems.
[0006] In a first aspect, this application provides a data migration method, the method including:
[0007] When the storage capacity of the queue reaches the upper limit, the cached data corresponding to the index information stored at the head of the queue is used as the data to be deleted; wherein, the queue is used to record the index information of the cached data and the access frequency corresponding to the index information; the storage capacity of the queue is determined based on the cache capacity of the solid-state drive;
[0008] In the case where the access frequency of the data to be deleted is greater than or equal to the first frequency threshold, the index information of the data to be deleted is added to the tail of the queue;
[0009] When the data to be deleted is located in the first area of the solid-state drive, write the data to be deleted into the second area of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue; wherein, the first area is the area to be overwritten; the second area is the area outside the area to be overwritten.
[0010] In one embodiment, after adding the index information of the data to be deleted to the tail of the queue, the method further includes:
[0011] Configure the access frequency of the data to be deleted to a first target value; wherein, the first target value is a positive integer determined based on the first frequency threshold;
[0012] When the data to be deleted is not located in the first area of the solid-state drive, wait to access the data to be deleted, and obtain the current access frequency of the data to be deleted, where the current access frequency is the first target value plus 1;
[0013] When the index information of the data to be deleted is again located at the head of the queue, obtain the latest current access frequency of the data to be deleted; the latest current access frequency is determined based on the current access frequency and is less than or equal to the upper limit of the preset frequency;
[0014] When the storage capacity of the queue reaches the upper limit, repeatedly execute the step of adding the index information of the data to be deleted to the tail of the queue; when the data to be deleted is located in the first area of the solid-state drive, write the data to be deleted into the second area of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue.
[0015] In one embodiment, the method further includes:
[0016] Read the current cached data from the solid-state drive. When the current cached data is located in the first area of the solid-state drive, query the access frequency corresponding to the index information of the current cached data from the queue, and add the index information of the current cached data to the tail of the queue;
[0017] When the access frequency of the current cached data is in the low-frequency section and the access frequency of the current cached data is greater than or equal to the second frequency threshold, write the current cached data into the second area of the solid-state drive, and delete the index information of the current cached data added to the tail of the queue; the first frequency threshold is greater than the second frequency threshold.
[0018] In one embodiment, after adding the index information of the current cached data to the tail of the queue, the method further includes:
[0019] Configuring the access frequency of the current cached data to a first target value; wherein, the first target value is a positive integer determined based on the first frequency threshold;
[0020] When the access frequency of the current cached data is in the high-frequency section and the access frequency of the current cached data is less than the first frequency threshold, wait to access the current cached data, and add the index information of the current cached data to the tail of the queue again; until the new access frequency of the current cached data is greater than or equal to the first frequency threshold, repeat the steps of writing the current cached data to the second area of the solid-state drive and deleting the index information of the current cached data added to the tail of the queue; the new access frequency is determined based on the first target value, and the value of the new access frequency is less than or equal to the upper limit of the preset frequency.
[0021] In one embodiment, before, when the storage capacity of the queue reaches the upper limit, the cached data corresponding to the index information stored at the head of the queue is used as the data to be deleted, further includes:
[0022] Obtaining new cached data and the index information corresponding to the new cached data;
[0023] When the index information corresponding to the new cached data exists and the new cached data is in the first state, deleting the index information stored at the head of the queue, adding the index information corresponding to the new cached data to the tail of the queue, and configuring the access frequency of the new cached data to a second target value; wherein, the second target value is an integer less than the first target value, and the first state includes data conflict or data update.
[0024] In one embodiment, the method further includes:
[0025] When the index information corresponding to the new cached data exists and the new cached data is not in the first state, adding 1 to the access frequency of the new cached data to obtain an updated access frequency; the value of the updated access frequency is less than or equal to the upper limit of the preset frequency;
[0026] When the updated access frequency is in the high-frequency section, comparing the updated access frequency with the first frequency threshold, and when the updated access frequency is greater than the first frequency threshold, adding the index information corresponding to the new cached data to the tail of the queue and configuring the access frequency of the new cached data to the first target value;
[0027] When the updated access frequency is in the low-frequency range, compare the updated access frequency with a second frequency threshold. When the updated access frequency is greater than the second frequency threshold, add the index information corresponding to the new cached data to the tail of the queue, and configure the access frequency of the new cached data to a first target value.
[0028] In a second aspect, the present application further provides a data migration device, which includes:
[0029] A determination module, configured to, when the storage capacity of the queue reaches the upper limit, use the cached data corresponding to the index information stored at the head of the queue as the data to be deleted; wherein, the queue is used to record the index information of the cached data and the access frequency corresponding to the index information; the storage capacity of the queue is determined based on the cache capacity of the solid-state drive;
[0030] An addition module, configured to, when the access frequency of the data to be deleted is greater than or equal to a first frequency threshold, add the index information of the data to be deleted to the tail of the queue;
[0031] A migration module, configured to, when the data to be deleted is in a first area of the solid-state drive, write the data to be deleted into a second area of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue; wherein, the first area is the area to be overwritten; the second area is the area outside the area to be overwritten.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the above method are implemented.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0034] In a fifth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0035] The above data migration method, device, computer equipment, computer-readable storage medium, and computer program product add an index information queue for recording cache data and an access frequency queue according to the cache capacity of the solid-state drive (SSD); when the queue reaches the upper limit, determine the data to be deleted, and at the same time, judge the access frequency of the data to be deleted and the first frequency threshold, as well as the area stored in the SSD corresponding to the data to be deleted. If the access frequency of the data to be deleted is greater than the first frequency threshold, add the index information of the data to be deleted to the tail of the queue; and if the deleted data is located in the area to be overwritten, it indicates that the data to be deleted is hot data that should not be overwritten. On the one hand, add the index information of the data to be deleted to the tail of the first-in, first-out queue so that the data to be deleted can be judged again when the queue reaches the upper limit next time; on the other hand, write the data to be deleted into the area of the SSD other than the area to be overwritten, and delete the index information of the data to be deleted added to the tail of the queue to make room for the queue to store data. By adding an index information queue for recording cache data and an access frequency queue, and through the records in the queue and the position of the data to be deleted in the SSD, the retention time of hot data in the SSD is extended, the dependence on and load of the mechanical disk are reduced, and thus the response speed is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0037] Figure 1 It is a schematic flowchart of the data migration method in one embodiment;
[0038] Figure 2 It is a schematic flowchart of the data migration method in another embodiment;
[0039] Figure 3 It is a schematic flowchart of the processing of the data to be deleted without data migration in one embodiment;
[0040] Figure 4 It is a schematic flowchart of migrating the current cache data in one embodiment;
[0041] Figure 5 It is a schematic flowchart of the processing of the current cache data without data migration in one embodiment;
[0042] Figure 6 It is a schematic flowchart of the index information record queue of the new cache data in one embodiment;
[0043] Figure 7 Flow schematic diagram of the index information record queue for new cached data in another embodiment;
[0044] Figure 8 Flow schematic diagram of queue processing in one embodiment;
[0045] Figure 9 Structural block diagram of a data migration device in one embodiment;
[0046] Figure 10 Internal structure diagram of a computer device in one embodiment. Detailed implementation manners
[0047] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] In one embodiment, as Figure 1 shown, a data migration method is provided. In this embodiment, an example is given where this method is applied to a terminal. It can be understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps S102 to S106. Among them:
[0049] Step S102, when the storage capacity of the queue reaches the upper limit, the cached data corresponding to the index information stored at the head of the queue is used as the data to be deleted.
[0050] Among them, the queue is used to record the index information of the cached data and the access frequency corresponding to the index information; the storage capacity of the queue is determined based on the cache capacity of the solid-state drive. The index information is used to record the location information written to the solid-state drive.
[0051] Optionally, before using the cached data corresponding to the index information stored at the head of the queue as the data to be deleted, the terminal determines the storage capacity of the queue according to the cache capacity of the solid-state drive: when the cache service is started, the number of caches stored on the SSD disk is calculated according to the total size of the SSD disk and the average size of the cache blocks, and the size of the queue is generated according to a preset ratio, such as 20% of the number of caches. Among them, the queue can be called an F3FIFO queue, and the queue is a first-in, first-out queue.
[0052] Optionally, as Figure 2As shown in the figure, when the terminal reads cached data, it determines whether the cached data is stored in the solid-state drive (SSD). If the cached data is stored in the SSD, the terminal reads the cached data from the SSD. The terminal adds the index information of the cached data to the F3FIFO queue, and determines whether the cached data is hot data through the F3FIFO queue. If it is hot data and the hot data is located in the first area, that is, the area to be overwritten, the migration of the cached data is triggered at this time. The key is to migrate the cached data to the second area of the SSD.
[0053] If the cached data is not stored in the SSD, the terminal can only read the corresponding cached data from the mechanical disk. The mechanical disk responds to the read request of the cached data. When the access frequency of the cached data reaches the threshold for migration to the SSD, the cached data is migrated to the SSD, and then the cached data can be read from the SSD.
[0054] Optionally, taking the example of the terminal determining whether the cached data is hot data through the F3FIFO queue, when the storage capacity of the F3FIFO queue reaches the upper limit, the F3FIFO queue will first eliminate the index information corresponding to the cached data at the front of the queue, and then regard the cached data corresponding to the index information stored at the head of the queue as the data to be deleted.
[0055] Step S104, when the access frequency of the data to be deleted is greater than or equal to the first frequency threshold, the index information of the data to be deleted is added to the tail of the queue.
[0056] Among them, the first frequency threshold is a threshold determined based on the high-frequency section of the queue, and is used to judge whether the cached data is hot data in the high-frequency section. For example, if the high-frequency section is 4-7, then the first frequency threshold can be set to 5. Among them, hot data refers to data that is frequently accessed. The high-frequency section is set according to the access frequency of the cached data. It can also be set to other data according to the actual situation.
[0057] Optionally, after the terminal obtains the data to be deleted, it compares it with the first frequency threshold, such as 5, to determine whether the data to be deleted is hot data. When the access frequency of the data to be deleted is greater than or equal to the first frequency threshold, it indicates that the data to be deleted is hot data. At the same time, the index information of the data to be deleted in the queue is added to the tail of the queue. Since the queue is first-in, first-out, the residence time of the index information in the queue is extended. Even if it is not located in the first area of the SSD later, subsequent operation judgments can be made again in the queue, so that when the storage capacity of the queue reaches the upper limit again and the index information of the data to be deleted is at the head of the queue again, it indicates that it is to be eliminated. During the period from the tail of the queue to the head of the queue of the data to be deleted, if the index information of the data to be deleted is accessed once more, it can be confirmed as hot data and does not need to be eliminated by the queue.
[0058] Step S106, when the data to be deleted is in the first area of the solid-state drive, write the data to be deleted into the second area of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue.
[0059] Among them, the first area is the area to be overwritten. For example, 10% of the SSD disk space is preset as the area to be overwritten; the second area is the area outside the area to be overwritten.
[0060] Optionally, when the data to be deleted is in the pre-defined 10% area of the solid-state drive as the area to be overwritten, trigger the hot data migration of the SSD disk. The terminal migrates the data to be deleted, that is, the hot data, to the area outside the area to be overwritten of the SSD disk, which can be the latest write position in the SSD disk, and delete the index information of the data to be deleted added to the tail of the queue.
[0061] Optionally, if the access frequency of the data to be deleted is less than the first frequency threshold, delete the index information at the head of the queue, including: if the access frequency of the data to be deleted is less than the first frequency threshold, it indicates that the data to be deleted is not hot data, or cold data, that is, the information to be eliminated from the queue, then delete the index information at the head of the queue, that is, delete the index information corresponding to the data to be deleted, to ensure the first-in, first-out order and storage capacity in the queue.
[0062] In the above data migration method, a queue for recording index information and access frequency of cached data is added according to the cache capacity of the solid-state drive; when the queue reaches the upper limit, determine the data to be deleted, and at the same time judge the size of the access frequency of the data to be deleted and the first frequency threshold and the area where the data to be deleted is stored in the solid-state drive. If the access frequency of the data to be deleted is greater than the first frequency threshold, add the index information of the data to be deleted to the tail of the queue; and if the deleted data is in the area to be overwritten, it indicates that the data to be deleted is hot data that should not be overwritten; on the one hand, add the index information of the data to be deleted to the tail of the first-in, first-out queue for judging the data to be deleted again when the queue reaches the upper limit next time; on the other hand, write the data to be deleted into the area outside the area to be overwritten of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue to make room for the queue in the storage capacity, by adding a queue for recording index information and access frequency of cached data, and through the records in the queue and the position of the data to be deleted in the solid-state drive, the retention time of hot data in the SSD is extended, the dependence and load on the mechanical disk are reduced, and thus the response speed is improved.
[0063] In an exemplary embodiment, such as Figure 3As shown, after adding the index information of the data to be deleted to the tail of the queue, the processing method for the data to be deleted without data migration further includes steps S302 to S308. Among them:
[0064] Step S302, configure the access frequency of the data to be deleted to a first target value.
[0065] Among them, the first target value is a positive integer determined based on a first frequency threshold. For example, if the first frequency threshold is 5, the first target value can be configured as 4.
[0066] Optionally, after the terminal adds the index information of the data to be deleted to the tail of the queue, configure the access frequency of the data to be deleted to a first target value, such as 4.
[0067] Step S304, in the case where the data to be deleted is not in the first area of the solid-state drive, wait for access to the data to be deleted, and obtain the current access frequency of the data to be deleted, where the current access frequency is the first target value plus 1.
[0068] Optionally, if the data to be deleted is in the pre-defined overwrite area of the solid-state drive, write the data to be deleted to the second area of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue.
[0069] Optionally, if the data to be deleted is not in the pre-defined overwrite area of the solid-state drive, the terminal waits for access to the data to be deleted and obtains the current access frequency of the data to be deleted, where the current access frequency is the first target value plus 1, including: the terminal waits for the next access to the data to be deleted. Since the access frequency of the data to be deleted has been configured to the first target value, such as 4, therefore, the current access frequency of the data to be deleted obtained is the first target value, such as 4 plus 1, that is, 5. At this time, as long as the data to be deleted is added to the tail of the queue and the access frequency is configured to 4, after one more access, it must satisfy being greater than or equal to the first frequency threshold.
[0070] Step S306, when the index information of the data to be deleted is at the head of the queue again, obtain the latest current access frequency of the data to be deleted.
[0071] Among them, the latest current access frequency is determined based on the current access frequency and the value is less than or equal to the upper limit of the preset frequency.
[0072] Optionally, the terminal waits to access the data to be deleted again. Since the access frequency of the data to be deleted is 5, the current access frequency of the data to be deleted, which is 5, is incremented by 1, that is, 6, and so on, without exceeding the upper limit of the preset frequency. Since the queue is first-in-first-out, when the index information of the data to be deleted at the end of the queue is at the head of the queue again, the latest current access frequency of the data to be deleted is obtained. The latest current access frequency, such as 5 or 6, is obtained.
[0073] Step S308, when the storage capacity of the queue reaches the upper limit, the step of adding the index information of the data to be deleted to the tail of the queue is repeatedly executed; in the case where the data to be deleted is in the first area of the solid-state drive, the data to be deleted is written into the second area of the solid-state drive, and the index information of the data to be deleted added to the tail of the queue is deleted.
[0074] Optionally, when the storage capacity of the queue reaches the upper limit and the latest current access frequency of the data to be deleted is greater than or equal to the first frequency threshold, the terminal adds the index information of the data to be deleted to the tail of the queue again. In the case where the data to be deleted is in the first area of the solid-state drive, that is, the condition for hot data migration is met, the terminal writes the data to be deleted into the second area of the solid-state drive, and deletes the index information of the data to be deleted added to the tail of the queue.
[0075] In this embodiment, the index information of the data to be deleted without data migration is added to the tail of the queue, and the access frequency is configured as the first target value, so that when the data to be deleted meets the conditions again, the migration of hot data can be triggered, thereby improving the response speed.
[0076] In an exemplary embodiment, as Figure 4 shown, the method for migrating the current cache data read from the solid-state drive includes steps S402 to S404. Among them:
[0077] Step S402, read the current cache data from the solid-state drive. In the case where the current cache data is in the first area of the solid-state drive, query the access frequency corresponding to the index information of the current cache data from the queue, and add the index information of the current cache data to the tail of the queue.
[0078] Optionally, the terminal reads the current cache data from the solid-state drive. In the case where the current cache data is in the area to be overwritten of the solid-state drive, the terminal queries the access frequency corresponding to the index information of the current cache data from the queue. If it is the first access, the access frequency is recorded as 0. At the same time, the terminal adds the index information of the current cache data to the tail of the queue; and so on for other cases, the access frequency can be recorded as 1, 2, 3, etc. After querying the corresponding access frequency, the index information of the current cache data is added to the tail of the queue.
[0079] Step S404: When the access frequency of the current cached data is in the low-frequency range and the access frequency of the current cached data is greater than or equal to the second frequency threshold, write the current cached data to the second area of the solid-state drive, and delete the index information of the current cached data added to the tail of the queue.
[0080] Among them, the first frequency threshold is greater than the second frequency threshold. The second frequency threshold is a threshold determined based on the low-frequency range of the queue and is used to determine whether the cached data is hot data in the low-frequency range. For example, if the low-frequency range is 0-3, then the second frequency threshold can be set to 2. The low-frequency range is set according to the access frequency of the cached data. It can also be set to other data according to the actual situation. Since the first frequency threshold is the threshold corresponding to the high-frequency range and the second frequency threshold is the threshold corresponding to the low-frequency range, the first frequency threshold must be greater than the second frequency threshold.
[0081] Optionally, when the access frequency of the current cached data is greater than or equal to the second frequency threshold 2, if the access frequency of the current cached data is 2, trigger the hot data migration of the SSD disk. The terminal deletes the index information of the current cached data at the tail of the queue added to the queue, releasing the storage capacity of the queue. So that when the storage capacity of the queue reaches the upper limit next time and the index information of the data to be deleted is at the head of the queue again, it means it is to be eliminated. During the period when the data to be deleted goes from the tail of the queue to the head of the queue, if the index information of the data to be deleted is accessed one more time, it can be confirmed as hot data and does not need to be eliminated by the queue. At the same time, write the current cached data to an area outside the area to be overwritten of the solid-state drive, which can be the latest write position in the SSD disk.
[0082] In this embodiment, when reading the current cached data, query the access frequency of the current cached data in the queue and compare it with the second frequency threshold. If it is hot data in the queue and is in the area to be overwritten in the solid-state drive, perform data migration. When the queue eliminates cached information, compare it with the first threshold. If it is hot data in the queue and is in the area to be overwritten in the solid-state drive, perform data migration. Through the setting of the queue and the comparison with the second threshold, the retention time of hot data in the solid-state drive is extended again, reducing the dependence on and load of the mechanical disk, thereby improving the response speed.
[0083] In an exemplary embodiment, as Figure 5 shown, after adding the index information of the current cached data to the tail of the queue, the processing method for the current cached data without data migration further includes steps S502 to S506. Among them:
[0084] Step S502: Configure the access frequency of the current cached data to the first target value.
[0085] Among them, the first target value is a positive integer determined based on the first frequency threshold. For example, if the first frequency threshold is 5, the first target value can be configured as 4.
[0086] Optionally, after adding the index information of the current cached data to the tail of the queue, the terminal configures the access frequency of the index information of the current cached data added to the tail of the queue as the first target value, such as 4. The first target value is the lower limit of the high-frequency section. At this time, the access frequency of the index information of the current cached data falls into the high-frequency section of the queue, such as 4 - 7.
[0087] Step S504, when the access frequency of the current cached data is in the high-frequency section and the access frequency of the current cached data is less than the first frequency threshold, then wait to access the current cached data, and add the index information of the current cached data to the tail of the queue again.
[0088] Among them, the first frequency threshold is set based on the high-frequency section.
[0089] Optionally, since the access frequency of the current cached data is in the high-frequency section, it is necessary to compare it with the first frequency threshold. When the access frequency of the current cached data is less than the first frequency threshold, the terminal continues to wait to access the current cached data. At this time, the access frequency of the current cached data is 5, and the index information of the current cached data is added to the tail of the queue again.
[0090] Step S506, until the new access frequency of the current cached data is greater than or equal to the first frequency threshold, repeat the step of writing the current cached data to the second area of the solid-state drive and deleting the index information of the current cached data added to the tail of the queue.
[0091] Among them, the new access frequency is determined based on the first target value, and the value of the new access frequency is less than or equal to the upper limit of the preset frequency. If the access frequency of the current cached data is configured as the first target value and is accessed once, then the new access frequency is 4 + 1 = 5 times. If it is accessed twice, then the new access frequency is 5 + 1 = 6 times.
[0092] Optionally, until the new access frequency of the current cached data is greater than or equal to the first frequency threshold. For example, if the first frequency threshold is 5, then when the new access frequency of the current cached data is at least 5, the terminal repeats the step of writing the current cached data to the second area of the solid-state drive and deleting the index information of the current cached data added to the tail of the queue.
[0093] In this embodiment, the index information of the current cache data without data migration is added to the tail of the queue, and the access frequency is configured to a first target value. Thus, when the current cache data meets the conditions again, it can trigger the migration of hot data, thereby increasing the residence time of hot data in the solid-state drive and improving the response speed.
[0094] In an exemplary embodiment, as Figure 6 shown, before the cache data corresponding to the index information stored at the head of the queue is used as the data to be deleted when the storage capacity of the queue reaches the upper limit, the method of recording the index information of the new cache data in the queue further includes steps S602 to S604. Among them:
[0095] Step S602, obtain the new cache data and the index information corresponding to the new cache data.
[0096] Optionally, the terminal obtains the new cache data and the index information corresponding to the new cache data.
[0097] Step S604, when the index information corresponding to the new cache data exists and the new cache data is in the first state, delete the index information stored at the head of the queue, add the index information corresponding to the new cache data to the tail of the queue, and configure the access frequency of the new cache data to a second target value.
[0098] Among them, the second target value is an integer less than the first target value, and the first state includes data conflict or data update. Data conflict means that when two different cache data obtain the same hash value through hash function calculation, but the index information of the two cache data is different.
[0099] Optionally, the terminal checks the key and index information of the new cache data through the F3FIFO queue, where the key is the hash value calculated through the hash function. By comparing the index information of the new cache data with the index information stored at the head of the queue, and comparing the key of the new cache data with the key value of the cache data corresponding to the index information stored at the head of the queue. If the keys are the same but the index information is different, it is determined that there is a cache update or conflict, the index information stored at the head of the queue is deleted, that is, the index information of the old cache data is deleted, the index information corresponding to the new cache data is added to the tail of the queue, and the access frequency of the new cache data is configured to a second target value, such as 0, that is, the new cache data is processed as the cache data that appears for the first time.
[0100] If the keys are the same and the index information is also the same, it indicates that the new cache data and the cache data corresponding to the index information stored at the head of the queue are the same cache data.
[0101] When the storage capacity of the queue reaches the upper limit, the cache data corresponding to the index information stored at the head of the queue is taken as the data to be deleted, and it is further determined whether the data to be deleted will trigger the migration of the solid-state drive.
[0102] In this embodiment, by determining that the new cache data is the cache data that appears for the first time, the accuracy of the queue for recording the access frequency can be improved.
[0103] In an exemplary embodiment, as Figure 7 shown, another method for recording the index information of the new cache data in the queue further includes step S702 to step S706. Among them:
[0104] Step S702, when the index information corresponding to the new cache data exists and the new cache data is not in the first state, the access frequency of the new cache data is incremented by 1 to obtain the updated access frequency.
[0105] Among them, the value of the updated access frequency is less than or equal to the upper limit of the preset frequency.
[0106] Optionally, if the keys are the same and the index information is also the same, it indicates that the new cache data and the cache data corresponding to the index information stored at the head of the queue are the same cache data and are not in the first state. At this time, the access frequency of the new cache data is incremented by 1 and recorded in the queue to obtain the updated access frequency. The upper limit of the preset frequency is the upper limit value of the high-frequency section. If the high-frequency section is 4-7, then the upper limit of the preset frequency is 7. The value of the updated access frequency is less than or equal to 7.
[0107] Step S704, when the updated access frequency is in the high-frequency section, compare the updated access frequency with the first frequency threshold. When the updated access frequency is greater than the first frequency threshold, add the index information corresponding to the new cache data to the tail of the queue and configure the access frequency of the new cache data to the first target value.
[0108] Optionally, when the updated access frequency is in the high-frequency section, such as the access frequency is one of the numbers 4-7, such as 4 or 5; the first frequency threshold is 5. If the updated access frequency is 4, then compare the updated access frequency 4 with the first frequency threshold 5. Obviously, the updated access frequency 4 is less than the first frequency threshold 5, so it is considered that the new cache data corresponding to the updated access frequency is not hot data, and the subsequent migration of hot data in the solid-state drive will not be triggered.
[0109] Optionally, if the updated access frequency is 5, compare the updated access frequency 5 with the first frequency threshold 5. Obviously, the updated access frequency 5 is equal to the first frequency threshold 5, indicating that the new cache data corresponding to the updated access frequency is hot data. Then add the index information corresponding to the new cache data to the end of the queue, and reconfigure the access frequency of the new cache data to the first target value 4.
[0110] Step S706: When the updated access frequency is in the low-frequency range, compare the updated access frequency with the second frequency threshold. When the updated access frequency is greater than the second frequency threshold, add the index information corresponding to the new cache data to the end of the queue, and configure the access frequency of the new cache data to the first target value.
[0111] Among them, the second frequency threshold is the threshold corresponding to the low-frequency range, such as 2.
[0112] Optionally, when the updated access frequency is in the low-frequency range, for example, the access frequency is one of the numbers from 0 to 3, such as 1 or 3; the second frequency threshold is 2. If the updated access frequency is 1, compare the updated access frequency 1 with the first frequency threshold 2. Obviously, the updated access frequency 1 is less than the first frequency threshold 2, so it is considered that the new cache data corresponding to the updated access frequency is not hot data, and subsequent migration of hot data in the solid-state drive will not be triggered.
[0113] Optionally, if the updated access frequency is 3, compare the updated access frequency 3 with the first frequency threshold 2. Obviously, the updated access frequency 3 is greater than the first frequency threshold 2, indicating that the new cache data corresponding to the updated access frequency is hot data. Then add the index information corresponding to the new cache data to the end of the queue, and reconfigure the access frequency of the new cache data to the first target value 4.
[0114] When the storage capacity of the queue reaches the upper limit, the cache data corresponding to the index information stored at the head of the queue is used as the data to be deleted, and further determine whether the data to be deleted will trigger the migration of the solid-state drive.
[0115] It should be noted that in this embodiment, the high-frequency range, the low-frequency range, the first access frequency threshold corresponding to the high-frequency range, the second frequency threshold corresponding to the low-frequency range, the first target value, the second target value, and the upper limit of the preset frequency can all be set according to the actual situation, and are not limited to the numbers listed in this embodiment.
[0116] In this embodiment, by comparing the updated access frequency with one of the first frequency threshold or the second frequency threshold, it is determined whether it is hot data, providing a condition for whether subsequent hot data migration can be triggered.
[0117] In an exemplary embodiment, a method for creating index information of new cache data and recording it in a queue includes, when the index information corresponding to the new cache data does not exist, creating new index information according to the new cache data and adding the new index information to the tail of the queue.
[0118] Optionally, when the index information corresponding to the new cache data does not exist, new index information is created according to the new cache data, and the new index information is added to the tail of the queue. At the same time, the access frequency of the new index information is set to a second target value, such as 0. That is, the new cache data is processed as the cache data that appears for the first time. When the storage capacity of the queue reaches the upper limit, the cache data corresponding to the index information stored at the head of the queue is regarded as the data to be deleted, and it is further determined whether the data to be deleted will trigger the migration of the solid-state drive.
[0119] It should be noted that in any of the above embodiments, after adding the index information to the tail of the queue and setting the access frequency of the index information to the second target value, or after adding the index information to the tail of the queue and configuring the access frequency of the new cache data to the first target value, or after obtaining the updated access frequency, as long as it is satisfied that when the storage capacity of the queue reaches the upper limit, the cache data corresponding to the index information stored at the head of the queue is regarded as the data to be deleted, and it is further determined whether the data to be deleted will trigger the migration of the solid-state drive.
[0120] In this embodiment, by judging whether the index information exists, if not, it indicates that it is the cache data that appears for the first time, and the new cache data is processed as the cache data that appears for the first time.
[0121] In an exemplary embodiment, when the cache service is started, according to the total size of the SSD disk and the average size of the cache blocks, the number of caches stored in the SSD disk is calculated, and the size of the F3FIFO queue is generated according to 20% of the number of caches. The F3FIFO queue is used to record the index information of the cache data and the access frequency corresponding to the index information; the access frequency of the F3FIFO queue can be divided into two sections or intervals. One is the low-frequency section from 0 to 3; the other is the high-frequency section from 4 to 7. The low-frequency section corresponds to the second frequency threshold 2; the high-frequency section corresponds to the first frequency threshold 5. The upper limit of the preset frequency is the maximum value of the high-frequency region, which is 7. The first target value is a positive integer determined based on the first frequency threshold 5, which is 4; the second target value is an integer less than the first target value, which is 0. 10% of the area in the solid-state drive is used as the area to be overwritten.
[0122] Such as Figure 8As shown below. Adding index information of cached data: The terminal obtains new cached data and the index information corresponding to the new cached data; when the index information corresponding to the new cached data exists, it compares the index information of the new cached data with the index information stored at the head of the F3FIFO queue, and compares the key of the new cached data with the key value of the cached data corresponding to the index information stored at the head of the F3FIFO queue. If the keys are the same but the index information is different, it is determined that there is a cache update or conflict, and the index information stored at the head of the F3FIFO queue is deleted, that is, the index information of the old cached data is deleted, and the index information corresponding to the new cached data is added to the tail of the F3FIFO queue, and the access frequency of the new cached data is configured to 0.
[0123] If the keys are the same and the index information is also the same, it indicates that the new cached data and the cached data corresponding to the index information stored at the head of the F3FIFO queue are the same cached data, not a data conflict or data update. At this time, the access frequency of the new cached data is incremented by 1 and recorded in the F3FIFO queue to obtain the updated access frequency, and the value of the updated access frequency is less than or equal to 7. If the updated access frequency is 4, the updated access frequency 4 is compared with the first frequency threshold 5. Obviously, the updated access frequency 4 is less than the first frequency threshold 5, so it is considered that the new cached data corresponding to the updated access frequency is not a hot data, and subsequent migration of hot data in the solid-state drive will not be triggered. If the updated access frequency is 5, the updated access frequency 5 is compared with the first frequency threshold 5. Obviously, the updated access frequency 5 is equal to the first frequency threshold 5, so it indicates that the new cached data corresponding to the updated access frequency is a hot data, and the index information corresponding to the new cached data is added to the tail of the F3FIFO queue, and the access frequency of the new cached data is reconfigured to the first target value 4.
[0124] If the updated access frequency is 1, the updated access frequency 1 is compared with the first frequency threshold 2. Obviously, the updated access frequency 1 is less than the first frequency threshold 2, so it is considered that the new cached data corresponding to the updated access frequency is not a hot data, and subsequent migration of hot data in the solid-state drive will not be triggered. If the updated access frequency is 3, the updated access frequency 3 is compared with the first frequency threshold 2. Obviously, the updated access frequency 3 is greater than the first frequency threshold 2, so it indicates that the new cached data corresponding to the updated access frequency is a hot data, and the index information corresponding to the new cached data is added to the tail of the F3FIFO queue, and the access frequency of the new cached data is reconfigured to the first target value 4.
[0125] In the case where the index information corresponding to the new cache data does not exist, new index information is created based on the new cache data, and the new index information is added to the tail of the F3FIFO queue. At the same time, the access frequency of the new index information is set to the second target value of 0.
[0126] When the storage capacity of the F3FIFO queue reaches the upper limit, the F3FIFO queue will first eliminate the index information corresponding to the cache data at the front of the queue, and the cache data corresponding to the index information stored at the head of the queue is used as the data to be deleted. After the terminal obtains the data to be deleted, it compares it with the first frequency threshold of 5 to determine whether the data to be deleted is hot data. When the access frequency of the data to be deleted is greater than or equal to the first frequency threshold of 5, it indicates that the data to be deleted is hot data, and at the same time, the index information of the data to be deleted in the queue is added to the tail of the queue. If the data to be deleted is located in the pre-defined 10% area of the solid-state drive as the area to be overwritten, the hot data migration of the SSD disk is triggered, and the terminal migrates the data to be deleted, that is, the hot data, to an area outside the area to be overwritten of the SSD disk, which can be the latest write position in the SSD disk, and deletes the index information of the data to be deleted added to the tail of the queue.
[0127] If the access frequency of the data to be deleted is less than the first frequency threshold, it indicates that the data to be deleted is not hot data, or is called cold data, which is the information to be eliminated from the queue, then the index information at the head of the queue is deleted, that is, the index information corresponding to the data to be deleted is deleted, ensuring the first-in, first-out order and storage capacity in the queue.
[0128] After the terminal adds the index information of the data to be deleted to the tail of the queue, it configures the access frequency of the data to be deleted to the first target value of 4. If the data to be deleted is not located in the pre-defined overwrite area of the solid-state drive, the terminal waits to access the data to be deleted and obtains the current access frequency of the data to be deleted. The current access frequency is the first target value plus 1, including: the terminal waits for the next access to the data to be deleted. Since the access frequency of the data to be deleted has been configured to the first target value, such as 4, therefore, the current access frequency of the data to be deleted obtained is the first target value, such as 4 plus 1, that is, 5. At this time, as long as the data to be deleted is added to the tail of the queue and the access frequency is configured to 4, after one more access, it must satisfy being greater than or equal to the first frequency threshold. The terminal waits for another access to the data to be deleted. Since the access frequency of the data to be deleted is 5, therefore, the current access frequency of the data to be deleted obtained is 4 plus 1, that is, 6, and so on, without exceeding the upper limit of the preset frequency. Since the queue is first-in, first-out, when the index information of the data to be deleted located at the end of the queue is again at the head of the queue, the latest current access frequency of the data to be deleted is obtained. The latest current access frequency is obtained, such as 5 or 6. When the storage capacity of the queue reaches the upper limit and the latest current access frequency of the data to be deleted is greater than or equal to the first frequency threshold, the terminal adds the index information of the data to be deleted to the tail of the queue again. When the data to be deleted is located in the first area of the solid-state drive, that is, the condition for hot data migration is met, the terminal writes the data to be deleted into the second area of the solid-state drive and deletes the index information of the data to be deleted added to the tail of the queue.
[0129] Read the current cached data from the solid-state drive: The terminal reads the current cached data from the solid-state drive. When the current cached data is located in the overwrite area of the solid-state drive, the terminal queries the access frequency corresponding to the index information of the current cached data from the queue. If it is the first access, the access frequency is recorded as 0. At the same time, the terminal adds the index information of the current cached data to the tail of the queue; and so on for other cases. The access frequency can be recorded as 1, 2, 3, etc. After querying the corresponding access frequency, the index information of the current cached data is added to the tail of the queue. When the access frequency of the current cached data is greater than or equal to the second frequency threshold of 2, if the access frequency of the current cached data is 2, the hot data migration of the SSD disk is triggered, and the terminal deletes the index information of the current cached data at the end of the queue added to the queue, releasing the storage capacity of the queue.
[0130] After adding the index information of the current cached data to the tail of the queue, the terminal configures the access frequency of the index information of the current cached data added to the tail of the queue to a first target value, such as 4. The first target value is the lower limit of the high-frequency section. At this time, the access frequency of the index information of the current cached data falls into the high-frequency section of the queue, such as 4-7. Since the access frequency of the current cached data is in the high-frequency section, it needs to be compared with the first frequency threshold. When the access frequency of the current cached data is less than the first frequency threshold, the terminal continues to wait to access the current cached data. At this time, the access frequency of the current cached data is 5, and the index information of the current cached data is added to the tail of the queue again. Until the new access frequency of the current cached data is greater than or equal to the first frequency threshold, for example, the first frequency threshold is 5, then when the new access frequency of the current cached data is at least 5, the terminal repeats the steps of writing the current cached data to the second area of the solid-state drive and deleting the index information of the current cached data added to the tail of the queue.
[0131] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.
[0132] Based on the same inventive concept, an embodiment of the present application also provides a data migration device for implementing the data migration method involved above. The solution provided by the device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the data migration device provided below can refer to the limitations on the data migration method in the above text, and will not be repeated here.
[0133] In an exemplary embodiment, as Figure 9 shown, a data migration device is provided, including: a determination module 901, an addition module 902, and a migration module 903, where:
[0134] Determination module 901 is used to treat the cached data corresponding to the index information stored at the head of the queue as data to be deleted when the storage capacity of the queue reaches the upper limit; wherein the queue is used to record the index information of the cached data and the access frequency corresponding to the index information; the storage capacity of the queue is determined based on the cache capacity of the solid-state drive.
[0135] The adding module 902 is configured to add the index information of the data to be deleted to the tail of the queue when the access frequency of the data to be deleted is greater than or equal to a first frequency threshold.
[0136] The migration module 903 is used to write the data to be deleted to the second area of the solid-state hard disk when the data to be deleted is located in the first area of the solid-state hard disk, and delete the index information of the data to be deleted added to the tail of the queue; wherein the first area is the area to be covered; the second area is the area outside the area to be covered.
[0137] In an exemplary embodiment, a data migration device is provided, comprising:
[0138] A configuration acquisition module is configured to configure the access frequency of the data to be deleted to a first target value; wherein the first target value is a positive integer determined based on a first frequency threshold; when the data to be deleted is not located in the first area of the solid-state hard disk, wait for access to the data to be deleted and obtain the current access frequency of the data to be deleted, and the current access frequency is the first target value plus 1; when the index information of the data to be deleted is located at the head of the queue again, obtain the latest current access frequency of the data to be deleted; the latest current access frequency is determined based on the current access frequency, and the value is less than or equal to the upper limit of the preset frequency.
[0139] The adding module 902 is further configured to add the index information of the data to be deleted to the end of the queue when the storage capacity of the queue reaches an upper limit.
[0140] The migration module 903 is further configured to write the data to be deleted to the second area of the solid state drive when the data to be deleted is located in the first area of the solid state drive, and delete the index information of the data to be deleted added to the tail of the queue.
[0141] In an exemplary embodiment, a data migration device is provided, comprising:
[0142] The reading module is used to read the current cached data from the solid-state drive. When the current cached data is located in the first area of the solid-state drive, the access frequency corresponding to the index information of the current cached data is queried from the queue; the adding module 902 is also used to add the index information of the current cached data to the tail of the queue.
[0143] The migration module 903 is further configured to, when the access frequency of the current cached data is in the low-frequency range and the access frequency of the current cached data is greater than or equal to the second frequency threshold, write the current cached data into the second area of the solid-state drive and delete the index information of the current cached data added to the tail of the queue; the first frequency threshold is greater than the second frequency threshold.
[0144] In an exemplary embodiment, a data migration apparatus is provided, including:
[0145] A configuration addition module is configured to configure the access frequency of the current cached data as a first target value; wherein, the first target value is a positive integer determined based on the first frequency threshold; when the access frequency of the current cached data is in the high-frequency range and the access frequency of the current cached data is less than the first frequency threshold, wait for accessing the current cached data, and add the index information of the current cached data to the tail of the queue again.
[0146] The migration module 903 is further configured to, until the new access frequency of the current cached data is greater than or equal to the first frequency threshold, repeatedly execute the steps of writing the current cached data into the second area of the solid-state drive and deleting the index information of the current cached data added to the tail of the queue; the new access frequency is determined based on the first target value, and the value of the new access frequency is less than or equal to the upper limit of the preset frequency.
[0147] In an exemplary embodiment, a data migration apparatus is provided, including:
[0148] An update module is configured to obtain new cached data and the index information corresponding to the new cached data; when the index information corresponding to the new cached data exists and the new cached data is in the first state, delete the index information stored at the head of the queue, add the index information corresponding to the new cached data to the tail of the queue, and configure the access frequency of the new cached data as a second target value; wherein, the second target value is an integer less than the first target value, and the first state includes data conflict or data update.
[0149] In an exemplary embodiment, a data migration apparatus is provided, including:
[0150] The update module is further configured to, when the index information corresponding to the new cache data exists and the new cache data is not in the first state, increment the access frequency of the new cache data by 1 to obtain an updated access frequency; the value of the updated access frequency is less than or equal to the upper limit of the preset frequency; when the updated access frequency is in the high-frequency section, compare the updated access frequency with the first frequency threshold, and when the updated access frequency is greater than the first frequency threshold, add the index information corresponding to the new cache data to the tail of the queue and configure the access frequency of the new cache data to the first target value; when the updated access frequency is in the low-frequency section, compare the updated access frequency with the second frequency threshold, and when the updated access frequency is greater than the second frequency threshold, add the index information corresponding to the new cache data to the tail of the queue and configure the access frequency of the new cache data to the first target value.
[0151] Each module in the above data migration device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0152] In an exemplary embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 10 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store cache data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a data migration method.
[0153] Those skilled in the art can understand that Figure 10 the structure shown in
[0154] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0155] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0156] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0157] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.
[0158] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in this application.
[0159] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A data migration method, characterized in that, The method includes: When the storage capacity of the queue reaches the upper limit, the cache data corresponding to the index information stored at the head of the queue is taken as the data to be deleted; wherein, the queue is used to record the index information of the cache data and the access frequency corresponding to the index information; the storage capacity of the queue is determined based on the cache capacity of the solid-state drive; In the case where the access frequency of the data to be deleted is greater than or equal to the first frequency threshold, the index information of the data to be deleted is added to the tail of the queue; In the case where the data to be deleted is located in the first area of the solid-state drive, the data to be deleted is written into the second area of the solid-state drive, and the index information of the data to be deleted added to the tail of the queue is deleted; wherein, the first area is the area to be overwritten; the second area is the area outside the area to be overwritten.
2. The method according to claim 1, wherein After adding the index information of the data to be deleted to the tail of the queue, the method further includes: Configuring the access frequency of the data to be deleted to a first target value; wherein, the first target value is a positive integer determined based on the first frequency threshold; In the case where the data to be deleted is not located in the first area of the solid-state drive, wait to access the data to be deleted, and obtain the current access frequency of the data to be deleted, and the current access frequency is the first target value plus 1; When the index information of the data to be deleted is at the head of the queue again, obtain the latest current access frequency of the data to be deleted; the latest current access frequency is determined based on the current access frequency and is less than or equal to the upper limit of the preset frequency; When the storage capacity of the queue reaches the upper limit, repeatedly execute the step of adding the index information of the data to be deleted to the tail of the queue; in the case where the data to be deleted is located in the first area of the solid-state drive, write the data to be deleted into the second area of the solid-state drive, and delete the index information of the data to be deleted added to the tail of the queue.
3. The method according to claim 1, wherein The method further includes: Read the current cache data from the solid-state drive. In the case where the current cache data is located in the first area of the solid-state drive, query the access frequency corresponding to the index information of the current cache data from the queue, and add the index information of the current cache data to the tail of the queue; In the case where the access frequency of the current cache data is in the low-frequency section and the access frequency of the current cache data is greater than or equal to the second frequency threshold, write the current cache data into the second area of the solid-state drive, and delete the index information of the current cache data added to the tail of the queue; the first frequency threshold is greater than the second frequency threshold.
4. The method according to claim 3, wherein After adding the index information of the current cache data to the tail of the queue, the method further includes: Configuring the access frequency of the current cache data to a first target value; wherein, the first target value is a positive integer determined based on the first frequency threshold; When the access frequency of the current cached data is in the high-frequency range and the access frequency of the current cached data is less than the first frequency threshold, wait to access the current cached data and add the index information of the current cached data to the tail of the queue again; Until the new access frequency of the current cached data is greater than or equal to the first frequency threshold, repeat the steps of writing the current cached data to the second area of the solid-state drive and deleting the index information of the current cached data added to the tail of the queue; the new access frequency is determined based on the first target value, and the value of the new access frequency is less than or equal to the upper limit of the preset frequency.
5. The method according to claim 1, characterized in that, Before taking the cached data corresponding to the index information stored at the head of the queue as the data to be deleted when the storage capacity of the queue reaches the upper limit, it further includes: Obtain new cached data and the index information corresponding to the new cached data; When the index information corresponding to the new cached data exists and the new cached data is in the first state, delete the index information stored at the head of the queue, add the index information corresponding to the new cached data to the tail of the queue, and configure the access frequency of the new cached data to the second target value; wherein, the second target value is an integer less than the first target value, and the first state includes data conflict or data update.
6. The method according to claim 5, wherein The method further includes: When the index information corresponding to the new cached data exists and the new cached data is not in the first state, add 1 to the access frequency of the new cached data to obtain the updated access frequency; the value of the updated access frequency is less than or equal to the upper limit of the preset frequency; When the updated access frequency is in the high-frequency range, compare the updated access frequency with the first frequency threshold. When the updated access frequency is greater than the first frequency threshold, add the index information corresponding to the new cached data to the tail of the queue and configure the access frequency of the new cached data to the first target value; When the updated access frequency is in the low-frequency range, compare the updated access frequency with the second frequency threshold. When the updated access frequency is greater than the second frequency threshold, add the index information corresponding to the new cached data to the tail of the queue and configure the access frequency of the new cached data to the first target value.
7. A data migration device, characterized in that, The device includes: A determination module, configured to take the cached data corresponding to the index information stored at the head of the queue as the data to be deleted when the storage capacity of the queue reaches the upper limit; wherein, the queue is used to record the index information of the cached data and the access frequency corresponding to the index information; the storage capacity of the queue is determined based on the cache capacity of the solid-state drive; An addition module, configured to add the index information of the data to be deleted to the tail of the queue when the access frequency of the data to be deleted is greater than or equal to the first frequency threshold; A migration module, configured to write the data to be deleted into a second area of the solid-state drive and delete the index information of the data to be deleted added to the tail of the queue when the data to be deleted is located in a first area of the solid-state drive; wherein, the first area is an area to be overwritten; the second area is an area outside the area to be overwritten.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Caching method and caching device
CN103440207A
Solid state disk cache data update method and apparatus
CN105224473A
Data caching method and device
CN108763110A
Data migration method, device and equipment for dynamic adaptive scheduling, and medium
CN111240593A
Data caching method and device
CN113094392A