S444 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S4 · Lesson 44 · Storage and I/O

Disks and SSDs, access time and IOPS, Little's law and the M/M/1 queue

Storage is where computers wait longest: a random read from a hard disk takes about ten million cycles, and even a flash SSD takes tens of thousands. Its performance is measured in operations per second and in response time, and response time depends on far more than the device's speed: as requests arrive faster, they queue, and the wait grows without bound as the device approaches full utilization. Queueing theory, starting from Little's law and the M/M/1 model, explains why storage and network systems are run well below 100% busy, and why averages hide the latency users actually feel.

  • Mean response time of an M/M/1 queue (random arrivals, one server with random service times) in units of the service time S, against utilization ρ: TS=11−ρ.
  • At 50% utilization a request takes twice its service time; at 90%, ten times; near 100%, the queue grows without bound.
  • The dashed curve is the average number of requests in the system, ρ1−ρ (Little's law: arrival rate × response time).

Predict

A disk serves a request in 10 ms on average, and requests arrive at random, 90 a second. What's the average response time?

Name it

Devices

  • Hard disk: access time = seek + rotational latency + transfer + controller overhead. Average rotational latency is half a revolution, 0.5×60RPM s. Random small reads are dominated by seek and rotation (about a hundred per second); sequential transfers run at hundreds of MB/s.
  • Flash SSD: reads in tens of microseconds; writes go to erased pages, and erasure works on whole blocks, so the drive remaps writes and garbage-collects. Write amplification (physical writes ÷ host writes) wears the cells, each good for a limited number of program/erase cycles. Lifetime ≈ capacity × P/E cycles ÷ (daily host writes × write amplification).
  • IOPS = 1 / access time for a device serving one request at a time; parallel devices (SSDs, arrays) serve several.

Queueing

  • Little's law (any stable system): L=λT, the average number in the system equals arrival rate × average time in it.
  • Utilization ρ=λS for arrival rate λ and mean service time S.
  • M/M/1 (Poisson arrivals, exponential service, one server):
T=S1−ρ,Tqueue=Sρ1−ρ,L=ρ1−ρ
  • To keep the mean response time below a target T: λ≤1−S/TS.

Worked example

A 7200 RPM disk has an 8 ms average seek and transfers at 200 MB/s. How long does a random 4 KB read take, and how many can it do per second?

Show the solution
  1. Rotation. Half a revolution at 7200 RPM takes 4.17 ms.
  2. Transfer. 4KB/200MB/s=0.02ms
  3. Access time. 8+4.17+0.02≈12.2ms so about 82 random reads per second.
  4. Compare with streaming. Sequentially it could stream 200 MB/s, 50,000 4 KB blocks a second. Disk performance depends almost entirely on the access pattern.

Answer a random 4 KB read takes about 12.2 ms, so the disk does about 82 per second.

Worked example

An SSD holds 1 TB, its cells tolerate 600 program/erase cycles, write amplification is 3, and the host writes 100 GB a day. How long does it last? And for the 10 ms disk, what arrival rate keeps the mean response under 25 ms?

Show the solution
  1. SSD lifetime. 1000GB×600100GB×3=2000days about 5.5 years.
  2. Disk arrival rate. λ≤1−10/250.010s=60requests/s which is 60% utilization.

Answer the SSD lasts about 2000 days (5.5 years), and the disk must see at most 60 requests a second.

Worked example

A disk serves requests in 10 ms each. What response time does an M/M/1 model predict at 60 and at 90 requests a second?

Show the solution
  1. At 60 a second. Here ρ=0.6: T=10/(1−0.6)=25ms with 1.5 requests in the system on average.
  2. At 90 a second. Here ρ=0.9: T=10/(1−0.9)=100ms
  3. The lesson. Adding 50% more load quadrupled the response time, which is why storage systems are run well below full utilization.

Answer 25 ms at 60 requests a second and 100 ms at 90.

Check

What's the average rotational latency of a 7200 RPM disk?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

Check

A disk has an 8 ms average seek, spins at 7200 RPM and transfers 250 MB/s. How long does a random 64 KB read take, ignoring controller overhead?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

Check

Requests arrive at random, 20 per second, at a device whose mean service time is 5 ms. What's the mean response time by the M/M/1 model?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

Check

Requests arrive at 200 per second and each spends 5 ms in the system on average. How many are in the system on average?

Check

A device's mean service time is 4 ms. What's the highest arrival rate, per second, that keeps the M/M/1 mean response time at 10 ms?

Check

An SSD of 2 TB has cells rated for 600 program/erase cycles and a write amplification of 4. The host writes 200 GB a day. How many years does it last?

Check

A disk spins at 7200 RPM, seeks in 4 ms on average and transfers at 250 MB/s.

(a)

How long does a random 4 KB read take?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

(b)

How many can it do per second?

Check

A server takes 5 ms per request, and requests arrive at 20 per second (M/M/1).

(a)

What is its utilization?

(b)

What is the mean response time?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

(c)

How many requests are in the system on average?

Check

An SSD of C GB endures P program/erase cycles with write amplification w; the host writes h GB a day.

Step 1

How many gigabytes can be written to the flash in its life?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why do storage systems run far below full utilization, when a busier device does more work?

Practice

Keep practicing

11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.