How does an SSD work simple?

SSDs, or solid-state drives, are a type of storage device that uses flash memory to store data. Unlike traditional hard disk drives (HDDs) that use spinning magnetic disks, SSDs have no moving parts and data is stored on integrated circuit chips. This allows SSDs to operate silently, have faster access times, better durability and shock resistance compared to HDDs.

What is flash memory?

Flash memory is a type of electronically erasable programmable read-only memory (EEPROM) that can be electronically erased and reprogrammed. It is non-volatile, meaning it retains data even when power is removed. Flash memory cells are made from floating-gate transistors that can store one or more bits per cell. Data is stored by trapping electrons on the floating gate, which changes the threshold voltage required to determine the data value stored. Flash memory is arranged in blocks which are further divided into pages. Reads and writes are performed page-by-page while erases can only be done block-by-block.

How does an SSD access data?

There are a few key components inside an SSD that allow it to read and write data:

  • Controller – The controller manages all operations of the SSD. It has a processor, cache and firmware that handles commands from the host computer.
  • NAND flash memory – Stores the actual data on the SSD. Arranged in blocks and pages.
  • DRAM cache – Provides faster access than NAND. Frequently accessed data is cached here.
  • Flash translation layer (FTL) – Part of the firmware that maps logical block addresses from the host to physical pages and blocks on the NAND flash.

When the host computer needs to access data on the SSD, it will send a read or write command along with a logical block address (LBA). The controller will check if the data is available in the DRAM cache first before accessing the NAND. The FTL maps the LBA to the physical location in NAND. Data is read or written in page sizes, typically 4-16KB. The controller handles things like wear leveling, bad block management, error correction to ensure data integrity.

Why are SSDs faster than HDDs?

SSDs can achieve much faster read and write speeds compared to HDDs for a few key reasons:

  • No moving parts – SSDs have no platters, heads or actuators that need to physically move to access data. This eliminates seek time and latency.
  • Lower access times – NAND flash memory has microsecond latency compared to milliseconds for HDDs.
  • Parallelism – SSDs can read and write to multiple NAND dies or channels simultaneously.
  • Faster interface – SSDs typically use SATA 3.0 and PCIe interfaces that have higher bandwidth than older HDD interfaces.
  • Lower overhead – No time is lost for things like error correction, bad block management that HDDs need.

Typical SATA SSDs can have sequential read/write speeds over 500MB/s compared to <200MB/s on HDDs. Random access speeds are even faster on SSDs due to minimal latency. This results in faster boot times and application/file loading.

What is the structure of NAND flash memory?

NAND flash memory is organized in a hierarchical structure:

  • Die – The smallest unit of physical NAND. Contains one or more planes.
  • Plane – A vertical block of memory cells. Used to improve performance by accessing data simultaneously.
  • Block – Made up of pages. Smallest unit that can be erased.
  • Page – Smallest unit that can be programmed or read. Typically 4-16KB in size.

Each page is further divided into sectors and spare areas. The sectors store the user data while spare areas have metadata like error correcting codes (ECC) and block status information. Pages make up blocks, usually 64-256 pages per block. Blocks are then packaged inside flash dies and chips to build up storage capacity.

What is wear leveling?

Wear leveling is a technique used in SSDs to prolong the life of the NAND flash memory. Because NAND can only endure a limited number of erase cycles before failing, wear leveling aims to evenly distribute writes across all blocks in the SSD to avoid premature failure of frequently erased blocks.

The SSD controller keeps track of the erase count for each block. When data needs to be written, the controller will look for blocks with the lowest erase counts and allocate them for writing. This helps evenly spread out the wear over time. Wear leveling helps maximize the write endurance and lifetime of SSDs.

How does the TRIM command work?

The TRIM command allows the operating system to notify the SSD which blocks of data are no longer in use and can be erased. This is important for SSDs because of how the FTL works. When a file is deleted, the OS simply removes the file reference and marks the blocks as free space. The actual data remains intact in the blocks. This can slow down write performance over time as these blocks with stale data are overwritten. With TRIM, the OS will inform the SSD which blocks are no longer needed so the SSD can preemptively erase them and reuse them for future writes. This restores the write performance of the SSD.

What is garbage collection in SSDs?

Garbage collection is a background process run periodically in SSDs to cleanup blocks containing stale data. As users delete files and overwrite existing data, many pages end up containing a mix of valid and invalid pages. Garbage collection will copy the valid data from these partially filled blocks to new blocks, erase the original blocks, and make them available for new writes. This ensures large free blocks are always available to maintain write performance.

Garbage collection also helps with wear leveling by identifying the least worn blocks to copy valid data into. It runs automatically in the background but can also be triggered if the SSD is running low on free erased blocks.

What is over-provisioning and how does it help?

Over-provisioning refers to the inclusion of extra NAND flash capacity beyond the advertised capacity of an SSD. For example, a 120GB SSD may actually contain 128GB of physical NAND. That 8GB of extra space provides headroom for activities like wear leveling, garbage collection, and replacement of bad blocks. Without over-provisioning, these background activities would count towards writes against the user capacity which can degrade performance over time. Over-provisioning allows these maintenance tasks to happen invisibly in the background without impacting users.

What are the benefits of SSD caching?

SSD caching involves using a small low latency SSD in front of a larger high capacity HDD. The SSD acts as a cache to store frequently accessed data for faster access while rarely accessed data stays on the HDD. Some of the benefits of SSD caching include:

  • Faster read and write speeds for cached data
  • Improved boot and application load times
  • Good performance at a lower cost compared to full SSD storage
  • Retains high capacities of HDDs for bulk storage
  • Cache learns which data to store based on access patterns

SSD caching provides a cost-effective way to boost storage performance without needing to replace HDDs entirely with SSDs.

What are the main differences between SLC, MLC and TLC NAND?

NAND Type Bits per cell Durability Cost
SLC (single-level cell) 1 100k writes High
MLC (multi-level cell) 2 10k writes Moderate
TLC (triple-level cell) 3 1k writes Low

As the table shows:

  • SLC stores 1 bit per cell allowing for faster writes and higher endurance
  • MLC stores 2 bits per cell sacrificing some speed and endurance for lower cost
  • TLC stores 3 bits per cell with slower writes but lowest cost per GB

Most consumer SSDs now use TLC NAND while data center and industrial SSDs may use MLC or SLC NAND.

What are the benefits of NVMe over SATA for SSDs?

NVMe or Non-Volatile Memory Express is a protocol designed specifically for interfacing with high speed SSDs attached via PCI Express. NVMe provides several advantages over the older SATA interface:

  • Higher bandwidth – NVMe operates over PCIe 3.0 x4 or higher that offers bandwidth up to 4GB/s, compared to 600MB/s max on SATA.
  • Lower latency – The streamlined NVMe command set reduces latency for I/O operations.
  • More queues – Supports up to 65,535 I/O queues compared to 1 queue for SATA, enabling more parallelism.
  • Efficiency – NVMe has less protocol overhead allowing more of the bandwidth to be used for data.

For these reasons, NVMe SSDs are significantly faster, achieving sequential reads up to 3500MB/s and writes over 2500MB/s. NVMe is the interface of choice for high performance SSD storage.

Conclusion

SSDs leverage the fast access times and parallelism of NAND flash memory to deliver much higher performance than traditional hard drives. Key technologies like wear leveling, TRIM, and overprovisioning help SSDs overcome the limitations of NAND to provide fast, consistent performance and long endurance. NVMe SSDs attached via PCIe provide the fastest storage option taking full advantage of the low latency and internal parallelism of SSDs. SSDs enable new levels of speed and responsiveness for computers and are increasingly becoming the default storage choice.