Cache disk update preheating method, device, equipment and storage medium
By recording hot spot meta information before the cache disk is updated and updating the cache disk according to the update type, the problem of data loss during cache disk update is solved, ensuring performance stability and efficiency, and achieving rapid recovery of cache disk updates is achieved.
Patent Information
- Application Number
- CN202311845527.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2043-12-28
AI Technical Summary
In the storage system, when the cache disk is updated, the existing technology can easily lead to cache data loss, resulting in temporary failure of read cache, affecting performance, especially when adding and deleting cache disks during operation and maintenance.
Before detecting that the cache disk needs to be updated, record the hot spot meta information and update the cache disk according to the update type. After completing the update, respond to the read command and read the hot spot data to ensure that the host IO hits in time, quickly restore the cached data, and avoid data loss. performance degraded.
Through the preheating mechanism, it ensures that the performance does not decrease when the cache disk is updated, which improves the speed and efficiency of the cache disk update and preheating, and avoids the failure of read cache data caused by data loss.
Smart Images

Figure CN117806554B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a cache disk update preheating method, device, equipment and storage medium. Background Art
[0002] In a storage system that uses a mechanical disk (for example, a hard disk drive, HDD) as the main memory, whether it is a centralized storage system or a distributed storage system, using non-volatile memory express (NVME) or a solid-state disk (SSD) as a read cache is an industry-recognized feature. By caching hot data in NVME or SSD, it can be ensured that the hot data is directly obtained from the high-speed disk without going to a lower-speed mechanical disk, ensuring lower input / output (IO) latency, thereby achieving higher performance.
[0003] In a read cache system, the mapping of user IO to read cache is usually in the form of modulo. For example, if object ID = 0, it is modulo-mapped to cache1. When the cache disk corresponding to some caches fails and needs to be replaced, the data originally mapped to the failed cache disk is lost. Of course, cache data loss does not cause real data loss, but it will cause the read cache to be temporarily invalid, and subsequent read data will be cache misses. Only after a period of multiple reads, will the hot data be re-cached on the replaced cache disk.
[0004] During the operation and maintenance process, cache disks are often added or deleted. When a cache disk is added, the modulus of user IO to cache changes. At this time, some hot data originally cached in disk1 and disk2 is invalid and needs to be re-cached in disk3. However, data is cached only after it cannot be read many times. This will cause cache misses for a period of time, resulting in reduced performance. Similarly, deleting a disk will also cause the hash modulus to change, which will also cause some cache data to become invalid. Summary of the invention
[0005] The main purpose of the present invention is to provide a cache disk update preheating method, device, equipment and storage medium, aiming to solve the technical problem in the prior art that cache data loss causes temporary failure of cache reads, and cache data failure is easily caused when adding or deleting cache disks during operation and maintenance.
[0006] In a first aspect, the present invention provides a cache disk update preheating method, the cache disk update preheating method comprising the following steps:
[0007] Before detecting that the current cache disk cache needs to be updated, recording the hotspot metadata of the current cache disk cache;
[0008] Update the current cache disk cache according to the update type of the current cache disk cache;
[0009] When it is detected that the current cache disk cache has completed updating, a read instruction of the current cache disk cache is responded to, and hotspot data is read according to the hotspot meta-information.
[0010] Optionally, before detecting that the current cache disk cache needs to be updated, recording the hotspot meta information of the current cache disk cache includes:
[0011] Before detecting that the current cache disk cache is updated by adding a disk, obtaining the first cache data of the current cache disk cache according to the pre-added modulus value, and recording the meta information of the data to be remapped in the first cache data;
[0012] Before detecting that the current cache disk cache is updated by a deletion disk, obtaining the second cache data of the current cache disk cache according to the pre-deleted modulus value, and recording the meta information of the data to be remapped in the second cache data;
[0013] Before detecting that the current cache disk cache is updated by a replacement disk, recording is performed according to the user data ID of the memory metadata of the disk to be replaced.
[0014] Optionally, updating the current cache disk cache according to the update type of the current cache disk cache includes:
[0015] When the update type of the current cache disk cache is adding a disk, creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and updating the current cache disk cache;
[0016] When the update type of the current cache disk cache is to delete the disk, delete the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and update the current cache disk cache;
[0017] When the update type of the current cache disk cache is replacement disk, the current cache mapping relationship is modified to the replaced replacement disk, and the current cache disk cache is updated.
[0018] Optionally, when the update type of the current cache disk cache is adding a disk, creating a mapping relationship between a memory cache to be added and a disk corresponding to the memory cache to be added, and updating the current cache disk cache includes:
[0019] When the update type of the current cache disk cache is to add a disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0020] Creating a mapping relationship between a memory cache to be added and a disk corresponding to the memory cache to be added;
[0021] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0022] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0023] Optionally, when the update type of the current cache disk cache is to delete the disk, deleting the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and updating the current cache disk cache, includes:
[0024] When the update type of the current cache disk cache is to delete the disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0025] Deleting a mapping relationship between a memory cache to be deleted and a disk corresponding to the memory cache to be deleted;
[0026] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0027] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0028] Optionally, when the update type of the current cache disk cache is replacement disk, modifying the current cache mapping relationship to the replaced replacement disk, and updating the current cache disk cache includes:
[0029] When the update type of the current cache disk cache is disk replacement, clear the cache metadata to be replaced corresponding to the target disk to be replaced;
[0030] Modify the current cache mapping relationship to the replaced replacement disk;
[0031] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0032] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0033] Optionally, when it is detected that the current cache disk cache has completed updating, responding to a read instruction of the current cache disk cache, and reading the hotspot data according to the hotspot meta-information includes:
[0034] When it is detected that the current cache disk cache has completed updating, a pre-fetch task is started, and a read instruction of the target data is determined according to the pre-fetch task;
[0035] In response to a read instruction of the current cache disk cache, the hotspot data in the current cache disk cache is read according to the hotspot meta-information.
[0036] In a second aspect, in order to achieve the above-mentioned purpose, the present invention further proposes a cache disk update preheating device, the cache disk update preheating device comprising:
[0037] An information recording module, used for recording hotspot meta information of the current cache disk cache before detecting that the current cache disk cache needs to be updated;
[0038] An updating module, configured to update the current cache disk cache according to an update type of the current cache disk cache;
[0039] The data reading module is used to respond to the read instruction of the current cache disk cache when it is detected that the current cache disk cache has completed updating, and read the hotspot data according to the hotspot meta-information.
[0040] In the third aspect, to achieve the above-mentioned purpose, the present invention also proposes a cache disk update preheating device, the cache disk update preheating device comprising: a memory, a processor and a cache disk update preheating program stored in the memory and executable on the processor, the cache disk update preheating program being configured to implement the steps of the cache disk update preheating method as described above.
[0041] In a fourth aspect, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a cache disk update preheating program is stored, and when the cache disk update preheating program is executed by a processor, the steps of the cache disk update preheating method as described above are implemented.
[0042] The cache disk update preheating method proposed in the present invention records the hotspot meta-information of the current cache disk cache before detecting that the current cache disk cache needs to be updated; updates the current cache disk cache according to the update type of the current cache disk cache; responds to the read instruction of the current cache disk cache when detecting that the current cache disk cache has completed the update, and reads the hotspot data according to the hotspot meta-information; it can ensure that the host IO can hit in time, and after the maintenance action is completed, the cache data can be quickly restored, so that the performance is almost not reduced during this period, avoiding the failure of reading cache data due to cache data loss, and improving the speed and efficiency of cache disk update preheating. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0044] Figure 2 This is a schematic diagram of the process of the first embodiment of the cache disk update preheating method of the present invention;
[0045] Figure 3 This is a schematic diagram of the flow of the second embodiment of the cache disk update preheating method of the present invention;
[0046] Figure 4 This is a schematic diagram of the process of the third embodiment of the cache disk update preheating method of the present invention;
[0047] Figure 5 This is a schematic diagram of the flow of a fourth embodiment of a cache disk update preheating method of the present invention;
[0048] Figure 6 This is a functional module diagram of the first embodiment of the cache disk update preheating device of the present invention.
[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0051] The solution of the embodiment of the present invention is mainly: before detecting that the current cache disk cache needs to be updated, recording the hotspot meta-information of the current cache disk cache; updating the current cache disk cache according to the update type of the current cache disk cache; when detecting that the current cache disk cache has completed the update, responding to the read instruction of the current cache disk cache, and reading the hotspot data according to the hotspot meta-information; it can ensure that the host IO can hit in time, and after completing the maintenance action, the cache data can be quickly restored, so that the performance during this period is almost not reduced, avoiding the invalidation of read cache data caused by cache data loss, improving the speed and efficiency of cache cache disk update preheating, and solving the technical problems in the prior art that the read cache cannot be temporarily invalidated due to cache data loss, and cache data is easily invalidated when adding or deleting cache disks during operation and maintenance.
[0052] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0053] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (Non-Volatile Memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0054] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0055] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating device, a network communication module, a user interface module, and a cache disk update preheating program.
[0056] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and performs the following operations:
[0057] Before detecting that the current cache disk cache needs to be updated, recording the hotspot metadata of the current cache disk cache;
[0058] Update the current cache disk cache according to the update type of the current cache disk cache;
[0059] When it is detected that the current cache disk cache has completed updating, a read instruction of the current cache disk cache is responded to, and hotspot data is read according to the hotspot meta-information.
[0060] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0061] Before detecting that the current cache disk cache is updated by adding a disk, obtaining the first cache data of the current cache disk cache according to the pre-added modulus value, and recording the meta information of the data to be remapped in the first cache data;
[0062] Before detecting that the current cache disk cache is updated by a deletion disk, obtaining the second cache data of the current cache disk cache according to the pre-deleted modulus value, and recording the meta information of the data to be remapped in the second cache data;
[0063] Before detecting that the current cache disk cache is updated by a replacement disk, recording is performed according to the user data ID of the memory metadata of the disk to be replaced.
[0064] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0065] When the update type of the current cache disk cache is adding a disk, creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and updating the current cache disk cache;
[0066] When the update type of the current cache disk cache is to delete the disk, delete the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and update the current cache disk cache;
[0067] When the update type of the current cache disk cache is replacement disk, the current cache mapping relationship is modified to the replaced replacement disk, and the current cache disk cache is updated.
[0068] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0069] When the update type of the current cache disk cache is to add a disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0070] Creating a mapping relationship between a memory cache to be added and a disk corresponding to the memory cache to be added;
[0071] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0072] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0073] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0074] When the update type of the current cache disk cache is to delete the disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0075] Deleting a mapping relationship between a memory cache to be deleted and a disk corresponding to the memory cache to be deleted;
[0076] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0077] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0078] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0079] When the update type of the current cache disk cache is disk replacement, clear the cache metadata to be replaced corresponding to the target disk to be replaced;
[0080] Modify the current cache mapping relationship to the replaced replacement disk;
[0081] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0082] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0083] The device of the present invention calls the cache disk update preheating program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0084] When it is detected that the current cache disk cache has completed updating, a pre-fetch task is started, and a read instruction of the target data is determined according to the pre-fetch task;
[0085] In response to a read instruction of the current cache disk cache, the hotspot data in the current cache disk cache is read according to the hotspot meta-information.
[0086] This embodiment adopts the above scheme, by recording the hotspot meta-information of the current cache disk cache before detecting that the current cache disk cache needs to be updated; updating the current cache disk cache according to the update type of the current cache disk cache; responding to the read instruction of the current cache disk cache when detecting that the current cache disk cache has completed the update, and reading the hotspot data according to the hotspot meta-information; it can ensure that the host IO can hit in time, and after completing the maintenance action, the cache data can be quickly restored, so that the performance during this period is almost not reduced, avoiding the failure of reading cache data due to cache data loss, and improving the speed and efficiency of cache cache disk update preheating.
[0087] Based on the above hardware structure, an embodiment of the cache disk update preheating method of the present invention is proposed.
[0088] Reference Figure 2 , Figure 2This is a schematic diagram of the flow of the first embodiment of the cache disk update preheating method of the present invention.
[0089] In a first embodiment, the cache disk update preheating method comprises the following steps:
[0090] Step S10: before detecting that the current cache disk cache needs to be updated, record the hotspot metadata of the current cache disk cache.
[0091] It should be noted that, before detecting that the current cache disk cache needs to be updated, the hotspot meta information of the current cache disk cache is recorded, that is, before replacing the disk, or expanding or deleting the disk, the hotspot meta information of the cache can be recorded.
[0092] Step S20: Update the current cache disk cache according to the update type of the current cache disk cache.
[0093] It should be understood that after the update type of the current cache disk cache is obtained, the current cache disk cache may be updated according to the update type of the current cache disk cache.
[0094] Step S30: When it is detected that the current cache disk cache has completed updating, respond to a read instruction of the current cache disk cache and read the hotspot data according to the hotspot meta-information.
[0095] It is understandable that, when it is detected that the current cache disk cache has completed updating, after responding to a read instruction of the current cache disk cache, the hotspot data may be read according to the hotspot meta-information.
[0096] This embodiment adopts the above scheme, by recording the hotspot meta-information of the current cache disk cache before detecting that the current cache disk cache needs to be updated; updating the current cache disk cache according to the update type of the current cache disk cache; responding to the read instruction of the current cache disk cache when detecting that the current cache disk cache has completed the update, and reading the hotspot data according to the hotspot meta-information; it can ensure that the host IO can hit in time, and after completing the maintenance action, the cache data can be quickly restored, so that the performance during this period is almost not reduced, avoiding the failure of reading cache data due to cache data loss, and improving the speed and efficiency of cache cache disk update preheating.
[0097] Further, Figure 3 FIG. 1 is a flow chart of a second embodiment of a cache disk update preheating method according to the present invention. Figure 3As shown, a second embodiment of the cache disk update preheating method of the present invention is proposed based on the first embodiment. In this embodiment, step S10 specifically includes the following steps:
[0098] Step S11, before detecting that the current cache disk cache is updated by adding a disk, obtaining the first cache data of the current cache disk cache according to the pre-added modulus value, and recording the meta information of the data that needs to be remapped in the first cache data.
[0099] It should be noted that before detecting that the current cache disk cache is updated by adding a disk, the first cache data of the current cache disk cache can be obtained according to the pre-added modulus value, and then the metadata of the data that needs to be remapped in the first cache data can be recorded. That is, before adding the disk, the data in the cache is calculated according to the modulus value after the addition, and the metadata of the data that needs to be remapped is dumped into a file.
[0100] Step S12: before detecting that the current cache disk cache is updated as a deleted disk, obtaining the second cache data of the current cache disk cache according to the pre-deleted modulus value, and recording the meta information of the data that needs to be remapped in the second cache data.
[0101] It can be understood that before detecting that the current cache disk cache is updated as a deleted disk, the second cache data of the current cache disk cache is obtained according to the pre-deleted modulus value, and the metadata of the data that needs to be remapped in the second cache data is recorded. That is, before deleting the disk, the data in the cache is first calculated according to the modulus value after deletion, and the metadata of the data that needs to be remapped is dumped into a file.
[0102] Step S13: before detecting that the current cache disk cache is updated by a replacement disk, recording is performed according to the user data ID of the memory metadata of the disk to be replaced.
[0103] It should be understood that before detecting that the current cache disk cache is updated by a replacement disk, the user data ID of the memory metadata of the disk to be replaced can be recorded, that is, the user data ID in the memory metadata corresponding to the disk to be replaced is dumped into a file.
[0104] Through the above scheme, this embodiment obtains the first cache data of the current cache disk cache according to the pre-added modulus value before detecting that the current cache disk cache is updated for adding a disk, and records the metadata of the data that needs to be remapped in the first cache data; obtains the second cache data of the current cache disk cache according to the pre-deleted modulus value before detecting that the current cache disk cache is updated for deleting a disk, and records the metadata of the data that needs to be remapped in the second cache data; and records the user data ID of the memory metadata of the pre-replaced disk before detecting that the current cache disk cache is updated for replacing a disk, thereby ensuring that the host IO can hit in time and improving the accuracy of cache disk update preheating.
[0105] Further, Figure 4 FIG. 1 is a flow chart of a third embodiment of a cache disk update preheating method according to the present invention. Figure 4 As shown, a third embodiment of the cache disk update preheating method of the present invention is proposed based on the first embodiment. In this embodiment, the step S20 specifically includes the following steps:
[0106] Step S21: when the update type of the current cache disk cache is adding a disk, create a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and update the current cache disk cache.
[0107] It should be noted that when the update type of the current cache disk cache is to add a disk, a new memory cache and a mapping relationship between the corresponding disk can be created, thereby updating the current cache disk cache, that is, creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added.
[0108] Furthermore, the step S21 includes the following steps:
[0109] When the update type of the current cache disk cache is to add a disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0110] Creating a mapping relationship between a memory cache to be added and a disk corresponding to the memory cache to be added;
[0111] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0112] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0113] It can be understood that the corresponding cache metadata and the corresponding disk data that need to be remapped are cleared (or not cleared, and the cache itself will be eliminated naturally after it is full); the hard disk is added, that is, a new memory cache and the mapping relationship of the corresponding disk are created; the dumped information is reloaded into the memory, and the background pre-fetch process is started. According to the user data ID, the data to be cached is read from the back-end mechanical disk and written into the cache. After all the caches are completed, the background pre-fetch task is terminated.
[0114] Step S22: When the update type of the current cache disk cache is to delete the disk, the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted is deleted, and the current cache disk cache is updated.
[0115] It is understandable that when the update type of the current cache disk cache is to delete the disk, the mapping relationship between the memory cache and the corresponding disk can be deleted, and then the current cache disk cache is updated, that is, the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted is deleted.
[0116] Further, the step S22 includes the following steps:
[0117] When the update type of the current cache disk cache is to delete the disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0118] Deleting a mapping relationship between a memory cache to be deleted and a disk corresponding to the memory cache to be deleted;
[0119] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0120] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0121] It should be understood that the corresponding cache metadata and the corresponding disk data that need to be remapped are cleared (it is also possible not to clear them, as they will be eliminated naturally when the cache itself is full); the hard disk is deleted, that is, the memory cache and the mapping relationship of the corresponding disk are deleted; the dumped information is reloaded into the memory, and the background pre-fetch process is started. According to the user data ID, the data to be cached is read from the back-end mechanical disk and written into the cache. After all the caches are completed, the background pre-fetch task is terminated.
[0122] Step S23: when the update type of the current cache disk cache is replacement disk, modify the current cache mapping relationship to the replaced replacement disk, and update the current cache disk cache.
[0123] It should be understood that when the update type of the current cache disk cache is disk replacement, the cache mapping can be modified to the replacement disk, thereby updating the current cache disk cache, that is, modifying the current cache mapping relationship to the replacement disk.
[0124] Furthermore, the step S23 specifically includes the following steps:
[0125] When the update type of the current cache disk cache is disk replacement, clear the cache metadata to be replaced corresponding to the target disk to be replaced;
[0126] Modify the current cache mapping relationship to the replaced replacement disk;
[0127] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0128] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0129] In the specific implementation, the cache metadata corresponding to the disk to be replaced is cleared, and the cache mapping is modified to the replaced disk; the dumped information is reloaded into the memory, and the pre-fetch process is started in the background. According to the user data ID, the data to be cached is read from the back-end mechanical disk and written into the cache. After all the caches are completed, the background pre-fetch task is terminated.
[0130] This embodiment adopts the above scheme, by creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and updating the current cache disk cache when the update type of the current cache disk cache is adding a disk; deleting the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and updating the current cache disk cache when the update type of the current cache disk cache is deleting a disk; and modifying the current cache mapping relationship to the replaced replacement disk, and updating the current cache disk cache when the update type of the current cache disk cache is replacing a disk, which can ensure that the host IO can hit in time, and after the maintenance action is completed, the cache data can be quickly restored, so that the performance is almost not reduced during this period, and the accuracy of cache disk update preheating is improved.
[0131] Further, Figure 5 FIG. 4 is a flow chart of a fourth embodiment of a cache disk update preheating method according to the present invention. Figure 5 As shown, a fourth embodiment of the cache disk update preheating method of the present invention is proposed based on the first embodiment. In this embodiment, step S30 specifically includes the following steps:
[0132] Step S31: when it is detected that the current cache disk cache has completed updating, a pre-fetch task is started, and a read instruction of target data is determined according to the pre-fetch task.
[0133] It should be noted that when it is detected that the current cache disk cache has been updated, after the disk is replaced or expanded or deleted, hot spot data can be actively pre-fetched according to the previously recorded meta information, thereby ensuring that the host IO can be hit in time.
[0134] Step S32, responding to the read instruction of the current cache disk cache, and reading the hotspot data in the current cache disk cache according to the hotspot meta-information.
[0135] It is understandable that after responding to the read instruction of the current cache disk cache, the hotspot data in the current cache disk cache can be read according to the hotspot meta-information.
[0136] Through the above scheme, this embodiment starts a pre-fetch task when it is detected that the current cache disk cache has completed updating, determines the read instruction of the target data according to the pre-fetch task, responds to the read instruction of the current cache disk cache, and reads the hot data in the current cache disk cache according to the hot meta-information; it can ensure that the host IO can hit in time, and after the maintenance action is completed, the cache data can be quickly restored, so that the performance is almost not reduced during this period, avoiding the failure of reading cache data due to cache data loss, and improving the speed and efficiency of cache disk update preheating.
[0137] Correspondingly, the present invention further provides a cache disk update preheating device.
[0138] Reference Figure 6 , Figure 6 This is a functional module diagram of the first embodiment of the cache disk update preheating device of the present invention.
[0139] In a first embodiment of a cache disk update preheating device of the present invention, the cache disk update preheating device comprises:
[0140] The information recording module 10 is used to record the hotspot meta information of the current cache disk cache before detecting that the current cache disk cache needs to be updated.
[0141] The updating module 20 is configured to update the current cache disk cache according to the update type of the current cache disk cache.
[0142] The data reading module 30 is used to respond to the read instruction of the current cache disk cache and read the hotspot data according to the hotspot meta-information when detecting that the current cache disk cache has completed updating.
[0143] The information recording module 10 is also used to obtain the first cache data of the current cache disk cache according to the pre-added modulus value before detecting that the current cache disk cache is updated by adding a disk, and record the metadata of the data that needs to be remapped in the first cache data; before detecting that the current cache disk cache is updated by deleting a disk, obtain the second cache data of the current cache disk cache according to the pre-deleted modulus value, and record the metadata of the data that needs to be remapped in the second cache data; before detecting that the current cache disk cache is updated by replacing a disk, record according to the user data ID of the memory metadata of the pre-replaced disk.
[0144] The update module 20 is also used to create a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and update the current cache disk cache when the update type of the current cache disk cache is adding a disk; delete the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and update the current cache disk cache when the update type of the current cache disk cache is deleting a disk; and modify the current cache mapping relationship to the replacement disk to update the current cache disk cache when the update type of the current cache disk cache is replacing a disk.
[0145] The update module 20 is also used to clear the remapped cache metadata and the original data on the corresponding disk that need to be remapped when the update type of the current cache disk cache is to add a disk, or naturally eliminate the remapped cache metadata and the original data after the data of the current cache disk cache is full; create a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added; store the newly loaded dump information in the current cache disk cache, read the data to be cached from the back-end mechanical disk according to the user data ID, and write it to the current cache disk cache; after all the data to be cached are cached, end the background prefetch task.
[0146] The update module 20 is also used to clear the remapped cache metadata and the original data on the corresponding disk that need to be remapped when the update type of the current cache disk cache is to delete the disk, or naturally eliminate the remapped cache metadata and the original data after the data of the current cache disk cache is full; delete the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted; store the newly loaded dumped information in the current cache disk cache, read the data to be cached from the back-end mechanical disk according to the user data ID, and write it to the current cache disk cache; after all the data to be cached are cached, end the background prefetch task.
[0147] The update module 20 is also used to clear the cache metadata to be replaced corresponding to the target disk to be replaced when the update type of the current cache disk cache is replacement disk; modify the current cache mapping relationship to the replacement disk; store the newly loaded dumped information in the current cache disk cache, read the data to be cached from the back-end mechanical disk according to the user data ID, and write it to the current cache disk cache; after all the data to be cached are cached, end the background pre-fetch task.
[0148] The data reading module 30 is also used to start a pre-fetch task when it is detected that the current cache disk cache has completed updating, and determine the read instruction of the target data according to the pre-fetch task; respond to the read instruction of the current cache disk cache, and read the hot data in the current cache disk cache according to the hot meta information.
[0149] Among them, the steps implemented by each functional module of the cache disk update preheating device can refer to the various embodiments of the cache disk update preheating method of the present invention, and will not be repeated here.
[0150] In addition, an embodiment of the present invention further provides a storage medium, on which a cache disk update preheating program is stored. When the cache disk update preheating program is executed by a processor, the following operations are implemented:
[0151] Before detecting that the current cache disk cache needs to be updated, recording the hotspot metadata of the current cache disk cache;
[0152] Update the current cache disk cache according to the update type of the current cache disk cache;
[0153] When it is detected that the current cache disk cache has completed updating, a read instruction of the current cache disk cache is responded to, and hotspot data is read according to the hotspot meta-information.
[0154] Furthermore, when the cache disk update preheating program is executed by the processor, the following operations are also implemented:
[0155] Before detecting that the current cache disk cache is updated by adding a disk, obtaining the first cache data of the current cache disk cache according to the pre-added modulus value, and recording the meta information of the data to be remapped in the first cache data;
[0156] Before detecting that the current cache disk cache is updated by a deletion disk, obtaining the second cache data of the current cache disk cache according to the pre-deleted modulus value, and recording the meta information of the data to be remapped in the second cache data;
[0157] Before detecting that the current cache disk cache is updated by a replacement disk, recording is performed according to the user data ID of the memory metadata of the disk to be replaced.
[0158] Furthermore, when the cache disk update preheating program is executed by the processor, the following operations are also implemented:
[0159] When the update type of the current cache disk cache is adding a disk, creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and updating the current cache disk cache;
[0160] When the update type of the current cache disk cache is to delete the disk, delete the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and update the current cache disk cache;
[0161] When the update type of the current cache disk cache is replacement disk, the current cache mapping relationship is modified to the replaced replacement disk, and the current cache disk cache is updated.
[0162] Furthermore, when the cache disk update preheating program is executed by the processor, the following operations are also implemented:
[0163] When the update type of the current cache disk cache is to add a disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0164] Creating a mapping relationship between a memory cache to be added and a disk corresponding to the memory cache to be added;
[0165] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0166] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0167] Furthermore, when the cache disk update preheating program is executed by the processor, the following operations are also implemented:
[0168] When the update type of the current cache disk cache is to delete the disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated;
[0169] Deleting a mapping relationship between a memory cache to be deleted and a disk corresponding to the memory cache to be deleted;
[0170] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0171] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0172] Furthermore, when the cache disk update preheating program is executed by the processor, the following operations are also implemented:
[0173] When the update type of the current cache disk cache is disk replacement, clear the cache metadata to be replaced corresponding to the target disk to be replaced;
[0174] Modify the current cache mapping relationship to the replaced replacement disk;
[0175] The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk;
[0176] After all the data to be cached are cached, the background pre-fetching task is terminated.
[0177] Furthermore, when the cache disk update preheating program is executed by the processor, the following operations are also implemented:
[0178] When it is detected that the current cache disk cache has completed updating, a pre-fetch task is started, and a read instruction of the target data is determined according to the pre-fetch task;
[0179] In response to a read instruction of the current cache disk cache, the hotspot data in the current cache disk cache is read according to the hotspot meta-information.
[0180] Those skilled in the art will appreciate that all or part of the steps in the above-mentioned implementation method can be accomplished by instructing related hardware through a program, and the program is stored in a storage medium, including a number of instructions for enabling a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each implementation method of the present application; and the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0181] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0182] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0183] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A cache disk update preheating method, characterized in that: The cache disk update preheating method comprises: Before detecting that the current cache disk cache needs to be updated, recording the hotspot metadata of the current cache disk cache; Update the current cache disk cache according to the update type of the current cache disk cache; When it is detected that the current cache disk cache has completed updating, responding to a read instruction of the current cache disk cache, reading hotspot data according to the hotspot meta information; The step of recording the hotspot metadata of the current cache disk cache before detecting that the current cache disk cache needs to be updated includes: Before detecting that the current cache disk cache is updated by adding a disk, obtaining the first cache data of the current cache disk cache according to the pre-added modulus value, and recording the meta information of the data to be remapped in the first cache data; Before detecting that the current cache disk cache is updated by a deletion disk, obtaining the second cache data of the current cache disk cache according to the pre-deleted modulus value, and recording the meta information of the data to be remapped in the second cache data; Before detecting that the current cache disk cache is updated by a replacement disk, recording is performed according to the user data ID of the memory metadata of the disk to be replaced.
2. The cache disk update preheating method according to claim 1, characterized in that: The updating of the current cache disk cache according to the update type of the current cache disk cache includes: When the update type of the current cache disk cache is adding a disk, creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and updating the current cache disk cache; When the update type of the current cache disk cache is to delete the disk, delete the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and update the current cache disk cache; When the update type of the current cache disk cache is replacement disk, the current cache mapping relationship is modified to the replaced replacement disk, and the current cache disk cache is updated.
3. The cache disk update preheating method according to claim 2, characterized in that: When the update type of the current cache disk cache is adding a disk, creating a mapping relationship between the memory cache to be added and the disk corresponding to the memory cache to be added, and updating the current cache disk cache, including: When the update type of the current cache disk cache is to add a disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated; Creating a mapping relationship between a memory cache to be added and a disk corresponding to the memory cache to be added; The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk; After all the data to be cached are cached, the background pre-fetching task is terminated.
4. The cache disk update preheating method according to claim 2, characterized in that: When the update type of the current cache disk cache is to delete the disk, deleting the mapping relationship between the memory cache to be deleted and the disk corresponding to the memory cache to be deleted, and updating the current cache disk cache, includes: When the update type of the current cache disk cache is to delete the disk, the remapped cache metadata that needs to be remapped and the original data on the corresponding disk are cleared, or when the data of the current cache disk cache is full, the remapped cache metadata and the original data are naturally eliminated; Deleting a mapping relationship between a memory cache to be deleted and a disk corresponding to the memory cache to be deleted; The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk; After all the data to be cached are cached, the background pre-fetching task is terminated.
5. The cache disk update preheating method according to claim 2, characterized in that: When the update type of the current cache disk cache is replacement disk, modifying the current cache mapping relationship to the replaced replacement disk, and updating the current cache disk cache, includes: When the update type of the current cache disk cache is disk replacement, clear the cache metadata to be replaced corresponding to the target disk to be replaced; Modify the current cache mapping relationship to the replaced replacement disk; The newly loaded dumped information is stored in the cache of the current cache disk, and the data to be cached is read from the back-end mechanical disk according to the user data ID, and written into the cache of the current cache disk; After all the data to be cached are cached, the background pre-fetching task is terminated.
6. The cache disk update preheating method according to claim 1, characterized in that: When it is detected that the current cache disk cache has completed updating, responding to a read instruction of the current cache disk cache, and reading hotspot data according to the hotspot meta information, comprises: When it is detected that the current cache disk cache has completed updating, a pre-fetch task is started, and a read instruction of the target data is determined according to the pre-fetch task; In response to a read instruction of the current cache disk cache, the hotspot data in the current cache disk cache is read according to the hotspot meta-information.
7. A cache disk update preheating device, characterized in that: The cache disk update preheating device comprises: An information recording module, used for recording hotspot meta information of the current cache disk cache before detecting that the current cache disk cache needs to be updated; An updating module, configured to update the current cache disk cache according to an update type of the current cache disk cache; A data reading module, for responding to a read instruction of the current cache disk cache and reading hotspot data according to the hotspot meta information when detecting that the current cache disk cache has completed updating; The information recording module is also used to obtain the first cache data of the current cache disk cache according to the pre-added modulus value before detecting that the current cache disk cache is updated by adding a disk, and record the metadata of the data that needs to be remapped in the first cache data; before detecting that the current cache disk cache is updated by deleting a disk, obtain the second cache data of the current cache disk cache according to the pre-deleted modulus value, and record the metadata of the data that needs to be remapped in the second cache data; before detecting that the current cache disk cache is updated by replacing a disk, record according to the user data ID of the memory metadata of the pre-replaced disk.
8. A cache disk update preheating device, characterized in that: The cache disk update preheating device includes: a memory, a processor, and a cache disk update preheating program stored in the memory and executable on the processor, wherein the cache disk update preheating program is configured to implement the steps of the cache disk update preheating method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a cache disk update preheating program, and when the cache disk update preheating program is executed by the processor, the steps of the cache disk update preheating method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Cache disk replacement method and device, equipment and storage medium
CN115328407A
