A distributed caching method and device for SSD data redefinition
By introducing redundant metadata design for primary and secondary replicas in the distributed cache, combined with changes in the disk pool topology, the problem of low data recovery performance after SSD disk failure is solved, achieving fast data recovery and efficient data storage.
Patent Information
- Application Number
- CN202211268550.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2042-10-17
AI Technical Summary
Existing distributed caching technologies have low data recovery performance after SSD disk failure and insufficient redundancy, which affects data storage efficiency.
By introducing redundant metadata information for primary and secondary replicas in the distributed cache, and combining it with changes in the disk pool topology, we can achieve rapid switching and recovery of data when the node state changes.
It reduces data recovery overhead, improves data recovery speed, and enhances SSD utilization and data storage reliability.
Smart Images

Figure CN115687274B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of distributed storage technology, and in particular to a distributed caching method and device for SSD data remapping. Background Technology
[0002] With the development of hard drive technology, SSDs, with their ultra-high IOPS, ultra-low latency, and ultra-high bandwidth advantages, are gradually replacing traditional HDDs. However, SSDs are still more expensive than traditional HDDs, and they also have a limited lifespan with a limited number of write cycles. Therefore, how to store more data with the same capacity SSDs has become a hot research topic in SSD usage.
[0003] The industry commonly adopts the method of adding an index layer to redirect user-written data to erasure coding objects, thereby improving the utilization of SSD disks without reducing redundancy or compromising reliability. To aggregate larger amounts of data written to the front end while ensuring that front-end write performance is not affected, a distributed cache can be added to the front-end write process; data is returned once it is written to the distributed cache.
[0004] Compared to traditional local caching, distributed caching requires consideration of how data can be recovered after a failure, which presents significant technical challenges. The distributed caching technologies published in the industry mainly rely on distributed objects as the underlying foundation for persistence, and data recovery requires reading distributed objects, resulting in relatively low performance. Summary of the Invention
[0005] This application provides a distributed caching method and device for SSD data relocation, which triggers distributed cache data switching by changing the disk pool topology, thereby reducing recovery overhead and improving data recovery speed.
[0006] This application provides a distributed caching method for SSD data relocation, applied to a distributed storage cluster including multiple nodes, and the cache based on the multiple nodes comprises at least one cache pool, the cache pool including a primary replica (primary target) and secondary replicas (secondary targets). The distributed caching method includes:
[0007] When front-end data is written to the cache pool, a distributed object is directly written to the main target of the cache pool, and then transferred to the back-end based on the cache pool; and
[0008] Write the metadata information of any cached distributed object to the secondary target of the cachepool, wherein the metadata information is redundant;
[0009] In case of any node state change, the cachepool is used to send the updated hard disk pool topology to all nodes, so that each node scans the cached metadata information in the node based on the updated hard disk pool topology, converts the metadata cache into data cache, and recovers the cache.
[0010] Optionally, the data cached by any node is not bound to a single object in the cluster, so that when the distributed object is data sliced, all primary targets fall into the data of the any node.
[0011] Optionally, the metadata information includes the object name currently written into the cachepool and the position information of the writing, and the metadata information is redundant, and the number of redundancies is consistent with the number of redundancies of the cachepool.
[0012] Optionally, before the cachepool is used to send the updated hard disk pool topology to all nodes, the cachepool is further used to update the hard disk pool topology to identify the failed node in the updated hard disk pool topology.
[0013] Optionally, each node scans the cached metadata information in the node based on the updated hard disk pool topology to convert the metadata cache into data cache, including:
[0014] Each node scans the cached metadata information in the node based on the updated hard disk pool topology.
[0015] If the primary target of the distributed object cached by any node falls into the any node under the updated topology, the metadata cache is converted into data cache.
[0016] Optionally, converting the metadata cache into data cache includes:
[0017] Reading the corresponding metadata information from the any node;
[0018] Based on the read metadata information, the corresponding data is inserted into the cache of the any node to realize the recovery of the primary target data.
[0019] Optionally, in case of super-redundancy failure, the recovery is performed in the following manner:
[0020] After the super-redundancy state of the failed node is restored to normal, all local metadata of the failed node is scanned.
[0021] If the local address of the local metadata is consistent with that before the storage, the object data is recovered to the cache.
[0022] The embodiment of the present application also provides a computer device, comprising a processor and a memory, wherein the memory stores a computer program, and the computer program is executed by the processor to realize the steps of the foregoing method.
[0023] The embodiment of the present application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps of the foregoing distributed cache method for SSD data repositioning.
[0024] The embodiment of the present application triggers distributed cache data switching through hard disk pool topology structure change, reduces recovery overhead, and improves data recovery speed.
[0025] The foregoing description is only a summary of the technical scheme of the present application, in order to more clearly understand the technical means of the present application, the specific embodiments of the present application can be implemented according to the content of the specification, and in order to make the foregoing and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS
[0026] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not meant to limit the present application. Moreover, the same reference numerals in the attached drawings refer to the same or similar components. In the drawings:
[0027] Figure 1 for the existing distributed cache method example;
[0028] Figure 2 for the cache pool architecture example of the distributed cache method of the embodiment of the present application;
[0029] Figure 3 for the data write flow example of the distributed cache method of the embodiment of the present application;
[0030] Figure 4 for the node non-redundancy fault recovery flow example of the distributed cache method of the embodiment of the present application;
[0031] Figure 5 for the node super-redundancy fault recovery flow example of the distributed cache method of the embodiment of the present application. DETAILED DESCRIPTION
[0032] Exemplary embodiments of the present disclosure will be described in greater detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0033] As Figure 1 shown, the prior art distributed cache writes data to datacache, and uses distributed objects as logs to record data in datacache that has not been flushed to disk. If the node where datacache is located fails, the logs of distributed objects are read by other normal nodes for recovery. Since data is persisted in the form of logs, data in the logs is not directly readable, and can only be read after being restored to datacache.
[0034] The embodiment of the present application provides a distributed cache method for SSD data repositioning, which is applied to a distributed storage cluster including multiple nodes, and at least one cache pool (cache pool) is formed based on the cache of the multiple nodes, the cache pool includes a primary replica (primary target) and a secondary replica (secondary target), as Figure 2 shown, wherein the primary target includes datacache (data cache), and the secondary target includes metacache (metadata cache), and the distributed cache method includes:
[0035] As Figure 3 shown, in the case of foreground data writing to the cache pool, the distributed object is directly written to the primary target of the cache pool, so as to be transferred to the backend based on the cache pool; and
[0036] Metadata information of any cache distributed object is written to the secondary target of the cache pool, wherein the metadata information is redundant.
[0037] Specifically, the distributed cache method provided by the embodiment of the present application writes foreground data to the cache pool, and does not realize persistence through the log mode, but writes the cache distributed object normally. Before the data is transferred to the backend aggregated erasure code large object from the cache object, the data can be normally read and written.
[0038] In some embodiments, the data cached by any node is not bound to a single object in the cluster, so that when the distributed object is sliced, all primary targets fall into the data of the any node.
[0039] In the embodiments of the present application, the data cached by each node is not bound to a single object in the cluster, and each node caches data of all primary replicas (primary targets) of the distributed object falling into the current node when the distributed object is sliced. When data is written to the object of each cache pool, if the current node is a primary replica, the current written data is cached in the memory while being written to the hard disk of the current node, and the current node transfers the data cached in the memory to the aggregated erasure code large object through a background task.
[0040] In the case of any change in the state of any node, the cachepool is used to send the updated hard disk pool topology structure to all nodes, so that each node scans the cached metadata information in the node based on the updated hard disk pool topology structure, converts the metadata cache to data cache, and recovers the cache.
[0041] Specifically, the state change in the present example can be, for example, from a normal state to a fault state, or node expansion or contraction, etc. In the case of a change in the state of a node, the cachepool is used to send the updated hard disk pool topology structure to all nodes, so that all non-fault nodes can recover the cache according to the updated topology structure after receiving the topology structure update information of the hard disk pool.
[0042] The embodiments of the present application trigger distributed cache data switching through hard disk pool topology structure change, reduce recovery overhead, and improve data recovery speed.
[0043] In some embodiments, before the cachepool is used to send the updated hard disk pool topology structure to all nodes, it further includes updating the hard disk pool topology structure using the cachepool to identify the fault node in the updated hard disk pool topology structure. In some embodiments, the metadata information includes the object name currently written to the cachepool and the write position information, and the metadata information is redundant, and the number of redundancies is consistent with the number of redundancies of the cachepool. The metadata cache designed in the present example is another key to realize the memory distributed cache. Specifically, all objects written to the cache hard disk pool have redundant metadata (metadata information is included in the metadata cache), and the number of redundancies is consistent with the number of redundancies of the cachepool. The metadata information in the present example includes the object name currently written to the cache hard disk pool, write position information, etc.
[0044] In some embodiments, as shown in Figure 4 Each node scans the cached metadata information in the node based on the updated hard disk pool topology structure to convert the metadata cache to data cache, which includes:
[0045] Each node scans the cached metadata information within its own node based on the updated disk pool topology;
[0046] If the primary target of a distributed object cached by any node falls into any of those nodes in the updated topology, then the metadata cache is converted into a data cache.
[0047] Specifically, when a node fails, the cachepool will publish a new disk pool topology to all nodes. Under the new topology, the failed node is marked as failed, and distributed objects that were originally assigned to the failed node will be computed on the new node. All non-failed nodes, upon receiving the disk pool topology update information, scan all metacache instances on their node (each node participates in cache recovery). If the primary copy of a cached object has already been assigned to the current node under the new topology, the metadata cache is converted to a data cache, and the cache is restored.
[0048] In some embodiments, converting a metadata cache into a data cache includes:
[0049] Read the corresponding metadata information from any of the nodes;
[0050] Based on the read metadata information, the corresponding data is inserted into the cache of any of the nodes to enable data recovery in the main target.
[0051] This example further illustrates how metadata caching is converted into data caching. Using metadata information, such as the cached object name and location, data is read from the current node (a node with metadata must be reading from the target, so it can be read locally), and then the data is inserted into the current node's cache. In this example, under non-overly redundant failure scenarios, each cached disk pool object to be transferred to erasure coding objects has a metadata cache, thus enabling cache recovery to be completed.
[0052] If data is also cached directly from the replica, no data needs to be read when switching from the replica to the primary replica, but this will waste a lot of memory. The embodiments of this application use the replica for metadata caching, thereby overcoming the above problem.
[0053] In the event of an over-redundancy failure, both the data cache and metadata cache will be lost, and the cached data cannot be recovered using the methods described above. For over-redundancy scenarios, this application also proposes a full-disk scan method to recover cached data. In some embodiments, such as... Figure 5 As shown, in the event of an over-redundancy failure, recovery is performed in the following manner:
[0054] After the super-redundancy state of the faulty node is restored to normal, scan all local metadata of the faulty node;
[0055] If the local address of the local metadata is consistent with that before the migration, the object data is restored to the cache.
[0056] Specifically, when the super redundancy state of the failed node is restored to normal, all local metadata of the failed node is scanned, and if the metadata is still the local address before the migration (the object address of the erasure code recorded after the migration), the object data is restored to the cache.
[0057] The method of the embodiment of the application can restore the data cache through the metadata cache for the non-super redundancy failure scenario, and the local data can be read to restore, and the restoration overhead is small. After the node fails, all cluster nodes concurrently restore the cache data, and the restoration speed is fast. For the migrated data of the cache pool, the cache data is directly written to the erasure code large object, and there is no need to read the persistent data. The method of the application writes the front-end IO to the cache hard disk pool, only caches the data in the primary copy, and only caches the metadata in the secondary copy, and the memory consumption is small.
[0058] The embodiment of the application further provides a computer device, including a processor and a memory, the memory stores a computer program, and the computer program is executed by the processor to realize the steps of the method.
[0059] The embodiment of the application further provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to realize the steps of the method.
[0060] It should be noted that in this paper, the term "including", "containing" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0061] The above-mentioned serial numbers of the embodiments of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0062] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, also can be through hardware, but many cases the former is the better embodiment. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art contribution can be embodied in the form of software product, the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disc, optical disc), including a number of instructions to make a terminal (may be a mobile phone, computer, server or network equipment, etc.) executes the method described in various embodiments of the present application.
[0063] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, the above-mentioned specific embodiments are only illustrative, but not limited, those skilled in the art can make many forms without departing from the purpose of the present application and the scope of the claims under the inspiration of the present application, which are all within the protection of the present application.
Claims
1. A distributed caching method for SSD data repositioning, characterized in that, The application is applied to a distributed storage cluster including multiple nodes, and at least one cache pool is formed based on the cache of the multiple nodes. The cache pool includes a master target and a slave target. The distributed cache method includes: In the case of foreground data writing to the cache pool, the distributed object is directly written to the master target of the cache pool to be stored to the backend based on the cache pool; and Metadata information of any cached distributed object is written to the slave target of the cache pool, wherein the metadata information is redundant; In the case of any node state change, the cache pool is used to send an updated hard disk pool topology to all nodes, so that each node scans the cached metadata information in the node based on the updated hard disk pool topology to convert the metadata cache into data cache and restore the cache; the data cached by any node is not bound to a single object in the cluster, so that all master targets of the distributed object fall into the data of the any node when the data is sliced. The metadata information includes the object name and the position information written to the cache pool, the metadata information is redundant, and the redundant quantity is consistent with the redundant quantity of the cache pool. Before the cache pool is used to send the updated hard disk pool topology to all nodes, the hard disk pool topology is updated by using the cache pool to identify the failed node in the updated hard disk pool topology. The metadata cache is converted into data cache, including:
2. The distributed caching method for SSD data repositioning of claim 1, wherein, The corresponding metadata information is read from the any node; 3. The distributed caching method for SSD data repositioning of claim 2, wherein, Based on the read metadata information, the corresponding data is inserted into the cache of the any node to restore the data in the master target.
4. The distributed caching method for SSD data repositioning of claim 1, wherein, In the case of super-redundancy failure, the recovery is performed in the following manner: After the super-redundancy state of the failed node is restored to normal, all local metadata of the failed node is scanned; If the local address of the local metadata is consistent with that before the storage, the object data is restored to the cache.
5. The distributed caching method for SSD data repositioning of claim 1, wherein, The application includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, the steps of the distributed cache method for SSD data redefinition according to any one of claims 1 to 5 are implemented. 6. A computer device, comprising: 7. A computer readable storage medium characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the distributed caching method for SSD data relocation according to any one of claims 1 to 5.
Citation Information
Patent Citations
Distributed database management method and system
CN105930498A
Data backup method and system of distributed storage system
CN110633168A