1 of 24

CSE 451

Operating Systems

L20 - SSDs and Flash Translation Layer

Slides by: Tom Anderson

Rohan Kadekodi

2 of 24

Main Points

  • Survey of physical storage hardware devices
    • SRAM, DRAM, Flash, magnetic disk
  • File systems
    • Useful abstraction on top of physical devices
  • File system usage patterns
    • Small files and large files are both commonplace

3 of 24

Volatile Memory: SRAM and DRAM

  • Individual word (8 byte) and cache line (64 byte) access
  • Data degrades without power; power proportional to storage capacity
  • Bit density scales with Moore’s Law
  • Static RAM (SRAM)
    • Typical uses: CPU registers, on chip cache, I/O device caches
    • Data stored in a transistor flip/flop
    • Access latency range: 1 – 20ns (smaller caches => faster)
  • Dynamic RAM (DRAM)
    • Typical use: main memory (8GB/chip with DDR5, usually sold as an array of chips)
    • Data stored in a capacitor, 2D/3D array for dense packing
    • Data degrades even when powered; bits need periodic refresh
    • Access latency: 50 - 100 ns
  • Tiered DRAM (CXL)
    • Rack-level extension to server DRAM (cache coherent, PCI)
    • Access latency: 300 ns

4 of 24

Persistent Memory: Flash and Magnetic Disk

  • Block level (4KB) access (or larger); asynchronous request queues
  • Data valid even when unpowered
  • NAND Flash/Solid State Drive (SSD)
    • Bits stored in special silicon gate, densely packed in 2-D or 3-D array
    • 10-50 us block level random read/write
    • Each block can only be written once, but can be erased
    • Limited number of erasures per physical block (10K depending on type)
    • Typical use: smartphones, laptops, servers, data centers
  • Magnetic “hard” disk drive (HDD)
    • Bits stored on magnetic surface: 1.5 Tbit per square inch
    • Physical motion (spinning disk) needed to read bits off surface
    • 10 ms random access latency; 250MB/s max throughput
    • Typical use: data center bulk storage, backup

5 of 24

5

[J. McCallum, jcmit.org]

DRAM

Flash

Disk

6 of 24

Flash Memory

  • Original use cases:
    • BIOS
    • OS Bootloader
    • Device Configuration
  • Updates rare but necessary
    • Fix bugs after product ship
  • Exponential improvement in density over time
    • 500x in 20 years
  • Read/write Latency: �10-50 microseconds

7 of 24

Flash Memory Challenge

  • Writes must be to “clean” cells
    • Erasure required before block can be rewritten
    • Erasure is 20x slower than single block read/write
    • Erasure needs empty guard regions to avoid erasing useful data in nearby blocks
    • Limited number of erasures per physical block (10-35K for MLC, 1K for QLC)

  • Solutions?
    • minimize erasure
    • block translation

8 of 24

Managing Wearout

  • Each flash block can only be written limited number of times
    • Depends on encoding: 1000 (QLC), 10-35K (MLC), 100K (SLC)
  • What if app repeatedly updates the same physical block?
    • 1ms per write/erase cycle
    • Assume 10K write/erase cycles before wearout

Wearout (of one block) in 10 seconds !

Disk keeps getting smaller over time…

=> Can’t allow update in place

9 of 24

Flash Translation Layer (FTL)

  • Disk firmware exports a virtual block interface
    • Read/Write/Trim (block delete)
  • Firmware relocates each virtual block to physical location as needed
    • Overwrite to a previously written block goes to new empty location
    • Reads to the newly written block are redirected to its new location
    • Previous block is stale, unused, ready for erasure (reuse for other block writes)
      • Like putting the block into the trash - device firmware can still read the old data (until erasure)
  • FTL needs a map from virtual block # to physical location
    • Stored in SRAM for fast lookup
    • Written back to SSD on power failure (battery, capacitor)

10 of 24

FTL in Picture Form

Eventually we’ll run out of space…

D C E A D C B A

writes

Translation map

A B C D E F G H

Block storage

1 2 3 4 5 6 7 8

A

1

B

2

C

3

D

4

A

5

E

6

C

7

D

8

crash

read

11 of 24

Erasures

  • Erase many blocks at a time (erasure region)
    • Multi-block erasure region is always erased together at same time
    • Minimizes wasted area/density due to guard regions
      • Guard per multi-block erasure region
    • Prorate time spent erasing over more blocks
  • Device still appears to read/write individual 4KB blocks
    • Number of blocks in erasure region is an internal value, not visible to customers
    • Tens to hundreds 4KB blocks per erasure region
  • What if some of the data in the erasure region is still live?
    • Where do we put that data during the erasure?

12 of 24

Efficient Compaction

write amplification due to compaction

% of disk utilization

Avoid worst-case compaction by reserving unused physical space (20-30%)

13 of 24

Wear Levelling

  • Each block can only be written a maximum number of times
    • FTL tracks # of erase/write cycles for each block
    • Unmap blocks if they can’t hold new data
  • To keep from losing blocks due to wear out
    • Write new data into regions with fewer update cycles
    • Put data that won’t change in blocks that are near the end of their lifetime

14 of 24

SSD Encoding/Error Detection

  • SSDs have different internal bit-level encodings
    • SLC: single level cell (1 bit)
    • MLC: multilevel cell (2 bits, some vendors use MLC to mean 2+)
    • TLC: triple level cell (3 bits)
    • QLC: quadlevel cell (4 bits)
  • SLC: frequently changed data
    • Higher cost, faster writes, more erasure cycles
    • Compete with DRAM
  • QLC: cold data
    • Lower cost, good if data is mostly reads or disk is not heavily used
    • Compete with magnetic disks

15 of 24

Micron 9550 NVMe SSD (TLC)

Capacity

25 TB

Page Size

4 KB

Bandwidth (Sequential Reads)

14 GB/s

Bandwidth (Sequential Writes)

7.6 GB/s (peak)

Random 4KB Reads

2.8M/sec

Random 4KB Writes

.75M/sec

Endurance

10000 erase/write cycles

Latency (read/write)

60us/15us

Interface

NVMe

16 of 24

Error Detection/Correction

  • Data stored with extra space for error correction bits to improve reliability
    • Writing/erasing bits is an electromagnetic process
    • Signal not confined to erasure/guard region
    • Customers expect data you read to be exactly what you wrote
  • Even with error correction
    • uncorrected bit error rate ~ 1/10^17
    • For Micron SSD (previous slide) => 1/day (if bandwidth fully used)
    • Typical hyperscale data center has 100K SSDs

=> In cloud settings, both ECC and application-level validation checks needed

17 of 24

SSD Scaling Bandwidth

18 of 24

Implications of Striping

  • Striping implies blocks written together are spread out over many erasure blocks
  • Even if write in large chunks, will still have high compaction overhead
    • Need giant chunks to avoid compaction
  • Compaction can also cause slowdowns for reads of data in same lane
    • Unpredictable tail latencies
  • Add command to defer compaction temporarily?

19 of 24

Device management overhead

SSD Throughput (MB/s)

SSD prefers large sequential IO

64 MB 128 MB 256 MB 512 MB 1024 MB

1250

1000

750

500

250

0

0.1 0.25 0.5 0.6 0.7 0.8 0.9 1

SSD utilization

SSD Random writes: 5-6x difference in performance

20 of 24

Magnetic Disk

21 of 24

Magnetic Disk Anatomy

22 of 24

Disk Tracks

  • ~ 1 micron wide
    • Wavelength of light is ~ 0.5 micron
    • Resolution of human eye: 50 microns
    • 100K tracks on a typical 2.5” disk
  • Separated by unused guard regions
    • Reduces likelihood neighboring tracks are corrupted during writes
    • Bit level corruption still happens with non-zero chance
  • Track length varies across disk
    • Outside: More sectors per track, higher bandwidth
    • Disk is organized into regions of tracks with same # of sectors/track
    • Only outer half of radius is used
      • Most of the disk area in the outer regions of the disk

23 of 24

Disk Performance

Disk Latency =

Seek Time + Rotation Time + Transfer Time

Seek Time: time to move disk arm over track (1-20ms)

Fine-grained position adjustment necessary for head to “settle”

Head switch time ~ track switch time (on modern disks)

Rotation Time: time to wait for disk to rotate under disk head

Disk rotation: 4 – 15ms (depending on price of disk) On average, only need to wait half a rotation

Transfer Time: time to transfer data onto/off of disk

Disk head transfer rate: 100-250MB/s (5-10 usec/sector)

Host transfer rate dependent on I/O connector (USB, SATA, …)

24 of 24

Western Digital Ultrastar DC HC690

Capacity

32 TB, 7 platters

Spin Speed

7200 RPM

Sustained Transfer Rate

270 MB/s (read), 260 MB/s (write)

Interface Transfer Rate

1.2 GB/s

Seek time (avg)

8 ms (read), 8.6 ms (write)

Rotational latency (avg)

4.16 ms

Cache

512 MB DRAM

Idle/Operating Power

5.8W/9.7W

Bit Error Rate (read)

10^-15