Monday, April 4, 2016

filesystems - Software to fix SSD performance degradation




The current generation of SSDs suffer write-speed slowdown (for random writes) over time because of the way data needs to be read and then written in blocks. Various manufactors have fixes coming out to address this (like doing "garbage collection" when the disk is idle) but is there any software solution to fix up a current SSDs filesystem to restore performance, other than wiping the complete drive and starting over?



Either something that will run in the background, or a "recondition" tool that can be left to run overnight to do the work; I can't think of any reason that such tools can't exist, but I've not been able to find any.


Answer



There can't be a such generic software like there is defragmentation software for non SSD hard drive.



The reason is that on a non SSD Hard Drive, data are stored physically on a known place. By knowing the LBA address of data, a defragmentation tool now where a data is physically on the hard drive and can move it where it wants. (this is almost true but not in all case)



On a SSD, data are also stored at an LBA address (that how ATA/SATA works). But, while a traditional hard drive will (in most case) store LBA address 1 on the beginning of the disk, followed by address 2, 3, 4, ..., N; A SSD will not store address linearly because storing linearly would be very slow if you write at address 1 then, later, at address 2 because the SSD will have to rewrite data stored at address 1 (this mean to read it, store it in cache, erase address 1 to N (a ssd need to write a whole block of N address each time you write data)), write address 1 & 2. It's slow). That why the SSD will store address 2 'far away' (in the memory space) from address 1. This makes write faster but will make the disk slower when all block will have been used.




So, a tool can't know how data are stored on the SSD and can't decide how to do something like a 'defragmentation'. The only way to do this is to run a program inside the hard drive controllers, use a tool that can ask the SSD to tell him how data are stored and tell him how to move then (using internal memory address and not LBA address) (there is no standard ATA command to do this, do it would mean 1 tool per SSD vendors. I even don't know if it could be possible to use a such proprietary command over the ATA protocol. (WIPER is may be a such tool)) or use the famous TRIM command.



After a time, you get all block of N address with only few address used (because you deleted things, etc..) and it starts to be slow because each time you write data, a block has to be read, erased, write. That why you need to TRIM to get most blocks full of data and new empty blocks.



PS: Just to be clear, this is a very simplified explication. Also in most case you will not only write 1 LBA address of data but many (because file are big), so that you will write X blocks of N address but get the Xth blocks not full filed.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...