A key advantage of SSDs over HDDs is performance. HDDs are mechanical devices that are limited by the restrictions imposed by the necessity of moving a mechanical head over magnetic platter and stopping it in a specific position. While SSDs leverage the speed of logical circuits and firmware. Although SSD performance is effected by everything that is done to it. SSD performance is different for read or write operations, different for random or sequential operations and different for large and small IO sizes. Also the performance of an SSD will change significantly depending on how full of data the SSD is. In addition, the performance of an SSD is effected by the manner in which the previous data was written to the SSD. In addition to slower flash writing, the SSD controller may have to perform garbage collection before performing a write, slowing it down further. The garbage collection would not occur when the SSD is fresh, but after writing the entire SSD once, garbage collection is required to write. This mean’s the when the SSD is fresh, it will perform best, but to really determine performance one can expect in a given application the SSD must be filled with data once.
The SSD performance table below, excerpted from an SSD datasheet, shows the performance for a variety of read and write scenarios. The numbers on the datasheet are often “hero” numbers, showing the performance in near perfect conditions using the optimal read and write “chunk” sizes, which are highly unlikely to match your use case. The sequential read and write are always going to be faster than their random counterparts. The numbers labeled “Sequential Read/Write” don’t tell you the size of the IO measured. The size of these sequential operations may be very large (could be 16MB at time) and may only be seen in the real world when the system is first loading a large application into memory for execution. The “Max 4K Read/Write performance” shows an interesting number, expressed in Input/Output Operations Per Second (IOPS) and specifies the size of 4KB. This may be a far cry from what you see in your application as the OS will likely group sequential 4 KB I/Os into larger chunks and when that happens the operations per second will slow. The “Random 4 KB Read/Write” shows what might be more typical for many applications. There are people who say “all data access is random”, so for them, this is the ONLY number that matters. The 4K bytes IO size is chosen as Linux and other modern operating systems usually access the disk data in 4K byte blocks, not the 512-byte block still supported by many disks.
Real World Performance
A brand new SSD delivers the best performance immediately after it was formatted, when all of the flash cells are in the “erased” state. This performance can continue until the SSD has been filled completely with data once, since it does not have to perform garbage collection or any erases (and remember, erases are an order of magnitude slower than writes) until this time. After the SSD has been fully written once (even if files have been deleted), then garbage collection must occur prior to writing additional data. This fresh state of an SSD is called Fresh-Out-of-Box (FOB) or First-Drive-Write (FDW). After the FDW, all successive writes require garbage collection and erasing the flash memory. One term for post-FDW use is Successive-Drive-Writes (SDW) or Follow-on Drive Write (XDW). SSD can be returned to FOB state by reformatting the it, which discards all blocks of flash memory. Many flash disks do perform garbage collection in the background to improve the performance of the SSD.
After the FDW, SSD performance will be affected by the amount of data stored on the disk. Today’s SSDs have a TRIM-style command that enables the file system to tell the disk that unallocated data no longer needs to be managed by the SSD, exempting those pages from being dragged along on a garbage collection. A TRIM command for the entire disk, should bring the SSD back to a FOB state and performance will improve as well – of course, this presumes you no longer need any of the data. The first full drive write will deliver the best performance (as no garbage collection is required to write), and the second time the drive is written the performance will be significantly slower. But regardless, the amount of live data on an SSD will affect the performance and the flash wear of that SSD. An SSD with 10% live data will perform better than that same SSD with 50% or 90% of live data.