Data processing method and device
By distinguishing the storage space according to temperature in the storage medium and only performing garbage collection on the required temperature data, the problem of large amounts of data involved in garbage collection in the existing technology is solved, and the performance of the storage medium is improved.
Patent Information
- Application Number
- CN201910493541.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-06
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2039-06-06
AI Technical Summary
The existing technology does not differentiate between data with different temperatures when storing them in the memory, causing all data to be collected simultaneously during garbage collection, increasing the write amplification factor and reducing the performance of the memory.
Store data with different temperatures in different storage spaces in the storage medium, and only perform garbage collection on data with corresponding temperatures when needed to avoid garbage collection on data in other storage spaces at the same time.
It reduces the amount of data involved in the garbage collection process, reduces the write amplification factor, and improves the performance of storage media.
Smart Images

Figure CN112051964B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method and device. Background Art
[0002] Currently, more and more users use memory to store data. When the data stored in the memory is large, in order to improve the storage space utilization of the memory, it is often necessary to process the high-temperature data stored in the memory to obtain medium-temperature data, and store the medium-temperature data in the memory, and then process the medium-temperature data to obtain low-temperature data, and store the low-temperature data in the memory, etc. Afterwards, the data stored in the memory will be garbage collected.
[0003] However, the inventors have discovered that performing garbage collection on data stored in a memory will increase the write amplification factor of the memory, thereby reducing the performance of the memory. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present application show a data processing method and device.
[0005] In a first aspect, an embodiment of the present application shows a data processing method, the method comprising:
[0006] receiving a write request for first data;
[0007] Writing the first data into a first data stream and storing it in a first storage space of a storage medium;
[0008] performing garbage collection on the first data to convert the first data into second data;
[0009] Writing the second data into a second data stream and storing it in a second storage space of the storage medium;
[0010] The first data and the second data have different data temperatures.
[0011] In an optional implementation, the method further includes:
[0012] performing garbage collection on the second data to convert the second data into third data;
[0013] The third data is written into a third data stream.
[0014] In an optional implementation, the method further includes:
[0015] The third data stream is stored in a third storage space of the storage medium.
[0016] In an optional implementation, the temperature of the second data is lower than the temperature of the first data, and the temperature of the third data is lower than the temperature of the second data.
[0017] In an optional implementation, performing garbage collection on the first data to convert the first data into second data includes:
[0018] Reading the first data from the first data stream, and converting the first data into erasure coded data;
[0019] The second data is generated according to the erasure coded data.
[0020] In an optional implementation, performing garbage collection on the second data to convert the second data into third data includes:
[0021] The second data is read from the second data stream, and the second data is aggregated into third data.
[0022] In an optional implementation, writing the second data into a second data stream and storing it in a second storage space of the storage medium includes:
[0023] determining a temperature of the second data;
[0024] determining a second storage space for storing the temperature data among a plurality of storage spaces included in the storage medium;
[0025] The second data is written into a second data stream and stored in the second storage space.
[0026] In an optional implementation, determining the temperature of the second data includes:
[0027] Obtaining the number of garbage collection processing times included in the process of obtaining the second data according to original data of the second data;
[0028] The temperature of the second data is determined according to the number of processing times.
[0029] In an optional implementation, determining a second storage space for storing the temperature data among the plurality of storage spaces included in the storage medium comprises:
[0030] Determine a correspondence table between temperature and storage address of storage space;
[0031] Searching in the correspondence table whether there is a storage address corresponding to the temperature;
[0032] If a storage address corresponding to the temperature exists in the correspondence table, the second storage space is determined according to the storage address.
[0033] In an optional implementation, the method further includes:
[0034] If the storage address corresponding to the temperature does not exist in the correspondence table, the second storage space is created in the storage medium.
[0035] In an optional implementation, the method further includes:
[0036] Obtaining the storage address of the created second storage space;
[0037] The temperature and the storage address of the created second storage space form a corresponding table entry, and the corresponding entry is stored in the corresponding relationship table.
[0038] In a second aspect, an embodiment of the present application shows a data processing device, including:
[0039] A receiving module, configured to receive a write request for first data;
[0040] A first writing module, used for writing the first data into a first data stream, and a first storing module, used for storing the first data stream into a first storage space of a storage medium;
[0041] A first recycling module, configured to perform garbage collection on the first data and convert the first data into second data;
[0042] A second writing module, used for writing the second data into a second data stream, and a second storing module, used for storing the second data stream into a second storage space of the storage medium;
[0043] The first data and the second data have different data temperatures.
[0044] In an optional implementation, the device further includes:
[0045] A second recycling module, used for performing garbage collection on the second data, and converting the second data into third data;
[0046] The third writing module is used to write the third data into a third data stream.
[0047] In an optional implementation, the device further includes:
[0048] The storage module is used to store the third data stream into the third storage space of the storage medium.
[0049] In an optional implementation, the temperature of the second data is lower than the temperature of the first data, and the temperature of the third data is lower than the temperature of the second data.
[0050] In an optional implementation, the first recovery module includes:
[0051] a conversion unit, configured to read the first data from the first data stream and convert the first data into erasure code data;
[0052] A generating unit is used to generate the second data according to the erasure code data.
[0053] In an optional implementation, the second recovery module includes:
[0054] An aggregation unit reads the second data from the second data stream and aggregates the second data into third data.
[0055] In an optional implementation, the first storage module includes:
[0056] a first determining unit, configured to determine a temperature of the second data;
[0057] a second determining unit, configured to determine, among a plurality of storage spaces included in the storage medium, a second storage space for storing the temperature data;
[0058] The storage unit is used to write the second data into a second data stream and store it in the second storage space.
[0059] In an optional implementation, the first determining unit includes:
[0060] A first acquisition subunit is used to acquire the number of garbage collection processing times included in the process of acquiring the second data according to the original data of the second data;
[0061] The first determining subunit is used to determine the temperature of the second data according to the number of processing times.
[0062] In an optional implementation, the second determining unit includes:
[0063] A second determining subunit, used to determine a correspondence table between temperatures and storage addresses of storage spaces;
[0064] A search subunit, used for searching whether there is a storage address corresponding to the temperature in the correspondence table;
[0065] The third determining subunit is configured to determine the second storage space according to the storage address corresponding to the temperature if there is a storage address in the correspondence table.
[0066] In an optional implementation, the second determining unit further includes:
[0067] A creating subunit is used to create the second storage space in the storage medium if the storage address corresponding to the temperature does not exist in the correspondence table.
[0068] In an optional implementation, the second determining unit further includes:
[0069] A second acquisition subunit, used to acquire the storage address of the created second storage space;
[0070] The storage subunit is used to form a corresponding table entry with the temperature and the storage address of the created second storage space, and store the corresponding entry in the corresponding relationship table.
[0071] In a third aspect, an embodiment of the present application shows an electronic device, including:
[0072] Processor; and
[0073] A memory having executable codes stored thereon, which, when executed, cause the processor to execute:
[0074] receiving a write request for first data;
[0075] Writing the first data into a first data stream and storing it in a first storage space of a storage medium;
[0076] performing garbage collection on the first data to convert the first data into second data;
[0077] Writing the second data into a second data stream and storing it in a second storage space of the storage medium;
[0078] The first data and the second data have different data temperatures.
[0079] In an optional implementation, the processor further executes:
[0080] performing garbage collection on the second data to convert the second data into third data;
[0081] The third data is written into a third data stream.
[0082] In an optional implementation, the processor further executes:
[0083] The third data stream is stored in a third storage space of the storage medium.
[0084] In an optional implementation, the processor further executes:
[0085] Reading the first data from the first data stream, and converting the first data into erasure coded data;
[0086] The second data is generated according to the erasure coded data.
[0087] In an optional implementation, the processor further executes:
[0088] Reading the second data from the second data stream, and converting the second data into erasure coded data;
[0089] The second data is generated according to the erasure coded data.
[0090] In an optional implementation, the processor further executes:
[0091] determining a temperature of the second data;
[0092] determining a second storage space for storing the temperature data among a plurality of storage spaces included in the storage medium;
[0093] The second data is written into a second data stream and stored in the second storage space.
[0094] In an optional implementation, the processor further executes:
[0095] Obtaining the number of garbage collection processing times included in the process of obtaining the second data according to original data of the second data;
[0096] The temperature of the second data is determined according to the number of processing times.
[0097] In an optional implementation, the processor further executes:
[0098] Determine a correspondence table between temperature and storage address of storage space;
[0099] Searching in the correspondence table whether there is a storage address corresponding to the temperature;
[0100] If a storage address corresponding to the temperature exists in the correspondence table, the second storage space is determined according to the storage address.
[0101] In an optional implementation, the processor further executes:
[0102] If the storage address corresponding to the temperature does not exist in the correspondence table, the second storage space is created in the storage medium.
[0103] In an optional implementation, the processor further executes:
[0104] Obtaining the storage address of the created second storage space;
[0105] The temperature and the storage address of the created second storage space form a corresponding table entry, and the corresponding entry is stored in the corresponding relationship table.
[0106] In a fourth aspect, an embodiment of the present application illustrates one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes the data processing method as described in the first aspect.
[0107] Compared with the prior art, the embodiments of the present application have the following advantages:
[0108] In the prior art, when storing data of different temperatures in a storage medium, the data of different temperatures are not distinguished. Thus, when garbage collection is performed on the data in the storage medium, all the data stored in the storage medium is often garbage collected at the same time. It can be seen that the data involved in the garbage collection process is all the data stored in the storage medium, that is, the amount of data involved in the garbage collection process is large, which will increase the write amplification factor of the storage medium, thereby reducing the performance of the storage medium.
[0109] Among them, some data stored in the storage medium has a higher temperature, which will generate more garbage data. Usually, garbage collection is required for the data with higher temperature. However, some data has a lower temperature, which will only generate less garbage data or even no garbage data. When garbage collection is performed on the data with higher temperature, it is often not necessary to perform garbage collection on the data with lower temperature.
[0110] Therefore, in the present application, data at different temperatures can be stored in different storage spaces in the storage medium. Among the multiple storage spaces included in the storage medium, when garbage collection is required for the data in a certain storage space, garbage collection can be performed on the data in that storage space, and garbage collection does not need to be performed on the data in all other storage spaces at the same time.
[0111] That is, the data stored in the storage medium are classified into different storage spaces according to different temperatures. When garbage collection is required for the data in a certain storage space, garbage collection is performed on the data in that storage space. In other words, when garbage collection is required for data at a certain temperature, garbage collection is performed on the data at that temperature.
[0112] Therefore, compared with the prior art, the data involved in the garbage collection process in the present application is part of the data stored in the storage medium. That is, compared with the prior art, the amount of data involved in the garbage collection process of the present application is smaller. Therefore, compared with the prior art, the present application can reduce the write amplification factor of the storage medium, thereby improving the performance of the storage medium. BRIEF DESCRIPTION OF THE DRAWINGS
[0113] Figure 1 The invention is a flow chart of a data processing method according to an exemplary embodiment.
[0114] Figure 2 The invention is a flow chart of a data processing method according to an exemplary embodiment.
[0115] Figure 3 It is a block diagram of a data processing device according to an exemplary embodiment.
[0116] Figure 4 It is a block diagram of a data processing device according to an exemplary embodiment. DETAILED DESCRIPTION
[0117] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0118] Figure 1 is a flow chart of a data processing method according to an exemplary embodiment. Figure 1 As shown, the method is applied to an electronic device, the electronic device includes a storage medium, such as an SSD (Solid State Disk) or an SSHD (Solid State Hybrid Drive), etc. The method includes the following steps.
[0119] In step S101, a write request for first data is received;
[0120] In the present application, when it is necessary to store first data in a storage medium of an electronic device, a write request for the first data can be input in the electronic device, and then the electronic device receives the input write request for the first data, and then executes step S102; or, a write request for the first data can be sent to the electronic device through other devices, and then the electronic device receives the write request for the first data sent by other devices, and then executes step S102.
[0121] In step S102, the first data is written into a first data stream and stored in a first storage space of a storage medium;
[0122] In the present application, multiple different storage spaces can be created in the storage medium in advance, and different storage spaces are used to store data at different temperatures. When it is necessary to store certain data in the storage medium, the temperature of the data can be determined first, and then the data can be written into a data stream, and the data stream can be stored in the storage space used to store data at the temperature, so as to store the data in the storage space used to store data at the temperature. In this way, the temperatures of the data stored in different storage spaces in the storage medium are different.
[0123] Among them, the first data is the original data, therefore, a higher preset value can be set as the temperature of the first data, such as a value greater than 1, and then a first storage space for storing the data of the temperature is determined among the multiple storage spaces included in the storage medium; the first data is then written into the first data stream and stored in the first storage space.
[0124] In this application, the temperature of data includes the frequency with which the data is accessed, etc.
[0125] In step S103, garbage collection is performed on the first data to convert the first data into second data;
[0126] In the present application, for any storage space in a storage medium, when a certain data in the storage space is accessed, garbage data corresponding to the data will be generated in the storage space. The more times the data is accessed, the more garbage data will be generated in the storage space. When the ratio between the space occupied by the garbage data in the storage space and the space size of the storage space is greater than a preset threshold, it can be determined that the data stored in the storage space meets the preset conditions, and the data in the storage space can be garbage collected to delete the garbage data in the storage space from the storage medium. Thereby improving the utilization rate of the storage space. The same is true for each other storage space in the storage medium.
[0127] That is, in the present application, in order to improve the utilization rate of the first storage space, when the data stored in the first storage space meets the preset conditions, garbage collection can be performed on the first data to convert the first data into second data, or garbage collection can be performed on the first data regularly to convert the first data into second data, etc. In one example, the first data can be read from the first data stream, the first data can be converted into erasure coded data, and then the second data can be generated according to the erasure coded data.
[0128] In step S104, the second data is written into a second data stream and stored in a second storage space of a storage medium;
[0129] The first data and the second data have different data temperatures.
[0130] In the present application, whenever erasure coded data is obtained by garbage collection of a data, the temperature of the obtained erasure coded data is often lower than the temperature of the data. Therefore, the temperature of the second data may be lower than the temperature of the first data.
[0131] When it is necessary to store the second data in the storage medium, the temperature of the second data can be determined first, and then the second data can be written into a data stream, and the second data stream can be stored in a storage space for storing data of the temperature, so as to store the second data in the storage space for storing data of the temperature, so that the temperatures of the data stored in different storage spaces in the storage medium are different from each other. The specific storage process can be referred to in the following embodiments, which will not be described in detail here.
[0132] In the prior art, when storing data of different temperatures in a storage medium, the data of different temperatures are not distinguished. Thus, when garbage collection is performed on the data in the storage medium, all the data stored in the storage medium is often garbage collected at the same time. It can be seen that the data involved in the garbage collection process is all the data stored in the storage medium, that is, the amount of data involved in the garbage collection process is large, which will increase the write amplification factor of the storage medium, thereby reducing the performance of the storage medium.
[0133] Among them, some data stored in the storage medium has a higher temperature, which will generate more garbage data. Usually, garbage collection is required for the data with higher temperature. However, some data has a lower temperature, which will only generate less garbage data or even no garbage data. When garbage collection is performed on the data with higher temperature, it is often not necessary to perform garbage collection on the data with lower temperature.
[0134] Therefore, in the present application, data at different temperatures can be stored in different storage spaces in the storage medium. Among the multiple storage spaces included in the storage medium, when garbage collection is required for the data in a certain storage space, garbage collection can be performed on the data in that storage space, and garbage collection does not need to be performed on the data in all other storage spaces at the same time.
[0135] That is, the data stored in the storage medium are classified into different storage spaces according to different temperatures. When garbage collection is required for the data in a certain storage space, garbage collection is performed on the data in that storage space. In other words, when garbage collection is required for data at a certain temperature, garbage collection is performed on the data at that temperature.
[0136] Therefore, compared with the prior art, the data involved in the garbage collection process in the present application is part of the data stored in the storage medium. That is, compared with the prior art, the amount of data involved in the garbage collection process of the present application is smaller. Therefore, compared with the prior art, the present application can reduce the write amplification factor of the storage medium, thereby improving the performance of the storage medium.
[0137] Furthermore, the second data in the second storage space may be accessed later, and each time the second data is accessed, garbage data corresponding to the second data will be generated in the second storage space. The more times the second data is accessed, the more garbage data is often generated in the second storage space. When the ratio between the space occupied by the garbage data in the second storage space and the space size of the second storage space is greater than a preset threshold, it can be determined that the data stored in the second storage space meets the preset condition, and garbage collection can be performed on the second data, converting the second data into third data, and then writing the third data into a third data stream; or garbage collection can be performed on the first data regularly, converting the first data into second data, and then writing the third data into a third data stream, etc., so as to delete the garbage data in the second storage space from the storage medium, thereby improving the utilization rate of the second storage space.
[0138] Among them, when performing garbage collection on the second data and converting the second data into third data, the second data can be read from the second data stream and then aggregated into third data, for example, the second data is converted into erasure code data, and then the third data is generated based on the erasure code data, and then the third data stream can also be stored in the third storage space of the storage medium.
[0139] In the present application, the temperature of the second data may be lower than the temperature of the first data, and the temperature of the third data may be lower than the temperature of the second data.
[0140] Furthermore, garbage collection may be continued on the third data to convert the third data into fourth data, and so on, until the life cycle of the final data expires, that is, until the final data is deleted from the storage medium.
[0141] In one embodiment of the present application, see Figure 2 When writing the second data into the second data stream and storing it in the second storage space of the storage medium, it can be implemented through the following process, including:
[0142] In step S201, the temperature of the second data is determined;
[0143] The number of garbage collection processing times included in the process of acquiring the second data according to the original data of the second data may be acquired; and the temperature of the second data may be determined according to the number of processing times.
[0144] In the present application, since each time erasure coded data is obtained by performing garbage collection on a piece of data, the temperature of the erasure coded data is often lower than the temperature of the data, when the temperature of a piece of data needs to be determined, the number of garbage collection processing times included in the process of obtaining the data based on the original data of the data can be obtained, and then the temperature of the data can be determined based on the number of processing times.
[0145] For example, data 1 is obtained from data 2 after a garbage collection. Assuming that data 2 is obtained from data 3 after a garbage collection, data 3 is not obtained from a certain data stored in the storage medium after a garbage collection, but is obtained from other places and directly stored in the storage medium. In this case, data 3 is the original data. The number of garbage collection processing times included in the process of obtaining data 1 from data 3 is 2, and the temperature of data 1 can be determined based on the number 2. The number of garbage collection processing times included in the process of obtaining data 2 from data 3 is 1, and the temperature of data 2 can be determined based on the number 1.
[0146] Among them, in the present application, after garbage collection is performed on a piece of data to obtain erasure coded data, the number of garbage collection processing times included in the process of obtaining the erasure coded data can be increased in a preset field in the erasure coded data.
[0147] Thus, in the present application, when it is necessary to determine the temperature of certain data, the number of garbage collection processing times included in the process of obtaining the data based on the original data of the data can be obtained from a preset field in the data. The higher the number of garbage collection processing times, the lower the temperature of the data, and the lower the number of garbage collection processing times, the higher the temperature of the data. Therefore, the inverse of the processing times can be used as the temperature of the data.
[0148] In the present application, since the first data is directly stored in the first storage space in the storage medium according to a write request, and is not obtained by garbage collection of other data, therefore, for the first data, the number of processing times is 0, and a higher preset value can be set as the temperature of the first data, such as a value greater than 1. The second data is obtained by garbage collection of the first data. Therefore, for the second data, the number of processing times is 1, and 1 can be directly used as the temperature of the second data. The third data is obtained by garbage collection of the second data. Therefore, for the third data, the number of processing times is 2, and the reciprocal of 2, 1 / 2, can be directly used as the temperature of the third data, and so on.
[0149] In step S202, a second storage space for storing the temperature data is determined among a plurality of storage spaces included in the storage medium;
[0150] In the present application, different storage spaces in the storage medium have different storage addresses. For any storage space in the storage medium, the temperature of the data stored in the storage space and the storage address of the storage space can be composed of corresponding table items and stored in a correspondence table between the temperature and the storage address of the storage space. The above operation is also performed for each other storage space in the storage medium.
[0151] In this way, in this step, a correspondence table between temperature and storage address of storage space can be determined; the correspondence table is searched to see whether there is a storage address corresponding to the temperature; if there is a storage address corresponding to the temperature in the correspondence table, the second storage space is determined according to the storage address, for example, the storage space corresponding to the storage address is determined as the second storage space.
[0152] However, if the storage address corresponding to the temperature does not exist in the correspondence table, a second storage space is created in the storage medium, for example, a new storage space is created in the storage medium, and the new storage space is determined as the second storage space.
[0153] For example, the data in the storage space corresponding to the storage address may have been garbage collected in advance, and in the process of garbage collection, the storage space corresponding to the storage address is released, and then the corresponding table entry including the storage address is deleted from the correspondence table, so that the storage space corresponding to the storage address no longer exists in the storage medium, that is, there is no second storage space for storing the temperature data. Therefore, a new storage space can be created in the storage medium, and then the new storage space is determined as the second storage space for storing the temperature data.
[0154] Furthermore, if it is necessary to store another data of the temperature in the storage medium later, in order to avoid creating another storage space in the storage medium to store the other data, the other data can continue to be stored in the created second storage space. In another embodiment of the present application, the storage address of the created second storage space can be obtained; the temperature and the storage address of the created second storage space are formed into corresponding table items, and stored in the correspondence table between the temperature and the storage address of the storage space.
[0155] In this way, if it is necessary to store another data of the temperature in the storage medium later, the storage address of the created second storage space corresponding to the temperature can be found in the correspondence table, and then the other data can be stored in the created second storage space according to the storage address of the created second storage space, avoiding the creation of another storage space in the storage medium to store the other data, thereby saving storage resources in the storage medium.
[0156] In step S203, the second data is written into the second data stream and stored in the second storage space.
[0157] Through the method of the present application, data of different temperatures can be stored in different storage spaces, so that when garbage collection is performed on data stored in a storage medium, when garbage collection is required for data of a certain temperature, only garbage collection can be performed on the data of that temperature, thereby reducing the write amplification factor of the storage medium and improving the performance of the storage medium.
[0158] When storing the third data stream into the third storage space of the storage medium, it can also be implemented by referring to the above process, which will not be described in detail here.
[0159] Figure 3 is a block diagram of a data processing device according to an exemplary embodiment. Figure 3 As shown, the device comprises:
[0160] A receiving module 11, configured to receive a write request for first data;
[0161] A first writing module 12 is used to write the first data into a first data stream, and a first storing module 13 is used to store the first data stream into a first storage space of a storage medium;
[0162] A first recycling module 14, configured to perform garbage collection on the first data and convert the first data into second data;
[0163] A second writing module 15 is used to write the second data into a second data stream, and a second storing module 16 is used to store the second data stream into a second storage space of the storage medium;
[0164] The first data and the second data have different data temperatures.
[0165] In an optional implementation, the device further includes:
[0166] A second recycling module, used for performing garbage collection on the second data, and converting the second data into third data;
[0167] The third writing module is used to write the third data into a third data stream.
[0168] In an optional implementation, the device further includes:
[0169] The storage module is used to store the third data stream into the third storage space of the storage medium.
[0170] In an optional implementation, the temperature of the second data is lower than the temperature of the first data, and the temperature of the third data is lower than the temperature of the second data.
[0171] In an optional implementation, the first recovery module includes:
[0172] a conversion unit, configured to read the first data from the first data stream and convert the first data into erasure code data;
[0173] A generating unit is used to generate the second data according to the erasure code data.
[0174] In an optional implementation, the second recovery module includes:
[0175] An aggregation unit is used to read the second data from the second data stream and aggregate the second data into third data.
[0176] In an optional implementation, the first storage module includes:
[0177] a first determining unit, configured to determine a temperature of the second data;
[0178] a second determining unit, configured to determine, among a plurality of storage spaces included in the storage medium, a second storage space for storing the temperature data;
[0179] The storage unit is used to write the second data into a second data stream and store it in the second storage space.
[0180] In an optional implementation, the first determining unit includes:
[0181] A first acquisition subunit is used to acquire the number of garbage collection processing times included in the process of acquiring the second data according to the original data of the second data;
[0182] The first determining subunit is used to determine the temperature of the second data according to the number of processing times.
[0183] In an optional implementation, the second determining unit includes:
[0184] A second determining subunit, used to determine a correspondence table between temperatures and storage addresses of storage spaces;
[0185] A search subunit, used for searching whether there is a storage address corresponding to the temperature in the correspondence table;
[0186] The third determining subunit is configured to determine the second storage space according to the storage address corresponding to the temperature if there is a storage address in the correspondence table.
[0187] In an optional implementation, the second determining unit further includes:
[0188] A creating subunit is used to create the second storage space in the storage medium if the storage address corresponding to the temperature does not exist in the correspondence table.
[0189] In an optional implementation, the second determining unit further includes:
[0190] A second acquisition subunit, used to acquire the storage address of the created second storage space;
[0191] The storage subunit is used to form a corresponding table entry with the temperature and the storage address of the created second storage space, and store the corresponding entry in the corresponding relationship table.
[0192] In the prior art, when storing data of different temperatures in a storage medium, the data of different temperatures are not distinguished. Thus, when garbage collection is performed on the data in the storage medium, all the data stored in the storage medium is often garbage collected at the same time. It can be seen that the data involved in the garbage collection process is all the data stored in the storage medium, that is, the amount of data involved in the garbage collection process is large, which will increase the write amplification factor of the storage medium, thereby reducing the performance of the storage medium.
[0193] Among them, some data stored in the storage medium has a higher temperature, which will generate more garbage data. Usually, garbage collection is required for the data with higher temperature. However, some data has a lower temperature, which will only generate less garbage data or even no garbage data. When garbage collection is performed on the data with higher temperature, it is often not necessary to perform garbage collection on the data with lower temperature.
[0194] Therefore, in the present application, data at different temperatures can be stored in different storage spaces in the storage medium. Among the multiple storage spaces included in the storage medium, when garbage collection is required for the data in a certain storage space, garbage collection can be performed on the data in that storage space, and garbage collection does not need to be performed on the data in all other storage spaces at the same time.
[0195] That is, the data stored in the storage medium are classified into different storage spaces according to different temperatures. When garbage collection is required for the data in a certain storage space, garbage collection is performed on the data in that storage space. In other words, when garbage collection is required for data at a certain temperature, garbage collection is performed on the data at that temperature.
[0196] Therefore, compared with the prior art, the data involved in the garbage collection process in the present application is part of the data stored in the storage medium. That is, compared with the prior art, the amount of data involved in the garbage collection process of the present application is smaller. Therefore, compared with the prior art, the present application can reduce the write amplification factor of the storage medium, thereby improving the performance of the storage medium.
[0197] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0198] The embodiment of the present application provides one or more machine-readable media on which instructions are stored, and when executed by one or more processors, the electronic device executes the data processing method described in one or more of the above embodiments. In the embodiment of the present application, the electronic device includes a server, a gateway, a sub-device, etc., and the sub-device is an Internet of Things device or other device.
[0199] The embodiments of the present disclosure may be implemented as an apparatus configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the apparatus may include electronic devices such as servers (clusters), terminal devices such as IoT devices, and the like.
[0200] Figure 4 An exemplary apparatus 1300 that can be used to implement various embodiments described in this application is schematically shown.
[0201] For one embodiment, Figure 4 An exemplary apparatus 1300 is shown having one or more processors 1302, a control module (chip set) 1304 coupled to at least one of the (one or more) processors 1302, a memory 1306 coupled to the control module 1304, a non-volatile memory (NVM) / storage device 1308 coupled to the control module 1304, one or more input / output devices 1310 coupled to the control module 1304, and a network interface 1312 coupled to the control module 1306.
[0202] The processor 1302 may include one or more single-core or multi-core processors, and the processor 1302 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 1300 can be used as a server device such as a gateway or controller described in the embodiments of the present application.
[0203] In some embodiments, the device 1300 may include one or more computer-readable media (e.g., memory 1306 or NVM / storage device 1308) having instructions 1314 and one or more processors 1302 configured to execute the instructions 1314 in combination with the one or more computer-readable media to implement a module to perform the actions described in the present disclosure.
[0204] For one embodiment, the control module 1304 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1302 and / or any suitable device or component in communication with the control module 1304 .
[0205] The control module 1304 may include a memory controller module to provide an interface to the memory 1306. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0206] The memory 1306 may be used, for example, to load and store data and / or instructions 1314 for the device 1300. For one embodiment, the memory 1306 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 1306 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
[0207] For one embodiment, control module 1304 may include one or more input / output controllers to provide an interface to NVM / storage device 1308 and input / output device(s) 1310 .
[0208] For example, NVM / storage 1308 may be used to store data and / or instructions 1314. NVM / storage 1308 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).
[0209] NVM / storage device 1308 may include storage resources that are physically part of the device on which apparatus 1300 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 1308 may be accessed via input / output device(s) 1310 over a network.
[0210] (One or more) input / output devices 1310 may provide an interface for the apparatus 1300 to communicate with any other appropriate device, and the input / output device 1310 may include a communication component, an audio component, a sensor component, etc. The network interface 1312 may provide an interface for the apparatus 1300 to communicate through one or more networks, and the apparatus 1300 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.
[0211] For one embodiment, at least one of the processor(s) 1302 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be packaged together with the logic of one or more controllers of the control module 1304 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with the logic of one or more controllers of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with the logic of one or more controllers of the control module 1304 to form a system-on-chip (SoC).
[0212] In various embodiments, the device 1300 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the device 1300 may have more or fewer components and / or a different architecture. For example, in some embodiments, the device 1300 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.
[0213] An embodiment of the present application provides an electronic device, including: one or more processors; and one or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, enable the processors to perform the data processing method as described in one or more of the embodiments of the present application:
[0214] receiving a write request for first data;
[0215] Writing the first data into a first data stream, and storing the first data stream in a first storage space of a storage medium;
[0216] performing garbage collection on the first data to convert the first data into second data;
[0217] Writing the second data into a second data stream, and storing the second data stream in a second storage space of the storage medium;
[0218] The first data and the second data have different data temperatures.
[0219] In an optional implementation, the processor further executes:
[0220] performing garbage collection on the second data to convert the second data into third data;
[0221] The third data is written into a third data stream.
[0222] In an optional implementation, the processor further executes:
[0223] The third data stream is stored in a third storage space of the storage medium.
[0224] In an optional implementation, the processor further executes:
[0225] Reading the first data from the first data stream, and converting the first data into erasure coded data;
[0226] The second data is generated according to the erasure coded data.
[0227] In an optional implementation, the processor further executes:
[0228] The second data is read from the second data stream, and the second data is aggregated into third data.
[0229] In an optional implementation, the processor further executes:
[0230] determining a temperature of the first data;
[0231] Determining a first storage space for storing the temperature data among a plurality of storage spaces included in the storage medium;
[0232] The first data stream is stored in the first storage space.
[0233] In an optional implementation, the processor further executes:
[0234] Obtaining the number of garbage collection processing times included in the process of obtaining the first data according to original data of the first data;
[0235] The temperature of the first data is determined according to the number of processing times.
[0236] In an optional implementation, the processor further executes:
[0237] Determine a correspondence table between temperature and storage address of storage space;
[0238] Searching in the correspondence table whether there is a storage address corresponding to the temperature;
[0239] If there is a storage address corresponding to the temperature in the correspondence table, the storage space corresponding to the storage address is determined as the storage space for storing the data of the temperature.
[0240] In an optional implementation, the processor further executes:
[0241] If the storage address corresponding to the temperature does not exist in the correspondence table, creating a first storage space in the storage medium;
[0242] The created first storage space is determined as a storage space for storing the temperature data.
[0243] In an optional implementation, the processor further executes:
[0244] Obtaining the storage address of the created first storage space;
[0245] The temperature and the storage address of the created first storage space form a corresponding table entry, and the corresponding entry is stored in the corresponding relationship table.
[0246] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0247] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0248] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0249] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0250] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0251] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0252] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal 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 terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0253] The data processing method and device provided by the present application are introduced in detail above. The principles and implementation methods of the present application are explained in this article using specific examples. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data processing method, characterized in that: include: receiving a write request for first data; Writing the first data into a first data stream and storing it in a first storage space of a storage medium; performing garbage collection on the first data to convert the first data into second data; Writing the second data into a second data stream and storing it in a second storage space of the storage medium; Wherein, the first data and the second data have different data temperatures; The performing garbage collection on the first data to convert the first data into second data includes: Reading the first data from the first data stream, and converting the first data into erasure coded data; generating the second data according to the erasure code data; Among them, the temperature of a data is determined according to the number of processing times; the number of processing times is the number of garbage collection processing times included in the process of obtaining the data according to the original data of the data; the higher the number of processing times, the lower the temperature of the data, and the lower the number of processing times, the higher the temperature of the data.
2. The method according to claim 1, characterized in that The method further comprises: performing garbage collection on the second data to convert the second data into third data; The third data is written into a third data stream.
3. The method according to claim 2, characterized in that The method further comprises: The third data stream is stored in a third storage space of the storage medium.
4. The method according to claim 2, characterized in that: The temperature of the second data is lower than that of the first data, and the temperature of the third data is lower than that of the second data.
5. The method according to claim 2, characterized in that: The performing garbage collection on the second data to convert the second data into third data includes: The second data is read from the second data stream, and the second data is aggregated into third data.
6. The method according to claim 1, characterized in that The step of writing the second data into a second data stream and storing the second data in a second storage space of the storage medium includes: determining a temperature of the second data; determining a second storage space for storing the temperature data among a plurality of storage spaces included in the storage medium; The second data is written into a second data stream and stored in the second storage space.
7. The method according to claim 6, characterized in that The determining the temperature of the second data includes: Obtaining the number of garbage collection processing times included in the process of obtaining the second data according to original data of the second data; The temperature of the second data is determined according to the number of processing times.
8. The method according to claim 6, characterized in that Determining a second storage space for storing the temperature data among a plurality of storage spaces included in the storage medium comprises: Determine a correspondence table between temperature and storage address of storage space; Searching in the correspondence table whether there is a storage address corresponding to the temperature; If a storage address corresponding to the temperature exists in the correspondence table, the second storage space is determined according to the storage address.
9. The method according to claim 8, characterized in that The method further comprises: If the storage address corresponding to the temperature does not exist in the correspondence table, the second storage space is created in the storage medium.
10. The method according to claim 9, characterized in that The method further comprises: Obtaining the storage address of the created second storage space; The temperature and the storage address of the created second storage space form a corresponding table entry, and the corresponding entry is stored in the corresponding relationship table.
11. A data processing device, characterized in that: include: A receiving module, configured to receive a write request for first data; A first writing module, used for writing the first data into a first data stream, and a first storing module, used for storing the first data stream into a first storage space of a storage medium; A first recycling module, configured to perform garbage collection on the first data and convert the first data into second data; A second writing module, used for writing the second data into a second data stream, and a second storing module, used for storing the second data stream into a second storage space of the storage medium; Wherein, the first data and the second data have different data temperatures; The first recovery module comprises: a conversion unit, configured to read the first data from the first data stream and convert the first data into erasure code data; a generating unit, configured to generate the second data according to the erasure code data; Among them, the temperature of a data is determined according to the number of processing times; the number of processing times is the number of garbage collection processing times included in the process of obtaining the data according to the original data of the data; the higher the number of processing times, the lower the temperature of the data, and the lower the number of processing times, the higher the temperature of the data.
12. An electronic device, characterized in that: include: processor; and A memory having executable codes stored thereon, which, when executed, cause the processor to execute: receiving a write request for first data; Writing the first data into a first data stream and storing it in a first storage space of a storage medium; performing garbage collection on the first data to convert the first data into second data; Writing the second data into a second data stream and storing it in a second storage space of the storage medium; Wherein, the first data and the second data have different data temperatures; The processor also executes: Reading the first data from the first data stream, and converting the first data into erasure coded data; generating the second data according to the erasure code data; Among them, the temperature of a data is determined according to the number of processing times; the number of processing times is the number of garbage collection processing times included in the process of obtaining the data according to the original data of the data; the higher the number of processing times, the lower the temperature of the data, and the lower the number of processing times, the higher the temperature of the data.
13. The electronic device according to claim 12, characterized in that: The processor also executes: performing garbage collection on the second data to convert the second data into third data; The third data is written into a third data stream.
14. The electronic device according to claim 13, characterized in that: The processor also executes: The third data stream is stored in a third storage space of the storage medium.
15. The electronic device according to claim 13, characterized in that: The processor also executes: The second data is read from the second data stream, and the second data is aggregated into third data.
16. The electronic device according to claim 12, characterized in that: The processor also executes: determining a temperature of the second data; determining a second storage space for storing the temperature data among a plurality of storage spaces included in the storage medium; The second data is written into a second data stream and stored in the second storage space.
17. The electronic device according to claim 16, characterized in that: The processor also executes: Obtaining the number of garbage collection processing times included in the process of obtaining the second data according to original data of the second data; The temperature of the second data is determined according to the number of processing times.
18. The electronic device according to claim 16, characterized in that: The processor also executes: Determine a correspondence table between temperature and storage address of storage space; Searching in the correspondence table whether there is a storage address corresponding to the temperature; If a storage address corresponding to the temperature exists in the correspondence table, the second storage space is determined according to the storage address.
19. The electronic device according to claim 18, characterized in that: The processor also executes: If the storage address corresponding to the temperature does not exist in the correspondence table, the second storage space is created in the storage medium.
20. The electronic device according to claim 19, characterized in that: The processor also executes: Obtaining the storage address of the created second storage space; The temperature and the storage address of the created second storage space form a corresponding table entry, and the corresponding entry is stored in the corresponding relationship table.
21. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to perform the data processing method according to one or more of claims 1-10.
