0 XP · 0 scenes

Inside disks: HDD vs SSD

Memory & Storage · lesson 3 of 4 · about 15 min

Inside disks: HDD vs SSD

Why a spinning disk crawls on random reads, why an SSD has to erase before it can rewrite, what IOPS really means, and how to stop paying fast-storage prices for data nobody reads. Tap any for a plain-language card.

0 / 7 sections done
  1. 1The spinning disk: reading is a trip3 min
  2. 2Flash can't overwrite4 min
  3. 3Three numbers: latency, IOPS, throughput2 min
  4. 4Hot, warm and cold tiers2 min
  5. 5Who lives by this1 min
  6. 6Interview angle2 min
  7. 7Break It: the IOPS wall1 min

Words in this lesson13Tap one for its meaning.

The spinning disk

Reading means a trip.

A hard disk is a stack of magnetic platters spinning at 7,200 turns a minute, with an arm that swings across them like a record player. To read a block the arm must travel to the right track () and then wait for the data to rotate underneath.

Read 20 blocks of 4 KB. First in order, so they sit side by side. Then at random places. Compare the stopwatch.

Same drive, same amount of data. Only the changed. Watch the arm.

Blocks read0 / 20
Stopwatch0 ns
Last read cost–
Effective speed–

Choose a pattern and press the button.

Flash has strange rules

An SSD can't overwrite. Only erase.

Inside an SSD, is organised into . You may write to an empty page. But you cannot rewrite a used page. The smallest thing you can erase is a whole block, many pages at once.

So when you update a file, the drive writes the new version somewhere fresh and marks the old one stale. Eventually must copy the survivors out of a block before erasing it. Those extra copies are .

Add files, overwrite them, and watch. Then fill the drive and see what a nearly full SSD does.

Try: Fill to 85%, then press Overwrite ten times. Compare the amplification with a half-empty drive.

Block 1erased ×0
Block 2erased ×0
Block 3erased ×0
Block 4erased ×0
Block 5erased ×0
Block 6erased ×0
valid datastale (old copy)free page
You wrote0 pages
Flash wrote0 pages
Amplification1.00×
Drive full0%

A fresh, empty drive. Add some files.

Three numbers

Fast at what?

“This disk is fast” means nothing until you say which number. There are three, and they are different.

: how long one read takes. : how many separate reads per second. : how many MB per second when reading big blocks.

Below, two jobs run on four devices. One needs lots of tiny random reads (a database). The other reads one huge file in order (a backup, a video). Move the sliders.

The gap between the best and worst device is wildly different for the two jobs. That tells you what to buy.

Job A: a database fetches random 4 KB rows

HDD (7200 rpm)
13.9 minutes
Cloud disk (gp3 baseline)
33.3 s
SATA SSD
1.25 s
NVMe SSD
167 ms

Best vs worst: 5,000× apart

Job B: read one large file from start to finish

HDD (7200 rpm)
55.6 s
Cloud disk (gp3 baseline)
1.3 minutes
SATA SSD
18.9 s
NVMe SSD
2.86 s

Best vs worst: 28× apart

Random reads: 5,000× between the worst and best device. Sequential reads: only 28×. That is why databases (random I/O) moved to SSD first, while archives and streaming (sequential) happily stay on cheap disks. Note the cloud disk: its 3,000 IOPS is a limit you rent, not a hardware property.

Hot, warm, cold

Don't pay SSD prices for data nobody reads.

You store 500 TB of user activity. Recent data is read constantly, old data almost never. That gap is the whole idea of : put each slice where its read pattern justifies the price.

For each slice below, choose a tier. Prices are rough cloud rates per GB per month: SSD $0.08, HDD $0.045, Object $0.023, Archive $0.004. Archive is cheap because retrieval takes hours.

A good design keeps the 5% that gets 80% of reads on fast storage, and pushes the rest outward without letting anything busy hit the archive.

Last 7 days5% of the data, 80% of the reads
Last 3 months15% of the data, 15% of the reads
Older than that80% of the data, 5% of the reads
Monthly bill$40,960
Average read1 ms
vs all SSD100%

Everything on SSD: about $40,960 a month. Fast, but 80% of this data is rarely read. Try moving older slices to cheaper tiers.

Who lives by this

Disks shape whole businesses.

Storage choices decide costs and outages at every scale. Four places where it shows.

Real failure dataBackblaze

250,000+ drives → published failure rates, every quarter

Backblaze, an online backup company, publishes drive statistics for its fleet of hard disks: which models fail, and how often. A rare, honest look at how disks behave at scale.

Own the disksDropbox Magic Pocket

files → Magic Pocket → dense HDD racks

Dropbox moved most of its file storage off Amazon S3 onto a system it built called Magic Pocket, designed around large, cheap hard drives. At that scale, the price of a gigabyte beats the speed of a seek.

Tiering as a productAmazon S3

Standard → Infrequent Access → Glacier → Deep Archive

S3 sells the same bytes at very different prices depending on how fast you need them back. Deep archive costs a tiny fraction of standard but retrieval takes hours. That is hot, warm and cold tiering as a menu.

Speed you rent by the IOPSAWS EBS (gp3)

3,000 IOPS + 125 MB/s included, more costs extra

A cloud disk is not just a size, it is an IOPS and bandwidth allowance. Teams are often surprised when a database on a small volume hits its IOPS ceiling long before it fills the disk.

Interview angle

What interviewers actually ask.

Five questions, each worth 20 XP. They check whether you understand why, not just which drive is faster.

Name the limit: “seek time”, “IOPS ceiling”, “write amplification”. A named limit shows you know the mechanism.

Question 1 / 5

A hard disk can stream 180 MB/s, yet random 4 KB reads give only a fraction of one MB/s. Why?

Tip: press 1 to 3 to answer, Enter for the next one.

Break It

Ramp the traffic until each disk melts.

Your app does random reads against its database. As users arrive, the read rate climbs. Each device can serve only so many . Beyond that, requests queue and latency explodes.

The rate rises on a log scale from 10 to 1,000,000 reads per second. Watch which bar turns red first.

Nothing runs out of space. The disk is almost empty, yet it is useless. Capacity and IOPS are separate limits.

Load now: 10 reads/s
HDD (7200 rpm)120 IOPS

8% busy

Cloud disk (gp3 baseline)3,000 IOPS

0% busy

SATA SSD80,000 IOPS

0% busy

NVMe SSD600,000 IOPS

0% busy

Press the button to ramp the load and see which device gives up first.

Where to go next