Recording gain. Part 2



    In a previous article, we discussed recording amplification, discussing where it comes from and why it is bad for your SSD. We also began to consider the factors that influence Write Amplification. Today we continue this discussion.

    Data Redundancy
    The next factor affecting write gain is data overprovisioning. Redundancy shows the difference between the actual capacity of the device and the amount available for the operating system, and is calculated by the formula:

    (Физический объем - Логический объем) / Логический объем

    During garbage collection, wear leveling and remapping of bad blocks, the SSD controller uses this "extra" space to reduce recording gain. Therefore, this factor is variable (that is, the WA level depends on its value) and inverse (the higher its value, the lower the WA level).



    The first level of redundancy for SSD developers was “presented” by the habit of manufacturers of traditional HDDs to measure volume in “decimal” gigabytes, instead of the usual “binary” gibytes. SSD memory cells store single bits, organized in bytes, then in kibibytes and so on until gibytes, although the capacity of the finished product is declared in gigabytes. The difference between these values ​​in reality is 7.37%, and usually this volume is used for official needs, although it is not considered a traditional amount of "redundancy".

    The second level of redundancy is laid by the manufacturer, and is usually 0%, 7% or 22%. For example, on the basis of chips with a capacity of 128 Gb, a manufacturer can release SSDs with a capacity of 100 Gb, 120 Gb and 128 Gb, which gives us 22%, 7% or 0%, respectively.

    The third level of redundancy is determined by the user, allowing him to gain an increase in speed and reliability by sacrificing part of the disk. This can be done either using the configuration utility, “biting off” part of the disk for internal needs, or simply by leaving unallocated space on the disk. It is worth noting that this method is still a thing of the past, since the development of modern SSD controllers (including SandForce solutions from LSI) allows us to do without this, using the redundancy laid down by the manufacturer.



    TRIM
    The presence of the TRIM command is a binary factor, and its presence is a factor inversely affecting recording gain (in other words, it reduces WA).

    Much has been written about TRIM, but just in case, briefly repeat. TRIM is an ATA interface command (in SCSI there are similar UNIMAP and WRITE SAME TRIM commands), with which the operating system can tell the drive which blocks are no longer in use due to the files contained in them being deleted, or the partition is generally formatted . After receiving this useful information from the OS, the SSD marks these sectors as being in an “incorrect” state and does not try to save its contents during further garbage collection operations.

    As a result of using the TRIM command, an SSD can sometimes significantly reduce the amount of data overwritten during garbage collection, and thus reduce WA.

    At the moment, almost all modern operating systems support this command in one way or another, although earlier it was sometimes necessary to use special utilities that collected information about free blocks using OS methods and transferred it to the disk using a sequence of TRIM commands.

    Of course, the disk itself must support the command, but in our time SSDs without TRIM support are already infrequent exotic.

    Free space
    As I wrote in the section on data redundancy, free space also affects WA, so I just note this factor again, it is variable and is also inversely related to recording gain.

    Safe Erase
    A separate ATA command is designed for complete safe disk cleanup. If the SSD does not use hardware encryption, after this command the drive actually returns to a state similar to the factory one. This increases its performance to the maximum possible level, while recording gain reduces it to a minimum. Of course, as these indicators fill up, they deviate from their ideal states.

    On-the-fly encryption disks can execute the secure erase command differently. It is enough for them to reset the current encryption key and generate a new one, after which the data will become unreadable. In this case, to restore maximum performance, you also need the TRIM command, which will indicate that you no longer need the data in any form.

    Wear leveling
    As I already wrote in the article about the history of FLASH, all memory cells have a limit on the number of maximum possible rewriting cycles. Obviously, some cells will be overwritten more often, some less often, which will lead to premature failure of some cells out of order. The first candidates for this are the initial areas of the disk where OS service tables are traditionally stored. Of course, a disk can “replace” bad cells with others, among “redundant” ones, in the end, the remapping process was invented long before the SSD, but modern flash drives try to prevent this for as long as possible.

    To do this, use the “wear leveling” process: SSDs are written to all cells evenly, periodically changing them. In theory, this allows all cells to be used to the maximum before they fail. In practice, this process must be carried out very thoughtfully. Wear leveling requires that data that was once recorded and no longer overwritten (cold) is periodically transferred to another location to enable the recording of frequently changing (hot) data in those cells that are occupied by cold ones. As you already understand, this leads to increased recording and disc wear.

    In this case, the task of controller manufacturers is to find compromise algorithms that maximize both indicators without harming each other.

    Other methods
    Also, modern SSD controllers produce a number of more complex optimizations, some of which I briefly mentioned in a previous article, to improve WA performance.

    It is clear that not all data on a disk changes with the same frequency. There is dynamic data, but there is static. Separating them in different areas of the disk is often a good idea, as this will allow you to “not touch” blocks of static data when overwriting. The main disadvantage of this process is that it contradicts wear leveling, which requires the most uniform loading of cells.

    It is also easy to understand that it is better to write and erase data on an SSD sequentially. This facilitates the work of all controller algorithms, therefore, often in the disks used various tricks aimed at reducing the number of "random" write operations.

    Not a single diplomat in the world has to make such compromises that SSD controllers (and their developers) make, and the complexity of modern controllers increases, opening up new optimization opportunities. I think in one of the following articles I will return to the topic of SSD controllers and talk about their work on a specific example of the LSI SandForce family.

    Also popular now: