Data storage method and computing device
By concurrently writing data fragments in the cache device and writing to the continuous area of the slow storage device in the append write mode, the problem of low storage performance caused by the discontinuous position of the data fragments is solved and the storage performance and reliability are improved. .
Patent Information
- Application Number
- PCT/CN2024/089075
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-25
- Filing Date
- 2024-04-22
- Publication Date
- 2024-10-31
AI Technical Summary
In computing devices, the location of data fragments in slow storage devices is discontinuous, resulting in low storage performance, mainly due to the address coupling problem between cache devices and slow storage devices.
By concurrently writing data fragments in the cache device and writing them to the continuous data storage area of the slow storage device in an append-write manner, the address coupling is reduced, thereby improving the read and write speed and storage of the slow storage device. performance.
It improves the read and write speed of slow storage devices, improves the storage performance of computing devices, reduces data reconstruction time when the cache device fails, enhances storage reliability, and saves the storage capacity of the cache device.
Smart Images

Figure CN2024089075_31102024_PF_FP_ABST
Abstract
Description
Data storage method and computing device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on April 25, 2023, with application number 202310457172.0 and application name “A Data Storage Method and Computing Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a data storage method and a computing device. Background Art
[0003] In the art, most computing devices use a hybrid storage solution that combines a cache device and a slow storage device.
[0004] In related technologies, data is written concurrently to a cache device in fragments, and then flushed from the cache device to a slow storage device in an append-write manner. There is a strong coupling between the addresses of the cache device and the slow storage device. After multiple data fragments are written concurrently to the cache device, due to the aforementioned address coupling, the locations where the multiple fragments of a data are flushed to the slow storage device are discontinuous. The discontinuous locations of the multiple fragments of data on the slow storage device will reduce the read and write speed of the slow storage device, thereby reducing the storage performance of the storage device.
[0005] Summary of the Invention
[0006] The present application provides a data storage method and a computing device, which can solve the problem that the storage performance of the computing device is low due to the discontinuous location of data fragments in a slow storage device.
[0007] In a first aspect, the present application provides a data storage method. The method comprises: obtaining first data from a first cache device, wherein the first cache device supports concurrent writes, and concurrently writing the first data to at least two data storage areas of the first cache device in a fragmented manner; and writing the first data to a first continuous data storage area of a first slow storage device in an append-write manner, wherein the first slow storage device supports append-writes.
[0008] The at least two data storage areas in the first cache device where the first data is written may include multiple consecutive data storage areas in the first cache device, or multiple discontinuous data storage areas in the first cache device.
[0009] In the above embodiment, after the first data is written to the first cache device in fragments and concurrently, the first data is written to the continuous storage area of the first slow storage device in an appended manner, which can improve the read and write speed of the slow storage device, thereby improving the storage performance of the computing device.
[0010] In a possible implementation of the first aspect, the first data is concurrently written into at least two data storage areas of the first cache device in a sharded manner, including: storing first metadata associated with the first data in the first cache device in a first metadata storage area of the first cache device, wherein the first metadata is used to record addresses of multiple shards of the first data in the at least two data storage areas.
[0011] The obtaining of the first data from the first cache device includes: reading the first metadata from the first cache device; reading the multiple shards from the at least two data storage areas recorded in the first metadata respectively; and aggregating the multiple shards into the first data.
[0012] In the above implementation, when multiple shards of first data are concurrently written to the first cache device, first metadata associated with the first data is stored in the first cache device, and the multiple shards of the first data can be easily read from the first cache device.
[0013] In a possible implementation of the first aspect, the method further includes: storing the second metadata in a second metadata storage area of the first cache device.
[0014] In the above embodiment, when the first data is flushed to the first slow storage device, the second metadata of the first data is stored in the first cache device, so that the first data can be easily read from the first slow storage device.
[0015] In a possible implementation of the first aspect, writing the first data into a first continuous data storage area of a first slow storage device in an append-write manner includes: storing second metadata for recording the address of the first data in the first continuous data storage area and the size of the first data in a metadata storage area of the first slow storage device.
[0016] In the above embodiment, when the first data is flushed to the first slow storage device, the second metadata of the first data is stored in the first slow storage device, and the relevant storage information of the first data can be easily read from the first slow storage device.
[0017] In a possible implementation of the first aspect, the method further includes: in the event that the first cache device fails, reading the second metadata stored in the metadata storage area of the first slow storage device; determining incremental data based on the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, and the incremental data is the data written to the backup cache device after the first cache device fails; and writing the incremental data into the first continuous data storage area of the first slow storage device in an append-write manner.
[0018] In the above embodiment, storing the second metadata of the first data in the first slow storage device can reduce the amount of metadata stored in the cache device, thereby saving the storage capacity of the cache device. In addition, this embodiment also allows the first data to be read from the first slow storage device based on the second metadata of the first slow storage device if the first cache device fails and loses the second metadata.
[0019] In a possible implementation of the first aspect, the method further includes: in the event that the first cache device fails, reading the second metadata stored in the metadata storage area of the first slow storage device; determining incremental data based on the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, the incremental data being the data written to the backup cache device and the first cache device before the failure of the first cache device, and the data written to the backup cache device and the first slow storage device before the failure of the first cache device; and writing the incremental data to the first continuous data storage area of the first slow storage device in an append-write manner.
[0020] In the above embodiment, if the first cache device fails, because the first slow storage device stores the second metadata of the first data as a backup, incremental data in the second data can be reconstructed based on the data size increments in the second metadata. Compared to directly reconstructing the second data, this can significantly reduce data reconstruction time and improve storage reliability.
[0021] In a possible implementation of the first aspect, the method further includes: obtaining third data from a first cache device, wherein the third data is concurrently written into at least two data storage areas of the first cache device in a fragmented manner; and writing the third data into a continuous data storage area of a second slow storage device in an append-write manner, wherein the second slow storage device supports append-write.
[0022] In the above implementation, the data in the first cache device can be flushed to multiple slow storage devices, thereby improving the storage capacity of the computing device.
[0023] In a possible implementation of the first aspect, the first cache device includes a memory or a solid-state drive (SSD), and the first slow storage device includes a tape storage or a mechanical hard disk (HDD).
[0024] In a second aspect, the present application provides a data storage device comprising a reading module and a storage module.
[0025] The reading module is used to obtain first data from a first cache device, wherein the first cache device supports concurrent writing, and the first data is concurrently written into at least two data storage areas of the first cache device in a fragmented manner;
[0026] The storage module is configured to write the first data into a first continuous data storage area of a first slow storage device in an append-write manner, wherein the first slow storage device supports append-write.
[0027] In a possible implementation of the second aspect, the reading module is specifically configured to: store first metadata associated with the first data in the first cache device in a first metadata storage area of the first cache device, wherein the first metadata is used to record addresses of multiple shards of the first data in the at least two data storage areas;
[0028] The reading module is further specifically configured to: read the first metadata from the first cache device; read the multiple shards from the at least two data storage areas recorded in the first metadata respectively; and aggregate the multiple shards into the first data.
[0029] In a possible implementation of the second aspect, the storage module is specifically configured to store second metadata for recording an address of the first data in the first continuous data storage area and a size of the first data in a metadata storage area of the first slow storage device.
[0030] In a possible implementation of the second aspect, the reading module is further used to: in the event that the first cache device fails, read the second metadata stored in the metadata storage area of the first slow storage device; determine incremental data based on the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, and the incremental data is the data written to the backup cache device after the first cache device fails; and write the incremental data into the first continuous data storage area of the first slow storage device in an append-write manner.
[0031] In a possible implementation of the second aspect, the reading module is further used to: in the event that the first cache device fails, read the second metadata stored in the metadata storage area of the first slow storage device; determine incremental data based on the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, the incremental data being the data written to the backup cache device and the first cache device before the failure of the first cache device, and the data written to the backup cache device and the first slow storage device before the failure of the first cache device; and write the incremental data to the first continuous data storage area of the first slow storage device in an append-write manner.
[0032] In a possible implementation manner of the second aspect, the storage module is further configured to: store the second metadata in a second metadata storage area of the first cache device.
[0033] In a possible implementation of the second aspect, the reading module is further used to: obtain third data from the first cache device, wherein the third data is concurrently written into at least two data storage areas of the first cache device in a fragmented manner; and write the third data into a continuous data storage area of a second slow storage device in an append-write manner, wherein the second slow storage device supports append-write.
[0034] In a possible implementation of the second aspect, the first cache device includes a memory or a solid-state drive (SSD), and the first slow storage device includes a tape storage or a mechanical hard disk (HDD).
[0035] In a third aspect, the present application provides a computing device. The computing device includes a processor, a first cache device, and a first slow storage device. The processor is configured to execute computer instructions stored in the first cache device or the first slow storage device to implement any one of the first aspect and its possible implementations.
[0036] In a fourth aspect, the present application provides a storage system, which includes the computing device described in the third aspect.
[0037] In a fifth aspect, the present application provides a computer-readable storage medium having computer instructions stored therein. When the computer instructions are executed on a computer, the computer implements any one of the solutions in the first aspect and its possible implementations.
[0038] In a sixth aspect, the present application provides a computer program product comprising computer instructions, which, when executed on a computer, enables the computer to implement any one of the first aspect and its possible implementations.
[0039] Any of the above-mentioned devices, storage devices, storage systems, computer storage media, or computer program products is used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding schemes in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] FIG1 is a schematic diagram of the structure of a server provided in an embodiment of the present application;
[0041] FIG2 is a schematic diagram of the structure of another server provided in an embodiment of the present application;
[0042] 3 is a schematic diagram of a server performing address coupling management on a cache device and a slow storage device according to an embodiment of the present application;
[0043] FIG4 is a schematic diagram of a disk flushing process under address coupling management of a cache device and a slow storage device provided by an embodiment of the present application;
[0044] FIG5 is a schematic diagram of a server performing address decoupling management on a cache device and a slow storage device, provided by an embodiment of the present application;
[0045] FIG6 is a flow chart of a data storage method provided in an embodiment of the present application;
[0046] FIG7 is a schematic diagram of a write-back and disk flushing method provided by an embodiment of the present application;
[0047] FIG8 is a schematic diagram of partitioning of a cache device and a slow storage device provided by an embodiment of the present application;
[0048] 9A and 9B are schematic diagrams of updating metadata provided by an embodiment of the present application;
[0049] FIG10 is a schematic structural diagram of a server including multiple slow storage devices provided in an embodiment of the present application;
[0050] 11 is a schematic diagram of backup and elimination of metadata areas of a slow storage device in a cache device according to an embodiment of the present application;
[0051] FIG12 is a schematic diagram of the structure of a distributed object storage system provided in an embodiment of the present application;
[0052] FIG13 is a schematic diagram of data reconstruction in a distributed object storage system provided in an embodiment of the present application;
[0053] FIG14 is a flow chart of a data reconstruction method provided in an embodiment of the present application;
[0054] FIG15 is a schematic structural diagram of a data storage device provided in an embodiment of the present application;
[0055] FIG16 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0057] In the description of the embodiments of this application, the terms "for example" or "for example" are used to indicate an example, illustration, or explanation. Any embodiment or design described as "for example" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" or "for example" is intended to present the relevant concepts in a concrete manner.
[0058] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the term "plurality" means two or more. For example, "multiple systems" refers to two or more systems, and "multiple screen terminals" refers to two or more screen terminals.
[0059] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly identifying the technical features being referred to. Thus, features specified as "first" or "second" may explicitly or implicitly include one or more of such features. The terms "include," "comprising," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized.
[0060] In the computer field, a storage system may include one or more computing devices. The one or more computing devices may include cache devices and slow storage devices. The embodiments of the present application do not impose any specific restrictions on the number of cache devices and slow storage devices in the computing device.
[0061] The one or more computing devices may include the server 100 shown in Figure 1 and / or the server 200 shown in Figure 2. The servers shown in Figures 1 and 2 both adopt the hybrid storage solution of the aforementioned cache device and slow storage device.
[0062] As shown in Figure 1, the server 100 may include a CPU 101, memory 102, a cache device 103, and a slow storage device 104. In a specific application, the CPU 101 may first write data to the cache device 103, and then write one or more data items in the cache device 103 to the slow storage device 104 according to the flushing policy of the slow storage device 104. Alternatively, the CPU 101 may pre-read a portion of data from the slow storage device 104 and write the data to the cache device 103. Applications in the server 100 can then obtain data from the cache device 103, saving the application time in obtaining data.
[0063] As shown in Figure 2, the server 200 may include a CPU 201, a cache device 202, and a slow storage device 203. The cache device 202 is the memory of the server 200. In a specific implementation, a portion of the storage area in the memory may be used as the cache device 202 of the server 200.
[0064] The cache device 103 in FIG1 may include a solid state disk (SSD). The slow storage device 202 shown in FIG2 may include a static random access memory (SRAM), a dynamic random access memory (DRAM), a cache, etc.
[0065] The slow storage device 104 in FIG. 1 and the slow storage device 203 in FIG. 2 can specifically be a mechanical hard disk drive (HDD) or a magnetic tape storage device. Each storage device can write to data in a manner that includes overwriting and / or appending. For example, an HDD supports overwriting and appending, while a magnetic tape storage device only supports appending. Compared to an HDD, magnetic tape storage devices are less expensive and are suitable for storing data with relatively low frequency of use or for long-term data storage (cold storage). Cold storage, for example, is backup storage.
[0066] The following description will be made by taking the server 100 shown in FIG1 storing log data as an example.
[0067] In one embodiment, as shown in FIG3 , server 100 includes multiple log logical spaces, and the log data in each log logical space has the same semantics. Each log logical space corresponds to one or more data interfaces for reading and writing data to cache device 103 and / or slow storage device 103. A log logical space can include an application deployed on the server.
[0068] As shown in Figure 3 , slow storage device space management involves mapping logical block addresses (LBAs) to physical addresses of slow storage device 104. Cache device space management involves mapping logical block addresses (LBAs) to physical addresses of cache device 103. One LBA maps to both a physical address of slow storage device 104 and a physical address of cache device 103. Thus, there is coupling between the physical addresses of cache device 103 and slow storage device 104.
[0069] In Figure 3, when CPU 101 writes log data from the log logical space to slow storage device 104, it can map the LBAs of each log data slice to the physical addresses of cache device 103 and write each log data slice to cache device 103. When cache device 103 meets the flushing condition, each log data slice is read from cache device 103. Then, each log data slice is written to slow storage device 104 according to the physical addresses in slow storage device 104 mapped to the LBAs of the log data.
[0070] The storage space of the cache device 103 can be divided into multiple data storage areas, each of which is used to store a slice of log data. When writing data to the cache device 103, the CPU 101 can concurrently write each slice of log data in a log logical space into the cache device 103, and each slice of log data is stored in a different data storage area of the cache device 103. The multiple slices of log data in the data storage area of the cache device 103 include continuous data storage areas or discontinuous data storage areas.
[0071] As shown in FIG3 , the CPU 101 may also adopt a write-through method to directly write the log data in the log logical space into the slow storage device 104 .
[0072] In the above description, multiple log data segments are concurrently written to cache device 103 in fragments, and the data storage area of the multiple log data segments in cache device 103 is discontinuous. After the multiple log data segments are written to slow storage device 104 in an append-write manner, the multiple log data segments are also discontinuous in slow storage device 104. For example, as shown in FIG4 , when cache device 103 uses concurrent writes, LBA1 through LBA5 are five log data segments. During disk flushing, due to the coupling of the physical addresses between cache device 103 and slow storage device 104, the addresses of slow storage device 104 can only store the data segments stored at the corresponding addresses in cache device 103. As a result, the data of LBA1 through LBA5 is also discontinuously written to the storage area of slow storage device 104. Since the read and write speed of slow storage device 104 is lower than that of cache device 103, if the multiple data segments are discontinuous in the slow storage device 104, it will affect the read and write speed of server 100, thereby reducing its read and write performance.
[0073] In addition, since the address of the slow storage device 104 can only store data slices stored at the corresponding address in the cache device 103, when the data of an LBA does not meet the disk flushing condition, the data after the LBA cannot be flushed to the slow storage device 104, which will also affect the read and write speed of the server 100. For example, the data stored at the physical address corresponding to LBA1 of the slow storage device 104 can only be written to the physical address corresponding to LBA1 of the cache device 103, and the data stored at the physical address corresponding to LBA2 of the slow storage device 104 can only be written to the physical address corresponding to LBA2 of the cache device 103, and so on. In the case where the slow storage device 104 adopts the append write method, if the data slice stored at LBA2 of the cache device 103 does not meet the disk flushing condition, for example, the storage area of the physical address corresponding to LB2 is not full, the data slice stored at LBA2 of the cache device 103 cannot be written to LBA2 of the slow storage device 104. When the main memory adopts the append-write mode, it will also affect the writing of other data fragments meeting the disk flushing conditions into LBA3 to LBA5 following LBA2 of the slow storage device 104 .
[0074] To this end, an embodiment of the present application provides a data storage method that can solve the above-mentioned technical problems.
[0075] The data storage method provided by the embodiment of the present application concurrently writes the various slices of the first data into multiple discontinuous data storage areas of the cache device 103. When flushing the disk, the first data is read from the cache device 103, and the first data is written to the continuous data storage area of the slow storage device 104 in an append-write manner. Specifically, as shown in Figure 5, the log data of the log logical space is written to the cache device 103 according to the log semantics. When flushing the disk, the various slices of the log data are read from the cache device 103 according to the log semantics, and then the log data is written to the continuous data storage area of the slow storage device 104 according to the log semantics. In Figure 5, cache device space management refers to mapping the log semantics of the log data to the physical address of the cache device, and slow storage device space management refers to mapping the log semantics of the log data to the physical address of the slow storage device.
[0076] This method reads and writes data between cache device 103 and slow storage device 104 based on data semantics, reducing the address coupling between cache device 103 and slow storage device 104. This method can resolve the issue of discontinuous data locations on slow storage device 104 caused by the address coupling between cache device 103 and slow storage device 104. It can also resolve the issue of incomplete data writes to the physical address corresponding to a certain LBA in cache device 103, preventing other data from being flushed to disk.
[0077] 6 , taking the server 100 shown in FIG. 1 as an example, the data storage method provided in the embodiment of the present application will be specifically introduced.
[0078] Figure 6 is a flow chart of a data storage method provided by an embodiment of the present application. As shown in Figure 6, the method may include the following steps S601 to S603.
[0079] In step S601, the CPU 101 concurrently writes a plurality of log data in a fragmented manner to at least two data storage areas of the cache device 103. The plurality of log data includes first data.
[0080] In this embodiment, the storage area of the cache device 103 can be pre-divided into different sub-areas, and different sub-areas are used to store different types of data. As shown in Figure 8, the sub-areas of the cache device 103 include multiple data storage areas, a first metadata storage area, and a second metadata storage area.
[0081] The data storage area is used to store a slice of each log data, and the log data includes data written back from different log logical spaces and / or data pre-read from the slow storage device 104 .
[0082] The first metadata storage area is used to store the first metadata of the log logical space. The first metadata includes the data size (write size) of the log data written to the log logical space, the data size (flush offset) of the log data written from the cache device 103 to the log logical space of the slow storage device 104, and the log identifier and log offset of the data slices where the log data is stored in the cache device 103. The log identifier and log offset of the data slices where the log data is stored in the cache device 103 are used to determine the physical address of each data slice in each data storage area of the cache device 103. In addition, in other embodiments, the first metadata may not include the write size and flush offset.
[0083] The second metadata storage area is used to store second metadata of the log logical space. The second metadata includes the data size (write size) of the log data written to the log logical space, as well as the data size (flush offset), log identifier, and log offset of the log data written from the cache device 103 to the log logical space of the slow storage device 104. The log identifier and log offset of the log data written from the cache device 103 to the slow storage device 104 are used to determine the physical address of the log data written from the cache device 103 to the slow storage device 104 on the slow storage device 104.
[0084] In this step, as shown in FIG8 , the multiple log data may include, for example, log data logA of log logical space A and log data logB of log logical space B. CPU 101 may concurrently write log data logA and log data logB to the cache device 103 in a sharded manner according to the log semantics of log logical space A and the log semantics of log logical space B and the set read and write granularity. The multiple shards of log data logA include logA-1 to logA-3, and the multiple shards of log data logB include logB-1 to logB-3. After each shard is written to the cache device 103, as shown in FIG8 , logA-1 to logA-3 and logB-1 to logB-3 are respectively located in different data storage areas of the cache device 103.
[0085] After writing each segment of the log data logA and the log data logB into the data storage area of the cache device 103 , the CPU 101 may write the first metadata corresponding to each segment of the log data into the first metadata storage area of the cache device 103 .
[0086] As shown in FIG9A , taking the example of 9MB of log data logA written to log logical space A, if logA has not been written to the slow storage device 104, the write size in the first metadata of logA is 9MB, and the flush offset is 0MB. As shown in FIG9A , taking the example of 5MB of log data logB written to the cache device 103, if logB has not been written to the slow storage device 104, the write size in the first metadata of logB is 5MB, and the flush offset is 0MB.
[0087] Among them, CPU101 can determine the log offset of the data slice currently being written corresponding to the cache device 103 according to the storage capacity and read-write granularity used by the cache device 103. For example, when the storage capacity used by the cache device 103 is 1MB, and the read-write granularity of the cache device 103 is 1MB, it can be determined that the log offset of the data slice whose current log logical space is written back corresponding to the cache device 103 is 1MB. For example, as shown in Figure 8, if the cache device 103 only writes data slice logA-1 and the read-write granularity of the cache device 103 is 1MB, if the data slice logB-1 is written to the cache device 103, the log offset of the data slice logB-1 corresponding to the cache device 103 is 1MB. Among them, the data slice logA-1 is the data written to the cache device 103 for the first time, and its log offset corresponding to the cache device 103 is 0MB.
[0088] In step S602, first data is read from the cache device 103. The first data may include all or part of the log data logA or log data logB.
[0089] In this step, taking the first data as partial data of log data logA as an example, the first data may include some of the multiple shards of logA that have been written to cache device 103. For example, if the logA written to cache device 103 is 9 MB, the first data may include the first 8 MB of logA, and the remaining 1 MB of logA in cache device 103 is referred to as the second data.
[0090] CPU 101 can read the first metadata of log data logA from cache device 103 according to the log semantics of log data logA, and then read partial fragments of log data logA from the data storage area according to the first metadata of log data logA to obtain first data. Then, the obtained partial fragments of logA are aggregated into the first data.
[0091] As introduced in S601, the first metadata includes a log identifier and a log offset. CPU 101 can obtain the address of the data storage area of each data shard in the cache device 103 based on the log identifier of each data shard of the first data and the log offset of the data shard in the cache device 103, and read each data shard according to the address of the data storage area. For example, as shown in Figure 8, when CPU 101 flushes logA-1 to logA-3, it can read the first metadata of logA-1 to logA-3 from the first metadata storage area of the cache device 103, and then determine the address of the data storage area of logA-1 to logA-3 in the cache device 103 according to the key in the first metadata of logA-1 to logA-3, and finally read logA-1 to logA-3 from the cache device 103 according to the obtained address. The read logA-1 to logA-3 are written to the memory 102 and aggregated in the memory 102 to obtain the first data.
[0092] In step S603 , the first data is written into the continuous data storage area of the slow storage device 104 in an append-write manner.
[0093] In this embodiment, the storage area of the slow storage device 104 can be pre-divided into multiple sub-areas. The multiple sub-areas are used to store different types of data. As shown in Figure 8, the sub-areas of the slow storage device 104 include multiple data storage areas and metadata storage areas.
[0094] The data storage area is used to store log data written from the cache device 103 .
[0095] The metadata storage area is used to store second metadata of the log logical space. The second metadata includes the data size (write size) of the log data written to the log logical space, the data size (flush offset) of the log data written from the cache device 103 to the log logical space of the slow storage device 104, the log identifier, and the log offset.
[0096] In this step, after reading the fragments of the first data from the cache device 103 and aggregating the first data, the CPU 101 appends the first data to the continuous data storage area of the slow storage device 104. The continuous data storage area includes multiple continuous data storage areas in the slow storage device 104.
[0097] After writing the first data into the slow storage device 104 , the CPU 101 may write the second metadata of logA into the metadata storage area of the slow storage device 104 .
[0098] In the case where the log data logA written into the log logical space A is 9MB, as shown in FIG9B , taking the first data logA of 8MB as an example, the write size in the second metadata of logA is 9MB, and the flush offset is 8MB.
[0099] The CPU 101 may determine the log offset of the first data on the slow storage device 104 based on the used storage capacity of the slow storage device 104. For example, as shown in FIG8 , when flushing log data logA, if the currently used storage capacity of the slow storage device 104 is 0MB, the log offset of the log data logA corresponding to the slow storage device 104 may be determined to be 0MB. For another example,
[0100] After writing the first data to the slow storage device 104, CPU 101 may also write the second metadata of logA to the second metadata storage area of the cache device 103 and update the first metadata of logA based on the second metadata of logA. As shown in FIG9 , when the first data is 8MB of logA written to the cache device 103, CPU 101 updates the first metadata of logA by updating the flush offset in the second metadata of logA to 8MB. Furthermore, updating the first metadata of logA also includes deleting the log identifier and log offset of the data slice of logA already written to the slow storage device 104 (i.e., the data slice corresponding to the first data).
[0101] After step S603, the data storage method includes: CPU 101 reading third data from cache device 103, and writing the third data into the second continuous data storage area of slow storage device 104 in an append-write manner. The third data may include part or all of the data in log logical space B.
[0102] Taking the third data as partial data of log data logB as an example, the third data may include some of the multiple shards of logB that have been written to cache device 103. For example, if the amount of logB written to cache device 103 is 5MB, the third data may include the first 4MB of logB. The remaining 1MB of logB in cache device 103 is referred to as the fourth data.
[0103] Similarly, CPU 101 can read the first metadata of log data logB from cache device 103 according to the log semantics of log data logB, and then read partial fragments of log data logB from the data storage area according to the first metadata of log data logB to obtain third data. Then, the obtained partial fragments of logB are aggregated into the third data.
[0104] Similarly, CPU 101 writes the third data into a second continuous data storage area of the slow storage device. The second continuous data storage area includes multiple continuous data storage areas in the slow storage device. When the first and third data are flushed to disk continuously, as shown in FIG8 , the second continuous data storage area (at the location marked by logB) is continuous with the first continuous data storage area (at the location marked by logA).
[0105] After writing the third data into the second continuous data storage area of the slow storage device, the CPU 101 stores the second metadata associated with the third data in the metadata storage area of the slow storage device 104. The second metadata associated with the third data is the second metadata of logB.
[0106] For example, if the third data is logB, which is 4MB, the write size in the second metadata of logB is 5MB, and the flush offset is 4MB. As shown in FIG8 , after flushing logA, when flushing logB, logA is flushed, since logA is 8MB, the currently used storage capacity of slow storage device 104 is 8MB. Therefore, it can be determined that the current log offset of slow storage device 104 corresponding to logB is 8MB.
[0107] After or before the second metadata associated with the third data is written into the slow storage device, the second metadata associated with the third data may be written into the second metadata storage area of the cache device 103 .
[0108] Furthermore, after flushing the third data, CPU 101 may update the first metadata associated with the third data in the first metadata storage area of cache device 103. The first metadata associated with the third data is the first metadata of logB. Specifically, as shown in FIG9A , updating the first metadata of logB includes updating the flush offset in the first metadata of logB from 0MB to 4MB. Updating the first metadata of logB also includes deleting the log identifier and log offset of the data shard of logB (i.e., the data shard corresponding to the third data) that has already been written to the slow storage device 104.
[0109] If the server 101 includes multiple slow storage devices, the CPU 101 may also write the third data into another slow storage device 104. For example, as shown in FIG10 , when the server 100 includes two slow storage devices 104, the third data may be written into the second slow storage device while the first data is written into the first slow storage device.
[0110] In the method embodiment shown in FIG6 , server 100 reads first data written concurrently in fragmented form from a cache device, and then writes the first data to a continuous data storage area of a slow storage device using an append-write method. This method can address the problem of poor storage performance of server 100 caused by discontinuous data locations on a slow storage device that supports append-write.
[0111] In this method, data is read from the cache and slow storage devices according to their semantics. This solves the problem shown in Figure 4 where the data cannot be flushed to disk due to the strong address coupling between the cache and slow storage devices. Furthermore, by reducing the address coupling between the cache and slow storage devices, the CPU's computational overhead during data storage can be reduced, saving CPU resources.
[0112] In the above method, the second metadata is stored in the slow storage device 104. When the cache device 103 fails and needs to be replaced, the CPU 101 can reconstruct the lost data stored in each log logical space in the cache device 103 based on the flush offset of the second metadata stored in the slow storage device 104. The data reconstruction process performed by the CPU 101 after the cache device 103 is replaced will be described in detail later in conjunction with the embodiment shown in FIG. 12 and will not be further described here.
[0113] In addition, when the server 100 includes multiple slow storage devices 104 , storing the second metadata in the slow storage device 104 can save storage space of the cache device 103 .
[0114] In one embodiment, when server 100 includes multiple slow storage devices 104, if cache device 103 stores metadata from slow storage device 104 for a long period of time, this will also occupy storage space in cache device 103. Therefore, a metadata elimination mechanism can be configured in server 100. After backing up the second metadata in the second metadata storage area to slow storage device 104, CPU 101 can delete the second metadata in the second metadata storage area of cache device 103 according to the metadata elimination mechanism, thereby saving storage space in cache device 103. For example, after backing up the first data and the second metadata of the third data stored in the second metadata storage area of cache device 103 to the slow storage device 104, the two pieces of second metadata are deleted, allowing the second metadata storage area of cache device 103 to be used for storing the second metadata of the fourth data. In addition, as shown in Figure 11, after determining that the first slow storage device and / or the second slow storage device are full, the second metadata corresponding to the first slow storage device and / or the second slow storage device stored in the second metadata storage area of the cache device 103 can also be deleted, so that the second metadata storage area of the cache device 103 can be used to store the second metadata of the third slow storage device.
[0115] In other embodiments, the second metadata storage area may not be set in the cache device 103. After flushing the written-back data of each log logical space in the cache device 103 to disk, the CPU 101 may directly write the second metadata of the flushed data of each log logical space to the metadata storage area of the slow storage device 104.
[0116] The present application also provides a distributed storage system, which may include a distributed object storage system.
[0117] FIG12 is a schematic diagram of the structure of a distributed object storage system provided in an embodiment of the present application.
[0118] As shown in FIG12 , the distributed storage system may include multiple object storage devices (OSDs), such as OSDs 1201 to 1203. One or more of the OSDs may be server 100 as shown in FIG1 , and data may be written to the cache device and slow storage device using the data storage method shown in FIG6 .
[0119] In this embodiment, each OSD can store the same data. For example, OSDs 1 through 3 can each store 9MB of log data from Log Log Space A and 5MB of log data from Log Log Space B. It will be appreciated that in other embodiments, any two OSDs can store the same data to back up the stored data.
[0120] In the distributed object storage system shown in FIG12 , when cache device 103 in OSD 1201 fails, cache device 103 in OSD 1201 can be replaced. After cache device 103 in OSD 1201 is replaced, incremental data is reconstructed based on the second metadata stored in slow storage device 102. Incremental data refers to data that was not written to slow storage device 104 before the failure of cache device 103 in OSD 1201.
[0121] The incremental data may specifically include log data that was written to cache device 103 before OSD 1201's cache device 103 failed, and the log data was not written to slow storage device 104. Meanwhile, OSD 1202 and OSD 1203, which have not failed, store incremental data, and the incremental data was written to cache devices 103 of OSD 1202 and OSD 1203 before OSD 1201's cache device 103 failed.
[0122] For example, as shown in Figure 13 , cache device 103 in OSD 1101 stores the remaining 1MB (8MB to 9MB) of log data logA, the remaining 1MB (4MB to 5MB) of log data logB, and the second metadata (logA info2) of log logical space A and the second metadata (logB info2) of log logical space B. When cache device 103 in OSD 1101 is replaced, the remaining 1MB of logA and the remaining 1MB of logB stored in the previously failed cache device 103 are lost.
[0123] The incremental data may also include data written by OSD 1202 and OSD 1203 into their respective cache devices 103 after the cache device 103 of OSD 1201 fails. Since the cache device 103 of OSD 1201 fails, the incremental data is not written into OSD 1201.
[0124] For example, before OSD 1201's cache device 103 fails, OSD 1201 has written the first 8 MB of log data logA to cache device 103 and flushed it to slow storage device 104. After OSD 1201's cache device 103 fails, OSD 1202 and OSD 1203 write 8 MB to 9 MB of log data logA to their respective cache devices 103. Before OSD 1201's cache device 103 fails, OSD 1201 has written the first 4 MB of log data logB to cache device 103 and flushed it to slow storage device 104. After OSD 1201's cache device 103 fails, OSD 1202 and OSD 1203 write 4 MB to 5 MB of log data logB to their respective cache devices 103. The incremental data includes 8 MB to 9 MB of log data logA and 4 MB to 5 MB of log data logB written by OSD 1202 and OSD 1203 .
[0125] The reconstruction process is described in detail below with reference to FIG14 .
[0126] Based on the distributed storage system shown in Figure 12, an embodiment of the present application provides a data reconstruction method for incrementally reconstructing the aforementioned incremental data after a failure of the cache device 103 occurs.
[0127] FIG14 is a flow chart of a data reconstruction method provided in an embodiment of the present application. The method is applied to the OSD 1201 of the aforementioned distributed system. As shown in FIG14 , the method includes the following steps S1401-S1402.
[0128] In S1401 , when the CPU 101 determines that the cache device 103 has failed, it reads second metadata associated with first data stored in the metadata storage area of the slow storage device 104 .
[0129] At S1402, CPU 101 determines incremental data based on the second metadata and second data stored in the backup cache device. The second data includes the first data and incremental data. The incremental data includes data stored in cache device 103 before the failure and not yet written to slow storage device 104. The backup storage device may include cache device 103 in OSD2 or OSD3 in the distributed system.
[0130] In this step, the incremental data includes the remaining 1MB of log data logA in cache device 103. Based on the write size value (9MB) and flush offset value (8MB) of logA in the second metadata, CPU 101 can determine that the incremental data is the remaining 1MB of log data logA (i.e., the 8th to 9th MB). Then, the incremental data is read from the backup cache device and concurrently written to the updated cache device 103 in a fragmented manner. Furthermore, CPU 101 can also write the incremental data to the slow storage device 104 in an append-only manner.
[0131] Based on the method embodiment shown in FIG6 , the present application also provides a data storage device. The data storage device can be applied to the server 100 shown in FIG1 to perform the various steps in the method embodiment shown in FIG6 .
[0132] FIG15 is a schematic diagram of the structure of a data storage device 1500 provided in an embodiment of the present application. As shown in FIG15 , the data storage device 1500 includes: a reading module 1501 and a storage module 1502 .
[0133] The reading module 1501 is used to obtain first data from a first cache device, wherein the first cache device supports concurrent writing, and the first data is concurrently written into at least two data storage areas of the first cache device in a fragmented manner.
[0134] The storage module 1502 is configured to write the first data into a first continuous data storage area of a first slow storage device in an append-write manner, wherein the first slow storage device supports append-write.
[0135] It should be noted that the data storage device 1500 provided in the embodiment shown in FIG15 is merely an example of the division of the aforementioned functional modules when executing the data storage method. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the computing device provided in the above embodiment and the data storage method embodiment shown in FIG6 are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0136] FIG16 is a schematic diagram of the hardware structure of a computing device 1600 provided in an embodiment of the present application. The computing device 1600 may be the aforementioned server 100 or server 200. The computing device 1600 may be used in the storage system shown in FIG13 .
[0137] 16 , the computing device 1600 includes a processor 1601, a memory 1602, a communication interface 1603, and a bus 1604. The processor 1601, the memory 1602, and the communication interface 1603 are connected to each other via the bus 1604. The processor 1601, the memory 1602, and the communication interface 1603 may also be connected using other connection methods besides the bus 1604.
[0138] Among them, the memory 1602 can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), flash memory, optical storage, hard disk, etc.
[0139] Processor 1601 may be a general-purpose processor, which may be a processor that performs specific steps and / or operations by reading and executing content stored in a memory (e.g., memory 1602). For example, the general-purpose processor may be a central processing unit (CPU). Processor 1601 may include at least one circuit to execute all or part of the steps of the data storage method provided in the embodiment shown in FIG6 .
[0140] Communication interface 1603 includes input / output (I / O) interfaces, physical interfaces, and logical interfaces, which are used to interconnect components within computing device 1600, as well as interfaces for interconnecting computing device 1600 with other devices (e.g., other computing devices or user equipment). Physical interfaces can include Ethernet interfaces, fiber optic interfaces, ATM interfaces, and the like.
[0141] The bus 1604 may be any type of communication bus for interconnecting the processor 1601 , the memory 1602 , and the communication interface 1603 , such as a system bus.
[0142] The above-mentioned devices can be provided on separate chips, or at least partially or entirely on the same chip. Whether to provide each device independently on different chips or to integrate them on one or more chips often depends on the product design requirements. The embodiments of this application do not limit the specific implementation of the above-mentioned devices.
[0143] The computing device 1600 shown in FIG15 is merely exemplary. During implementation, the computing device 1600 may further include other components, which are not listed here one by one.
[0144] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0145] It is understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not intended to limit the scope of the embodiments of the present application. It should be understood that in the embodiments of the present application, the order of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0146] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of this application in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of this application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of this application should be included in the scope of protection of this application.
Claims
1. A data storage method, characterized in that: The method comprises: Acquire first data from a first cache device, wherein the first cache device supports concurrent writing, and the first data is concurrently written into at least two data storage areas of the first cache device in a sharding manner; The first data is written into a first continuous data storage area of a first slow storage device in an append-write manner, wherein the first slow storage device supports append-write.
2. The method according to claim 1, characterized in that The first data is concurrently written into at least two data storage areas of the first cache device in a sharding manner, including: storing first metadata associated with the first data in the first cache device in a first metadata storage area of the first cache device, wherein the first metadata is used to record addresses of multiple fragments of the first data in the at least two data storage areas; The obtaining the first data from the first cache device includes: reading the first metadata from the first cache device; Read the plurality of shards respectively from the at least two data storage areas recorded in the first metadata; The multiple shards are aggregated into the first data.
3. The method according to claim 2, characterized in that Writing the first data into a first continuous data storage area of a first slow storage device in an append-write manner comprises: Second metadata for recording the address of the first data in the first continuous data storage area and the size of the first data is stored in the metadata storage area of the first slow storage device.
4. The method according to claim 3, characterized in that The method further comprises: In the event that the first cache device fails, reading the second metadata stored in the metadata storage area of the first slow storage device; Determining incremental data according to the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, and the incremental data is data written to the backup cache device after the first cache device fails; The incremental data is written into the first continuous data storage area of the first slow storage device in an append-write manner.
5. The method according to claim 3, characterized in that: The method further comprises: In the event that the first cache device fails, reading the second metadata stored in the metadata storage area of the first slow storage device; Determining incremental data according to the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, the incremental data is data written to the backup cache device and the first cache device before the first cache device fails, and the data written to the backup cache device and the first slow storage device before the first cache device fails; The incremental data is written into the first continuous data storage area of the first slow storage device in an append-write manner.
6. The method according to claim 3 or 4, characterized in that: The method further comprises: The second metadata is stored in a second metadata storage area of the first cache device.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Acquire third data from the first cache device, wherein the third data is concurrently written in a sharded manner into at least two data storage areas of the first cache device; The third data is written into a second continuous data storage area of a second slow storage device in an append-write manner, wherein the third data is Second, slow storage devices support additional writes.
8. The method according to any one of claims 1 to 7, characterized in that: The first cache device includes a memory or a solid state drive SSD, and the first slow storage device includes a tape storage or a mechanical hard disk HDD.
9. A data storage device, characterized in that: The device comprises: A reading module, configured to obtain first data from a first cache device, wherein the first cache device supports concurrent writing, and the first data is concurrently written into at least two data storage areas of the first cache device in a sharding manner; The storage module is used to write the first data into a first continuous data storage area of a first slow storage device in an append-write manner, wherein the first slow storage device supports append-write.
10. The device according to claim 9, characterized in that The reading module is specifically used for: storing first metadata associated with the first data in the first cache device in a first metadata storage area of the first cache device, wherein the first metadata is used to record addresses of multiple fragments of the first data in the at least two data storage areas; The reading module is also specifically used for: reading the first metadata from the first cache device; Read the plurality of shards respectively from the at least two data storage areas recorded in the first metadata; The multiple shards are aggregated into the first data.
11. The device according to claim 10, characterized in that The storage module is specifically used for: Second metadata for recording the address of the first data in the first continuous data storage area and the size of the first data is stored in the metadata storage area of the first slow storage device.
12. The device according to claim 11, characterized in that The reading module is also used for: In the event that the first cache device fails, reading the second metadata stored in the metadata storage area of the first slow storage device; Determining incremental data according to the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, and the incremental data is data written to the backup cache device after the first cache device fails; The incremental data is written into the first continuous data storage area of the first slow storage device in an append-write manner.
13. The device according to claim 11, characterized in that The reading module is also used for: In the event that the first cache device fails, reading the second metadata stored in the metadata storage area of the first slow storage device; Determining incremental data according to the second metadata and second data stored in the backup cache device, wherein the second data includes the first data and the incremental data, the incremental data is data written to the backup cache device and the first cache device before the first cache device fails, and the data written to the backup cache device and the first slow storage device before the first cache device fails; The incremental data is written into the first continuous data storage area of the first slow storage device in an append-write manner.
14. The device according to claim 11 or 12, characterized in that The storage module is also used for: The second metadata is stored in a second metadata storage area of the first cache device.
15. The device according to any one of claims 9 to 14, characterized in that The reading module is also used for: Acquire third data from the first cache device, wherein the third data is concurrently written in a sharded manner into at least two data storage areas of the first cache device; The third data is written into a second continuous data storage area of a second slow storage device in an append-write manner, wherein the second slow storage device supports append-write.
16. The device according to any one of claims 9 to 15, characterized in that: The first cache device includes a memory or a solid state drive SSD, and the first slow storage device includes a tape storage or a mechanical hard disk HDD.
17. A computing device, characterized in that The computing device comprises a processor, a first cache device and a first slow storage device, wherein the processor is configured to execute computer instructions stored in the first cache device or the first slow storage device to implement the method according to any one of claims 1 to 8.
18. A storage system, characterized in that: The storage system includes a plurality of computing devices as claimed in claim 17.
19. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 8.
20. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Flash memory data distribution method oriented to read-write data streams
CN107203330A
Data writing method and device, and equipment
CN112114753A
Large segment management
US11249646B1
Storage method applied to solid state disk and storage controller
WO2022226999A1
