Monday, February 28, 2011

TRIM, GC and DSS point

Preamble: 18 months ago, when the introduction of the TRIM command, we wrote about the value of technology and how it works right. It seemed interesting, when the majority of SSD support this command to return to this technology. Remember that Windows 7, during its "server" and Linux support the TRIM command.

For Mac OS X, it will be Mac OS X 10.7, Lion. Before seeing how to fix it, see where it came from. Typically, SSDs are working with an allocation table that is not synchronized with the file system: write a file at the beginning of the file system does not necessarily write the file here on the SSD (there not even, strictly speaking, the beginning and end).

In addition, management algorithms wear make known the exact location where a file is written is not so simple. In fact, the system is incapable of knowing the exact structure of the DSS. We will see that it is important. The performance loss, which occurs on the SSD used extensively, is due to management algorithms wear: DSS, when you write a file, will look for the memory chip best suited to receive a write ( the various algorithms are explained in detail in this article), and that's where the rub.

As we have seen, the DSS and the file system are independent, and DSS can not know a thing about data: if it was written at least once or if it is empty. Oops, erasure usually used in a filesystem (like NTFS, HFS +, etc..) Does not erase the data, the location is simply marked as available for the system, but the SSD can not guess.

With TRIM, the choice of cells is easier, since the controller knows exactly where the cells are free and there is no phase to find the right place. Another interesting point, there is a gain at the writes: Typically, a DSS is able to delete data at a block (usually 256 or 512 kb) but write or read data at a "page" (2, 4 or 8 kb).

Without TRIM, changing a byte in a file so the application reading a block, changing one byte and rewriting the entire block, the controller does not know the status of data. With the TRIM, it is possible to write directly to a page if it is listed as empty. In practice, the TRIM keeps good performance in time and - at worst - put a SSD "zero" by sending the TRIM control throughout the SSD (via the quick format in Windows, for example).

The most obvious solution, it comes standard ATA8 and is built into Windows 7 and Linux, and soon Mac OS X. If DSS is losing time searching randomly deleted files, give him the opportunity to find relevant files easily. No sooner said than done, at least when the chain is compatible. Specifically, the TRIM is to indicate that the DSS data is erased, contrary to the usual technique that involves marking the deleted data without actually remove the SSD and without any means of knowing.

With TRIM, the SSD is able to see where the deleted data and thus avoids trying to find them. The advantage is that placing the order is simple: it does not require specific resources. Indeed, it is a simple indicator that will enable the SSD to update its internal table and enable him to understand the status of a cell.

There is no physical deletion of data, the operation at the operating system does not change but the controller of the SSD now know if a cell is deleted (logically). The main problem of TRIM is that the entire "chain" must accept the order. We must have an operating system that supports the TRIM, a SATA controller driver who accepts the order and a DSS that the interpreter.

IF the first and last point is quite simple - all support the recent TRIM SSD and Windows 7 too - it's more embarrassing for the second. Indeed, some drivers do not let the command, thereby blocking the order. If Intel or Microsoft simply provide compatible drivers, it is not necessarily the case on other controllers.

In addition, RAID controllers do not let the TRIM control and systems based RAID0 can not take advantage of the order. Before TRIM Indilinx proposed an intermediate solution, which had the advantage of being usable with most Windows, Wiper. The Wiper is a small program used on some SSD (depending on firmware) which in fact serves to synchronize the DSS and the operating system.

Simple case: you have a 32GB SSD, you have completed your operating system and a file from a DVD that you have compressed. Without TRIM, delete the file is an action that SSD will not see him, he is always there. The wiper is used to match the base file system with the base of the DSS, to make him understand that the file has been deleted.

Failure of the technique (in addition to bugs in Windows 64 bit), just start the program periodically, it is not automatic. In addition, the wiper is usable in NTFS (a Linux version in beta, there anyway). In practice, it is more a solution to return to normal a sustainable manner to correct the problem.

The final solution is the Garbage Collector. Specifically, we are here between TRIM and Wiper: the SSD will reorganize its data only to optimize the operation. Both solutions are used a priori, and that Samsung is the most interesting: installed on the PB22-J and its clones, it can perform the same work as TRIM, but in the background.

In fact, Samsung has incorporated an automatic wiper in its SSD with a rearrangement of the data when the SSD is not used. Two pitfalls remain: the whole is linked to the NTFS file system (which limits its effectiveness in Windows) and above, Samsung does not provide updates for its SSDs outside OEM partners.

In fact, the solution is effective in Windows, while being less interesting than the TRIM: DSS works in the background, which has the drawback of increasing consumption invisibly, and if the SSD is used, function is activated a priori. In the latest firmware Vertex OCZ offers an alternative version that includes, instead of TRIM, a garbage collector.

Specifically, the system is different from that of Samsung, the whole being recommended for users of systems that do not like the NTFS file system (Linux, Mac OS X, etc..). The exact function is unknown, but it seems that the technology used to rearrange data on the SSD to optimize performance.

In practice, and as long there is enough free space, the performance loss should be rare, even if a genuine management of TRIM would be a plus. Still, this technique is more like the wiper, an interim solution, pending a real management problem in the operating system. It's better than doing nothing, but worse than the TRIM, with the same problem as the solution from Samsung, the work in the background of the DSS can have an impact on consumption, a troublesome problem in a laptop .

Currently (February 2011), the TRIM is generally well tolerated by all the SSD market, which is unfortunately not the case for all controllers. Overall, it is better to use a SATA-related Intel chipset (if you have an Intel platform) or using generic drivers from Microsoft when working on a connector connected to another SATA controller (AMD, Marvel, etc.)..

For the operating system, Windows 7 and Linux support the TRIM, Mac OS X (10.6) is not compatible with cons.

No comments:

Post a Comment