Performance Degradation, Garbage Collection and TRIM
Unfortunately, SSDs are not always as fast as in their fresh out-of-box state. In many situations their real-life performance goes down far below the numbers you have seen in the previous section of this review. The reason is that, having run out of free pages in flash memory, the SSD controller has to erase memory pages before writing to them, which involves certain latencies. Modern SSD controllers can alleviate the performance hit by erasing unused flash memory pages beforehand when the SSD is idle, which is the key idea of the Idle-Time Garbage Collection algorithm whose implementation has a strong effect on the real-life performance of any SSD.
An SSD controller doesn’t know which memory pages contain user data and which are considered empty by the OS. It’s because removing a file doesn’t involve its actual physical removal. Instead, the corresponding memory is marked in the file system as available for writing into. So, an SSD controller can only pre-erase pages in the reserve pool (if it exists) which is not accessible by the OS. For a better solution of this problem, modern OSes have the TRIM command which improves garbage collection efficiency. TRIM enables the SSD controller to physically remove unneeded data so that the user didn’t feel a performance hit during subsequent write requests.
This is how it should be theoretically. In practice, however, SSDs differ in their garbage collection and TRIM support. That’s why we check out the performance hit an SSD suffers when transitioning from its out-of-box (the flash memory is clean) to used state. This test follows the SNIA SSSI TWG PTS guidelines, which means that we measure the speed of writing in four cases one by one: 1) when the SSD is in its out-of-box state, 2) after the SSD has been twice filled full with data, 3) after a 30-minute pause that allows the SSD controller to restore performance by means of data reorganization and garbage collection, and 4) after the SSD is cleaned logically by the TRIM-supporting OS.
So we use IOMeter 1.1.0 RC1 to measure the speed of writing random-address 4KB data blocks aligned to flash memory pages at a request queue depth of 32. The test data are pseudo-random. The changes in speed are shown in the next diagram where 100% is the SSD’s out-of-box performance.
The Samsung 840 EVO features a perfect TRIM implementation, which lets the drive keep its original performance over time. Well, Samsung drives have never had any problems with TRIM, actually.
As for background garbage collection (without TRIM), the diagram shows that it is present, too. The Samsung 840 EVO gets faster after being idle for a while whereas earlier SSDs from Samsung couldn't do that. Well, it is also possible that this performance improvement is due to clearing the TurboWrite cache rather than to background garbage collection. Anyway, the 840 EVO always works faster after a brief idle period both in TRIM-supporting and in non-TRIM environments.