Object Storage: Scope
"Effectively never" is not something anyone can build to, and the first ten minutes exist to replace it with a number. The rest of those minutes go to how much is stored, counted in bytes and again in objects, because the two counts break different parts of the store.
Six Questions, Never First
Each of these six changes what you draw. Keep the agreed answers in view, because every later sum starts from them.
- What does never lose mean as a number? A target turns an adjective into arithmetic, and the arithmetic picks the storage scheme. Agreed: under one object a year lost, across everything stored.
- How much data, how many objects, and what sizes? Count and bytes break different parts. Agreed: a billion puts a day at a mean of 200 kilobytes, kept three years, with most objects small and most bytes in large ones.
- How large is any size? The largest object sets the upload path. Agreed: up to 50 terabytes, as a major store allows.
- Can an object change in place? A no removes most of the hard problems of a storage node. Agreed: objects are written whole and replaced whole.
- What does a reader see right after a write? The answer sets what the metadata must promise. Agreed: a read after a confirmed put sees that put.
- One region or many? The bill follows the answer, and so do the failure domains, the sets of machines one event can take out together. Agreed: one region with several zones, and assume three.
The first question is the one to say in full: "'Never lose' isn't something I can design for. Can we call it under one object a year across everything stored? Then I can work out whether three copies gets us there."
What You Agree On
The functional list is short: put, get and delete an object by bucket and key, list keys by prefix, and upload very large objects. Listing is not in the question. You add it yourself, because it decides how the metadata is sorted.
Three promises sit beside that. A confirmed put is not lost, to the target above. The store is available 99.99 percent of the time, about 4.4 minutes down a month, and that is a separate promise, since an object can be safe and briefly out of reach. And cost per stored byte is a design goal, so every change on the board gets a price.
Then rule things out by name: access policies and accounts, billing, cross-region replication, storage classes for rarely read data, and a CDN in front. Each one is a product of its own, and the interviewer can pull any of them back in now, before it costs you a redraw.
The Sums That Pick the Scheme
Requests come first. A billion puts a day, over about 100,000 seconds, is 10,000 a second, and 20,000 at peak. Assume five reads per put. That is 50,000 reads a second, and 100,000 at peak.
Bytes are the number that picks the storage scheme. A billion objects at 200 kilobytes is 200 terabytes a day. That is about 73 petabytes a year, and about 220 petabytes in three years.
Now turn the bytes into disks. Three copies of 220 petabytes is 660 petabytes. Assume 20 terabytes a disk, and that is 33,000 disks. At about 1.5 percent a year, about 500 of them fail every year, which is about ten a week. So a failed disk is routine here, never an incident, and the design treats it as ordinary load.
Those disks are barely busy. A hundred thousand reads a second over 33,000 disks is about 3 a second each, against about 170 a drive can do. The disks are bought for capacity, so hard disks are the right ones.
Count objects next, because they tell a different story. A billion a day for three years is about 1.1 trillion. Assume 500 bytes a row, and the metadata is 550 terabytes. That is a quarter of a percent of the bytes, and it wants a different kind of machine. Assume 2 terabytes a node. That is 275 partitions, and 825 nodes with three copies each, a count the durability sum comes back to.
Requests ask for far fewer. Take the limit a major store publishes per key prefix, the start of a key, as one partition's limit: 3,500 writes and 5,500 reads a second. Twenty thousand writes need 6 partitions, and 100,000 reads need 19. Even at half those limits, that is 12 and 37. So size decides the count, the check in Chapter 3's When One Machine Is Not Enough. And 275 is a floor, since it fills every node to the brim.
Bandwidth you say once and drop. A hundred thousand reads a second at 200 kilobytes is 20 gigabytes a second out at peak, under two 100-gigabit links, and no box moves for it.
API and Entities
Four calls cover the everyday work. A PUT on a bucket and key stores the object and answers once it is safe. A GET on the same path returns it. A DELETE removes it. A GET on the bucket with a prefix returns keys in order, one page at a time, each page starting after the last key of the one before. The large upload needs calls of its own, and they are easier to argue once a probe has forced them, so tell the interviewer they are coming.
PUT /{bucket}/{key} 200 once the object is safe
GET /{bucket}/{key} 200 with the bytes
DELETE /{bucket}/{key} 204
GET /{bucket}?prefix=photos/&after=photos/a.jpg
200 with one page of keys, in order
There are two entities. A bucket has a name and an owner. An object has a bucket, a key, a size, a checksum, which is a short fingerprint that shows whether the bytes have changed, and where its bytes are. Every call but the list goes by bucket and key, and the list needs those keys in order. That is the reason a later split runs by range and not by hash.
- Accepting never lose as an adjective. The durability sum later has no target to hit.
- Sizing only the bytes. The object count is what breaks the metadata and the file system, and the third push is about it.
- Treating availability and durability as one number. The interviewer asks what a rack outage loses, and the answer should be nothing, for a while.
- Never lose turned into a number before anything is drawn.
- Ten disk failures a week reached out loud, then treated as ordinary load from then on.
- 220 petabytes of bytes separated from 550 terabytes of rows, with a statement that they want different machines.
Knowledge Check
You have time for one question before you draw. Which answer changes this store the most?
- Which naming rules each bucket and each key have to follow
- What never lose means, as objects lost a year across the store
- Which access policy language the accounts will need to support
- Whether objects are mostly read by browsers or by other servers
Your sum reaches about ten disk failures a week. What does that number mean for the design?
- This batch of disks is bad, and another vendor should supply them
- Each failure should page an engineer, who starts the repair by hand
- A failed disk is ordinary load, so repair runs all of the time
- The store needs solid-state disks, which should fail far less often
Which signal decides how many partitions the metadata needs?
- Peak reads: 100,000 a second at 5,500 each is 19 partitions
- Peak writes: 20,000 a second at 3,500 each is 6 partitions
- Stored bytes: 220 PB at 20 TB a disk is 11,000 partitions
- Size: 550 TB of rows at 2 TB a node is 275 partitions
The interviewer agrees that objects are written whole and replaced whole. What does that remove?
- Writes inside an object, and copies that disagree about them
- The need for a checksum, since the stored bytes never change
- The key table, since a path never changes once it is written
- Repair after a failure, since no copy can ever fall behind
You got correct