Strike the Balance Between SSD Performance and Data Integrity

Jan

Strike the Balance Between SSD Performance and Data Integrity

SSD (Solid State Drive) is gaining more and more traction in these days given its cost reduction over time and its advantages over traditional HDD:

  • High Reliability by avoiding the moving plater part
  • Quick random access by avoid the long header seeking time by HDD
  • Superior performance: faster to start, faster to shut down and faster to transfer data

However SSD also bear some disadvantages, for example, it is not as cost effective as HDD for large capacity storage, wearing out concerns with excessive writes etc.

In order to maximize the SSD performance while ensuring SSD’s data integrity, the followings are a few things to be taken into consideration.

Set Critical SSD Settings Properly

Disk Write Cache

Although SSD offers much improved performance, it still requires substantive and extra amount of time to erase the NAND flash blocks plus the expensive programming operations in writing when compared with SRAM, as a result, a small amount of SRAM is usually added to SSD controller as the disk cache to buffer the data received from the host so that the host’s write operation can be completed much faster by being freed up from waiting for the data is disk write cache to be committed to the media. The SSD firmware can enable or disable the Write Cache based on the host’s request.

Normally, you would want to make sure that SSD’s disk cache is enabled as otherwise it will have significant performance degradation.

Disk Write Cache Flushing

This is a feature built by ATA specification to request the disk to commit the content in Disk Cache to the disk storage media, its intent is to prevent the data loss at power hit. The host can request the disk to flush its write cache by sending either FLUSH_CACHE (E7h) or FLUCH_CACHE_EXT (EAh) command, these commands cause the disk to complete writing data from its cache, and disk will return good status after data in the write cache is written to disk media.

Enabling this option will have great performance degradation, you should avoid to do so in any of the following cases:

  • You don’t care about the data loss at power hit
  • Your file system is power hit tolerant (see the coming sector)
  • Your SSD itself is power hit tolerant (see the coming sector)

Here is where to set Write Cache and its flushing under Windows.

Disk Power Hit Tolerance

Some SSD vendors put a special circuit in their SSDs that monitors the power down situation and provides its own power to write the data in its write cache to the media when the main power supply goes offline. This is the most reliable way to prevent the data loss from the disk perspective, while at the same time, offers the most optimal performance.

File System Cache

Many file system like Windows NTFS file system is designed to work with lower performance disk by supporting file system cache, which allows small disk writes to remain in system RAM (file system cache) until the cache is full or triggered by some other events to be committed to the disk as a batch to reduce the need to frequently access the slow disk. The down side of doing this is the risk of losing the data in file system cache in case of power loss.

If you care about the data loss, you must flush file system cache on every SSD write, the way to flush it could be OS dependent, but fsync () is an API supported by most of operation system to do so.

Be Mindful on The Amount of Writes

The NAND flash substrate in SSD can sustain a finite number of erase cycles before it becomes unusable. The erase process involves hitting the flash cell with a relatively large charge of electrical energy. This causes the semiconductor later on the chip itself to degrade over time and can increase bit error rate. Obviously more writes will result in more flash erasing operation, excessive writes can sometime lead to significant SSD life spin reduction.

If your system needs to write to SSD excessively at run time, you might  need to do characterize the amount of write per day and calculate its actual life expectancy based on its technical specification provided by the vendor.

Keep An Eye on SSD Firmware

SSD firmware controls where and how the data should be written, it also enables the SSD to communicate with the host, it adopts complicated algorithms to perform wear leveling and plays a important role in SSD performance.

The firmware implementation differs from vendor to vendor, some of them can easily cause performance issue or reduced life expectancy, it is recommended to check out their review when you deploy a new SSD.

File System Consideration

Different file system can have different disk write overheads, for example, the transaction file system or power hit tolerant file system like QNX6 can cause up to triple the data writes to the SSD, these extra writes will reduce the SSD’s life expectancy and you might need to replace the SSD much sooner than using a regular file system like QNX4.

You should not consider the power hit tolerant file system with SSD if:

  • You don’t care about the data loss
  • The SSD supports power hit tolerant by itself