Method, device and equipment for automatically reducing data write amplification of SSD (Solid State Disk) and medium

By automatically dividing and allocating stream IDs in SSD and combining data streams, the problem of write amplification of SSD data is solved, and the effects of write amplification reduction and disk life extension are achieved.

CN119828977APending Publication Date: 2025-04-15成都芯忆联信息技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411914406.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

When writing data, existing SSD technology lacks an automated data write amplification and reduction mechanism, resulting in write amplification and affecting the life of the disk.

Method used

By obtaining the data sent by the host, it is determined whether it has a stream ID. If not, it is divided into multiple categories based on the degree of hot and cold of the data, and each category is allocated for storage. If the data stream is with a stream ID but the number exceeds the threshold, the data stream is combined based on the degree of hot and cold to reduce the number.

Benefits of technology

Automatic data division and stream ID allocation in the absence of stream ID are realized, which reduces write amplification, extends disk life, and optimizes data storage through confluence when there are too many stream IDs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119828977A_ABST
    Figure CN119828977A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device and equipment for automatically reducing data write amplification of an SSD (Solid State Disk) and a medium, and relates to the technical field of solid state disks. The method comprises the following steps: acquiring data issued by a host, and judging whether the data issued by the host carries a stream ID or not; if the data issued by the host does not carry the stream ID, dividing the data issued by the host into a plurality of categories based on the cold and hot degree of the data; the method comprises the following steps: distributing a stream ID for each category of data, and storing each category of data based on the stream ID of each category of data, thereby automatically dividing the data issued by the host into a plurality of data streams when the data issued by the host does not carry the stream ID, carrying out multi-stream storage, and writing the data streams of the same stream Id together, thereby improving the efficiency and reducing the cost. Write amplification is reduced, and the effect of prolonging the service life of the disc is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of solid state drives, and in particular to a method, device, equipment and medium for automatically reducing data write amplification of an SSD. Background Art

[0002] Data can be divided into multiple data streams according to the hotness or coldness of the data. When writing data, the same stream ID is assigned to data with the same or similar life cycle. The software identifies the stream ID and writes the data streams with the same stream ID together. This can make GC more efficient, reduce write amplification, and extend the life of the disk. This method is called multi-streaming.

[0003] Currently, multi-stream is only implemented according to the protocol, and the host needs to provide the stream ID to the SSD. If the data sent does not carry the stream ID, multi-stream will not be triggered. If the number of stream IDs sent exceeds the maximum number of streams supported by the SSD, the excess stream data will all be merged into the default stream, and the excess stream data will not generate the write amplification benefit of multi-stream. Summary of the invention

[0004] Embodiments of the present invention provide a method, apparatus, device and medium for automatically reducing data write amplification of an SSD, aiming to solve at least one technical problem in the above-mentioned background technology.

[0005] In a first aspect, an embodiment of the present invention provides a method for automatically reducing data write amplification of an SSD, which includes:

[0006] Get the data sent by the host and determine whether the data sent by the host contains a stream ID;

[0007] If the data sent by the host does not carry a stream ID, the data sent by the host is divided into multiple categories based on the hotness or coldness of the data;

[0008] A stream ID is allocated to each category of data, and each category of data is stored based on the stream ID of the data of each category.

[0009] A further technical solution is that the data sent by the host is divided into multiple categories based on the coldness or hotness of the data, including:

[0010] Get the write frequency of data sent by the host;

[0011] The data sent by the host is clustered based on the writing frequency of the data sent by the host through a preset clustering algorithm to obtain data of multiple categories.

[0012] A further technical solution is that the stream ID of data in each category is the same, and the stream IDs of data in different categories are different.

[0013] A further technical solution is that the method further comprises:

[0014] If the data sent by the host carries a stream ID, determining whether the number of stream IDs carried in the data sent by the host is greater than a preset number threshold;

[0015] If the number of stream IDs carried in the data sent by the host is greater than a preset number threshold, the data streams corresponding to the various stream IDs are merged based on the hotness or coldness of the data.

[0016] A further technical solution is that the data streams corresponding to the stream IDs are merged based on the hotness or coldness of the data, including:

[0017] Get the data stream write frequency corresponding to each stream ID;

[0018] By using a preset clustering algorithm, the data streams corresponding to the respective stream IDs are clustered based on the writing frequencies of the data streams corresponding to the respective stream IDs, so as to obtain data streams of multiple categories;

[0019] The data streams of each category are merged into a merged data stream, and a stream ID is allocated to the data in the merged data stream.

[0020] A further technical solution is that the number of the merged data streams is not greater than the number threshold.

[0021] A further technical solution is that the method further comprises:

[0022] If the number of stream IDs carried by the data sent by the host is not greater than a preset number threshold, the data sent by the host is stored based on the stream IDs carried by the data sent by the host.

[0023] In a second aspect, an embodiment of the present invention further provides a device for automatically reducing data write amplification of an SSD, which includes a unit for executing the above method.

[0024] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0025] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program can implement the above method when executed by a processor.

[0026] The embodiment of the present invention provides a method, device, equipment and medium for automatically reducing data write amplification of an SSD. The method includes: obtaining data sent by a host, determining whether the data sent by the host carries a stream ID; if the data sent by the host does not carry a stream ID, dividing the data sent by the host into multiple categories based on the hotness or coldness of the data; allocating a stream ID to each category of data, and storing each category of data based on the stream ID of each category of data, so that when the data sent by the host does not carry a stream ID, the data sent by the host can be automatically divided into multiple data streams, and multi-stream storage is performed, and data streams with the same stream ID are written together, which can improve efficiency, reduce write amplification, have write amplification benefits, and achieve the effect of extending the life of the disk.

[0027] Furthermore, if the data sent by the host carries a stream ID, determine whether the number of stream IDs carried by the data sent by the host is greater than a preset threshold; if the number of stream IDs carried by the data sent by the host is greater than the preset threshold; merge the data streams corresponding to each stream ID based on the hotness or coldness of the data, so that the number of merged data streams can be less than the maximum number of data streams that the SSD can support, thereby ensuring that each data stream can be stored in multiple streams, with write amplification benefits, thereby achieving the effect of extending the life of the disk. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0029] Figure 1 A flowchart of a method for automatically reducing data write amplification of an SSD provided by an embodiment of the present invention;

[0030] Figure 2 A schematic block diagram of a device for automatically reducing data write amplification of an SSD provided by an embodiment of the present invention;

[0031] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0034] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0035] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0036] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0037] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of a method for automatically reducing data write amplification in an SSD provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0038] S1, obtain the data sent by the host and determine whether the data sent by the host contains a stream ID.

[0039] In a specific implementation, data sent by the host is received, and the data is data to be stored. In the embodiment of the present invention, it is first determined whether the data sent by the host carries a stream ID. If there is a stream ID, it means that stream storage is configured; if there is no stream ID, it means that multi-stream storage is not configured.

[0040] S2: If the data sent by the host does not carry a flow ID, the data sent by the host is divided into multiple categories based on the hotness or coldness of the data.

[0041] In a specific implementation, if the data sent by the host does not carry a flow ID, the data sent by the host is divided into multiple categories based on the coldness or hotness of the data.

[0042] Specifically, the degree of hotness and coldness can be specifically referred to as the write frequency, which refers to the frequency / count of writing data. Data with high write frequency is determined to be hot data, and data with low write frequency is determined to be cold data. Specifically, the write frequency of data in each LBA chunk is obtained. LBA is the abbreviation of Logical Block Addressing, which means logical block addressing in Chinese.

[0043] In some embodiments, the above step of “classifying the data sent by the host into multiple categories based on the coldness or hotness of the data” specifically includes the following steps:

[0044] S21, obtaining the writing frequency of the data sent by the host.

[0045] In a specific implementation, the write frequency of the data sent by the host is obtained. For example, the write frequency of the data in each LBAchunk (LBA block) is obtained. The data with high write frequency is determined as hot data, and the data with low write frequency is determined as cold data.

[0046] S22, clustering the data sent by the host based on the writing frequency of the data sent by the host through a preset clustering algorithm to obtain data of multiple categories.

[0047] In a specific implementation, the clustering algorithm may be selected by those skilled in the art according to actual conditions, and the present invention does not specifically limit it.

[0048] The data sent by the host is clustered and analyzed based on the write frequency of the data sent by the host through a preset clustering algorithm to obtain multiple categories of data, among which data with similar write frequency will be divided into one category.

[0049] S3, assigning a stream ID to each category of data, and storing each category of data based on the stream ID of each category of data.

[0050] In a specific implementation, a stream ID is assigned to each category of data, and each category of data is stored based on the stream ID of the data. Specifically, data streams with the same stream ID are written together, which can improve efficiency and reduce write amplification, thereby extending the life of the disk.

[0051] Furthermore, the flow IDs of data in each category are the same, and the flow IDs of data in different categories are different. Meanwhile, the number of categories is less than a preset number threshold, which is the maximum number of flows that the SSD can support. Those skilled in the art can set the number threshold according to the actual situation of the SSD, and the present invention does not specifically limit it.

[0052] Furthermore, in some embodiments, the method further comprises:

[0053] S4: If the data sent by the host carries a stream ID, it is determined whether the number of stream IDs carried by the data sent by the host is greater than a preset number threshold.

[0054] In a specific implementation, if the data sent by the host carries a stream ID, it is determined whether the number of stream IDs carried by the data sent by the host is greater than a preset number threshold. The number threshold is the maximum number of data streams that the SSD can support. Those skilled in the art can set the number threshold according to the actual situation of the SSD, and the present invention does not specifically limit it.

[0055] S5, if the number of flow IDs carried in the data sent by the host is greater than a preset number threshold; the data flows corresponding to the flow IDs are merged based on the hotness or coldness of the data.

[0056] In a specific implementation, if the number of stream IDs carried by the data sent by the host is greater than a preset threshold, it means that the solid-state drive cannot support the existing number of data streams. Therefore, in the present invention, the data streams corresponding to each stream ID are merged based on the hotness or coldness of the data.

[0057] The quantity threshold is the maximum number of data streams that the SSD can support. Those skilled in the art may set the quantity threshold according to the actual situation of the SSD, and the present invention does not specifically limit it.

[0058] In some embodiments, the above step of "merging data streams corresponding to various stream IDs based on the hotness or coldness of the data" specifically includes the following steps:

[0059] S51, obtaining the data stream writing frequency corresponding to each stream ID.

[0060] In a specific implementation, the data stream write frequency corresponding to each stream ID is obtained. The write frequency refers to the frequency / count of writing data. Data with high write frequency is determined as hot data, and data with low write frequency is determined as cold data.

[0061] S52, clustering the data streams corresponding to the respective flow IDs based on the writing frequencies of the data streams corresponding to the respective flow IDs by using a preset clustering algorithm to obtain data streams of multiple categories.

[0062] In a specific implementation, the clustering algorithm may be selected by those skilled in the art according to actual conditions, and the present invention does not specifically limit it.

[0063] By using a preset clustering algorithm, cluster analysis is performed on the data streams corresponding to each stream ID based on the write frequency of the data streams corresponding to each stream ID to obtain data of multiple categories, wherein data streams with similar write frequencies are classified into one category.

[0064] Furthermore, the number of the merged data streams is not greater than the number threshold, wherein the number threshold is the maximum number of data streams that the SSD can support. Those skilled in the art may set the number threshold according to the actual situation of the SSD, and the present invention does not specifically limit it.

[0065] S53: merge the data streams of each category into a merged data stream, and assign a stream ID to the data in the merged data stream.

[0066] In a specific implementation, each category of data streams is merged into a merged data stream, and a stream ID is allocated to the data in the merged data stream.

[0067] Specifically, data streams of one category are merged into a merged data stream, and a stream ID is assigned to the merged data stream. The merged data stream is then stored based on the stream ID of the merged data stream. Specifically, data streams with the same stream ID are written together, which can improve efficiency and reduce write amplification, thereby extending the life of the disk.

[0068] S6: If the number of flow IDs carried by the data sent by the host is not greater than a preset number threshold, the data sent by the host is stored based on the flow IDs carried by the data sent by the host.

[0069] In a specific implementation, if the number of stream IDs carried by the data sent by the host is not greater than the preset threshold, it means that the SSD can support the current number of data streams. Therefore, the data sent by the host is stored based on the stream IDs carried by the data sent by the host. Specifically, data streams with the same stream ID are written together, which can improve efficiency and reduce write amplification, thereby extending the life of the disk.

[0070] In the technical solution of the embodiment of the present invention, the method for SSD to automatically reduce data write amplification includes: obtaining data sent by the host, and determining whether the data sent by the host carries a stream ID; if the data sent by the host does not carry a stream ID, dividing the data sent by the host into multiple categories based on the hotness or coldness of the data; assigning a stream ID to each category of data, and storing each category of data based on the stream ID of each category of data, so that when the data sent by the host does not carry a stream ID, the data sent by the host can be automatically divided into multiple data streams and stream stored, and data streams with the same stream ID can be written together, which can improve efficiency, reduce write amplification, have write amplification benefits, and achieve the effect of extending the life of the disk.

[0071] Furthermore, if the data sent by the host carries a stream ID, determine whether the number of stream IDs carried by the data sent by the host is greater than a preset threshold; if the number of stream IDs carried by the data sent by the host is greater than the preset threshold; merge the data streams corresponding to each stream ID based on the hotness or coldness of the data, so that the number of merged data streams can be less than the maximum number of data streams that the SSD can support, thereby ensuring that each data stream can be stored in multiple streams, with write amplification benefits, thereby achieving the effect of extending the life of the disk.

[0072] See also Figure 2 , Figure 2 : is a schematic block diagram of an SSD automatic data write amplification reduction device 20 provided by an embodiment of the present invention. Corresponding to the above SSD automatic data write amplification reduction method, the present invention also provides an SSD automatic data write amplification reduction device 20. The SSD automatic data write amplification reduction device 20 includes a unit for executing the above SSD automatic data write amplification reduction method, and the SSD automatic data write amplification reduction device 20 can be configured in a desktop computer, a tablet computer, a laptop computer, and other terminals. Specifically, the SSD automatic data write amplification reduction device 20 includes:

[0073] The first judging unit 21 is used to obtain the data sent by the host and judge whether the data sent by the host has a stream ID;

[0074] A classification unit 22, configured to classify the data sent by the host into multiple categories based on the coldness or hotness of the data if the data sent by the host does not carry a stream ID;

[0075] The allocating unit 23 is used to allocate a flow ID to each category of data and store each category of data based on the flow ID of each category of data.

[0076] In one embodiment, the data sent by the host is divided into multiple categories based on the coldness or hotness of the data, including:

[0077] Get the write frequency of data sent by the host;

[0078] The data sent by the host is clustered based on the writing frequency of the data sent by the host through a preset clustering algorithm to obtain data of multiple categories.

[0079] In one embodiment, the flow ID of data in each category is the same, and the flow IDs of data in different categories are different.

[0080] In one embodiment, the SSD automatic data write amplification reduction device 20 further includes:

[0081] A second judgment unit is used to judge whether the number of the stream IDs carried in the data sent by the host is greater than a preset number threshold if the data sent by the host carries the stream ID;

[0082] The confluence unit is used to merge the data streams corresponding to the respective stream IDs based on the hotness or coldness of the data if the number of stream IDs carried by the data sent by the host is greater than a preset number threshold.

[0083] In one embodiment, the step of merging data streams corresponding to respective stream IDs based on the hotness or coldness of the data includes:

[0084] Get the data stream write frequency corresponding to each stream ID;

[0085] By using a preset clustering algorithm, the data streams corresponding to the respective stream IDs are clustered based on the writing frequencies of the data streams corresponding to the respective stream IDs, so as to obtain data streams of multiple categories;

[0086] The data streams of each category are merged into a merged data stream, and a stream ID is allocated to the data in the merged data stream.

[0087] In one embodiment, the number of the merged data streams is not greater than the number threshold.

[0088] In one embodiment, the SSD automatic data write amplification reduction device 20 further includes:

[0089] The storage unit is used to store the data sent by the host based on the stream IDs carried by the data sent by the host if the number of stream IDs carried by the data sent by the host is not greater than a preset number threshold.

[0090] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned SSD automatic data write amplification reduction device 20 and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.

[0091] The above-mentioned device 20 for automatically reducing data write amplification of SSD can be implemented in the form of a computer program. The computer program can be used in the following manner: Figure 3 Runs on the computer device shown.

[0092] See also Figure 3 , Figure 3 5 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a terminal or a server, wherein the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The server may be an independent server or a server cluster composed of multiple servers.

[0093] The computer device 500 includes a processor 502 , a memory, and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0094] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute a method for automatically reducing data write amplification in an SSD.

[0095] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .

[0096] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a method for automatically reducing data write amplification of an SSD.

[0097] The network interface 505 is used to communicate with other devices over the network. Those skilled in the art will appreciate that the above structure is only a block diagram of a portion of the structure related to the present application solution, and does not constitute a limitation on the computer device 500 to which the present application solution is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0098] The processor 502 is used to run the computer program 5032 stored in the memory to implement the following steps:

[0099] Get the data sent by the host and determine whether the data sent by the host contains a stream ID;

[0100] If the data sent by the host does not carry a stream ID, the data sent by the host is divided into multiple categories based on the hotness or coldness of the data;

[0101] A stream ID is allocated to each category of data, and each category of data is stored based on the stream ID of the data of each category.

[0102] In some embodiments, the data sent by the host is divided into multiple categories based on the coldness or hotness of the data, including:

[0103] Get the write frequency of data sent by the host;

[0104] The data sent by the host is clustered based on the writing frequency of the data sent by the host through a preset clustering algorithm to obtain data of multiple categories.

[0105] In some embodiments, the flow ID of data in each category is the same, and the flow IDs of data in different categories are different.

[0106] In some embodiments, the method further comprises:

[0107] If the data sent by the host carries a stream ID, determining whether the number of stream IDs carried in the data sent by the host is greater than a preset number threshold;

[0108] If the number of stream IDs carried in the data sent by the host is greater than a preset number threshold, the data streams corresponding to the various stream IDs are merged based on the hotness or coldness of the data.

[0109] In some embodiments, merging the data streams corresponding to the stream IDs based on the hotness or coldness of the data includes:

[0110] Get the data stream write frequency corresponding to each stream ID;

[0111] By using a preset clustering algorithm, the data streams corresponding to the respective stream IDs are clustered based on the writing frequencies of the data streams corresponding to the respective stream IDs, so as to obtain data streams of multiple categories;

[0112] The data streams of each category are merged into a merged data stream, and a stream ID is allocated to the data in the merged data stream.

[0113] In some embodiments, the number of the merged data streams is not greater than the number threshold.

[0114] In some embodiments, the method further comprises:

[0115] If the number of stream IDs carried by the data sent by the host is not greater than a preset number threshold, the data sent by the host is stored based on the stream IDs carried by the data sent by the host.

[0116] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0117] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0118] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the following steps:

[0119] Get the data sent by the host and determine whether the data sent by the host contains a stream ID;

[0120] If the data sent by the host does not carry a stream ID, the data sent by the host is divided into multiple categories based on the hotness or coldness of the data;

[0121] A stream ID is allocated to each category of data, and each category of data is stored based on the stream ID of the data of each category.

[0122] In some embodiments, the data sent by the host is divided into multiple categories based on the coldness or hotness of the data, including:

[0123] Get the write frequency of data sent by the host;

[0124] The data sent by the host is clustered based on the writing frequency of the data sent by the host through a preset clustering algorithm to obtain data of multiple categories.

[0125] In some embodiments, the flow ID of data in each category is the same, and the flow IDs of data in different categories are different.

[0126] In some embodiments, the method further comprises:

[0127] If the data sent by the host carries a stream ID, determining whether the number of stream IDs carried in the data sent by the host is greater than a preset number threshold;

[0128] If the number of stream IDs carried in the data sent by the host is greater than a preset number threshold, the data streams corresponding to the various stream IDs are merged based on the hotness or coldness of the data.

[0129] In some embodiments, merging the data streams corresponding to the stream IDs based on the hotness or coldness of the data includes:

[0130] Get the data stream write frequency corresponding to each stream ID;

[0131] By using a preset clustering algorithm, the data streams corresponding to the respective stream IDs are clustered based on the writing frequencies of the data streams corresponding to the respective stream IDs, so as to obtain data streams of multiple categories;

[0132] The data streams of each category are merged into a merged data stream, and a stream ID is allocated to the data in the merged data stream.

[0133] In some embodiments, the number of the merged data streams is not greater than the number threshold.

[0134] In some embodiments, the method further comprises:

[0135] If the number of stream IDs carried by the data sent by the host is not greater than a preset number threshold, the data sent by the host is stored based on the stream IDs carried by the data sent by the host.

[0136] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which can store program codes. The computer-readable storage medium can be non-volatile or volatile.

[0137] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0138] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0139] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0140] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0141] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0142] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

[0143] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for automatically reducing data write amplification in an SSD, characterized in that: include: Get the data sent by the host and determine whether the data sent by the host contains a stream ID; If the data sent by the host does not carry a stream ID, the data sent by the host is divided into multiple categories based on the hotness or coldness of the data; A stream ID is allocated to each category of data, and each category of data is stored based on the stream ID of the data of each category.

2. The method for automatically reducing data write amplification in an SSD according to claim 1, characterized in that: The data sent by the host is divided into multiple categories based on the coldness or hotness of the data, including: Get the write frequency of data sent by the host; The data sent by the host is clustered based on the writing frequency of the data sent by the host through a preset clustering algorithm to obtain data of multiple categories.

3. The method for automatically reducing data write amplification in an SSD according to claim 1, characterized in that: The stream ID of data in each category is the same, and the stream IDs of data in different categories are different.

4. The method for automatically reducing data write amplification in an SSD according to claim 1, characterized in that: The method further comprises: If the data sent by the host carries a stream ID, determining whether the number of stream IDs carried in the data sent by the host is greater than a preset number threshold; If the number of stream IDs carried in the data sent by the host is greater than a preset number threshold, the data streams corresponding to the various stream IDs are merged based on the hotness or coldness of the data.

5. The method for automatically reducing data write amplification in an SSD according to claim 4, characterized in that: The merging of data streams corresponding to the stream IDs based on the hotness or coldness of the data includes: Get the data stream write frequency corresponding to each stream ID; By using a preset clustering algorithm, the data streams corresponding to the respective stream IDs are clustered based on the writing frequencies of the data streams corresponding to the respective stream IDs, so as to obtain data streams of multiple categories; The data streams of each category are merged into a merged data stream, and a stream ID is allocated to the data in the merged data stream.

6. The method for automatically reducing data write amplification in an SSD according to claim 4, characterized in that: The number of the merged data flows is not greater than the number threshold.

7. The method for automatically reducing data write amplification in an SSD according to claim 4, characterized in that: The method further comprises: If the number of stream IDs carried by the data sent by the host is not greater than a preset number threshold, the data sent by the host is stored based on the stream IDs carried by the data sent by the host.

8. A device for automatically reducing data write amplification of an SSD, characterized in that: The method comprises a unit for executing the method according to any one of claims 1 to 7.

9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 can be implemented.