The Durability Drill
Stopping servers under 200 checksummed objects and counting what survives
Replication settings are claims. A drill checks them: write data you can
verify, break things on purpose, and count. labs/durability.py writes
200 objects (20 KB to 40 KB each), each with its SHA-256 in its S3
metadata, then checks every one.
Keeping the checksum in each object's metadata matters: the metadata lives in the filer, so the check can still say which objects are unreadable when their bytes are on stopped servers. An earlier version kept all the checksums in one manifest object, and the check crashed whenever that manifest happened to be on a stopped server.
The run
docker compose -f compose_prod.yaml run --rm labs python durability.py write
wrote 200 objects, each with its checksum in metadata
docker stop volume-2
docker compose -f compose_prod.yaml run --rm labs python durability.py check
listed 200: 200 intact, 0 corrupt, 0 unreadable
new 50 KB write during the outage: accepted
docker stop volume-3
docker compose -f compose_prod.yaml run --rm labs python durability.py check
listed 200: 162 intact, 0 corrupt, 38 unreadable (76.6s)
new 50 KB write during the outage: InternalError
docker start volume-2 volume-3
docker compose -f compose_prod.yaml run --rm labs python durability.py check
listed 200: 200 intact, 0 corrupt, 0 unreadable- intact: 200
- intact: 162
- unreadable: 38
- intact: 200
- One server down: everything readable, writes accepted. Exactly what
010promises. - Two servers down: the 38 unreadable objects were in the volume whose
both copies were on
volume-2andvolume-3. The other 162 had at least one copy on a live server. Nothing was corrupt: unavailable isn't the same as lost. - The check took 76.6 s instead of about a second: each failing GET waited on timeouts and SDK retries. In an application, that's a request thread stuck for seconds per object. Set client timeouts.
- Both back: all 200 intact. The data was never lost, only out of reach.
The drill that lied first
The first time this drill ran, two servers were stopped and the check reported 200 intact. That would have been a remarkable result for two copies on four servers. It was wrong.
The labs service had depends_on: [filer], and the filer depended on the
volume servers. docker compose run starts a service's dependencies,
so every check quietly restarted the stopped volume servers before
running. The fix was to remove depends_on from labs (the comment in
compose_prod.yaml explains why).
Two other things can make a drill look better than reality, both seen
while building this one. The S3 gateway's chunk cache
(-s3.cacheCapacityMB) can serve objects that were read recently even
though their volumes are gone. And the master's view of volumes lags a
heartbeat behind. Verify the failure is real (docker ps,
/dir/lookup) before believing a good result, and read objects you
haven't just read.
What would change the numbers
| Change | Two servers down |
|---|---|
Replication 001 (other server, same rack) on 4 servers in 2 racks | Losing one rack loses both copies of some volumes |
Replication 020 (3 copies, 3 racks) | All 200 readable; costs 3× storage |
| Erasure coding 10+4 | Survives any 4 lost shards, if they're spread out (next lesson) |
| More, smaller volume servers | Fewer objects per volume pair, so less unavailable per incident |
Lab
- Run the drill as shown. Which volume held the 38 objects? Use
/dir/lookupon the volume ids of a failing object's chunks. - Re-run the two-server check with
durability.pyusing a client with a 2-second read timeout and no retries. How long does it take now? - Stop
volume-1andvolume-4instead. Is it a different set of objects?