Read the second part of our series of articles on the topic of SSD testing. Some time ago we’ve been discussing flash memory in general. You can read the first part here >>
In today’s article we’ll discuss how to handle the situation when your SSD is starting to run out of free pages. Read on and learn!
The modification of data saved on SSDs is more difficult than it is for HDD where it can be simply overwritten. Basically, when an SSD is asked for modification of a particular page it actually doesn’t modify that page because it would have to clear it – which is not possible without clearing whole block. To overcome this, the modified page is saved on another page that is available, and the page that is supposed to be modified is marked as stale. As long as an SSD has free pages, this way of writing data to a new place and marking an old page as stale is possible. But at some point, the SSD will run out of free pages. In order to avoid this situation, a process called garbage collection is executed by SSDs. This is hard work performed by the SSD controller that is by itself a separate computer with CPU and memory. This controller is actually responsible for the whole data management on the SSD flash memory.
The host operating system is usually unaware of what is happening “under the hood”, it simply asks for writing data into some logical place on a disk. Actual data placement is performed by the SSD controller. The only thing that modern operating systems do is sending a TRIM command to the SSD in order to notify it that a particular piece of data was removed. This command simplifies the garbage collection process a bit because the SSD is more aware about which pages are no longer valid. During the garbage collection process, the SSD controller is clearing blocks to make some free pages available. But it isn’t possible to just clear any blocks because some pages may have valid data saved to them that can’t just be deleted. Also, it isn’t possible to simply search for blocks that contain only stale pages to clear them. That is because it would be possible to run out of such blocks in scenarios where each block on a disk would contain at least one valid page.
What the SSD actually does during garbage collection is rewriting all valid pages from a particular block to a new one. The next block from which pages were copied can be cleared. Usually the SSD selects the blocks that have no free pages left for the garbage collection. It’s different when garbage collection is actually performed because in some cases it happens only during the modification of data, in other cases also in the background when the SSD is not used. It depends on the controller when a garbage collection is performed and in some cases it’s known only to the controller manufacturer. Usually, Enterprise SSDs perform garbage collection only during writes, and background garbage collection is available for regular consumer SSDs. Enterprise SSDs usually don’t support background garbage collection in order to avoid potentially unnecessary writes (when copying blocks) which increases the longevity of a disk. It is designed that way because flash memory has a limited number of writes before it becomes unusable. Background garbage collection in an Enterprise environment is also not suitable because in many cases the device won’t get any time to perform this process. Consumer SSDs on the other hand are not exposed to the same high load as their Enterprise counterparts, and in some cases manufacturers decide to include background garbage collection in order to make device work potentially faster.
We briefly explained the garbage collection process on SSDs because it has an important impact on the performance. When an SSD has to run garbage collection during writes it works significantly slower, especially when lots of blocks have to be rewritten in order to complete the write. In some cases, a disk has to write much more data than the operating system has sent to it because many blocks need to be rearranged during garbage collection.
That’s not all! We have scheduled two more articles in this series – keep your eyes open for the next one!
Rating: 5.0/5 (3 votes cast)
Basics of SSD Performance Tests : Garbage collection, 5.0 out of 5 based on 3 ratings