Object Storage and Durability: Why Eleven Nines Is Not Magic
Understand object storage, where files are stored by key in buckets, and compute how replication and erasure coding turn unreliable disks into very durable storage, with exact binomial probabilities checked by a Monte Carlo simulation.
In this lesson you will
- Describe buckets, keys and objects
- Compute loss probability with replicas
- Compare replication with erasure coding
- Check probabilities by simulation
About 28 minutes
Where do the concert posters live?
Wren’s site stores thousands of poster images and PDF tickets. Putting them on the web server’s disk ties them to one machine, so the company uses object storage, the cloud’s basic way of keeping files. An object is a blob of bytes with a name, called its key, and some metadata. Objects live in a bucket, a flat container, and there are no real folders: a key such as posters/2026/rock.png is just a long name, and the slashes are a convention that tools show as folders. You write an object whole, read it by key over HTTP and replace or delete it, but you cannot edit a few bytes in the middle. In exchange you get a service that scales without planning, is cheap per gigabyte and keeps data in several places.
How safe is the data? Providers quote durability, the chance that an object is not lost in a year, often as eleven nines, 99.999999999 percent, which sounds like magic. It comes from arithmetic, not from perfect disks. A single disk may fail with a probability of a few percent a year. If every object is stored on k separate disks, and failures are independent, losing it requires all k to fail before repair, which has the probability p to the power k. Erasure coding is a cleverer way to get the same protection at lower cost: the object is cut into k data pieces, m extra parity pieces are computed from them, and the n = k + m pieces are spread over separate disks; any k of the n pieces are enough to rebuild the object, so it is lost only if more than m pieces are lost. Three full copies cost three times the space; a scheme with 10 data and 4 parity pieces costs only 1.4 times, and tolerates four failures.
| Scheme | Pieces | Space used | Tolerates |
|---|---|---|---|
| 1 copy | 1 | 1.0x | 0 losses |
| 3 copies | 3 | 3.0x | 2 losses |
| Erasure 6+3 | 9 | 1.5x | 3 losses |
| Erasure 10+4 | 14 | 1.4x | 4 losses |
const choose = (n, k) => { let r = 1; for (let i = 1; i <= k; i++) r = r * (n - k + i) / i; return r; };
// probability that more than m of n independent pieces are lost, each lost with probability p before repair
const lossProb = (n, m, p) => { let s = 0; for (let j = m + 1; j <= n; j++) s += choose(n, j) * p ** j * (1 - p) ** (n - j); return s; };
const schemes = [['1 copy', 1, 0], ['2 copies', 2, 1], ['3 copies', 3, 2], ['erasure 6+3', 9, 3], ['erasure 10+4', 14, 4]];
const p = 0.01; // invented: chance that a piece is lost before it can be rebuilt
const rows = schemes.map(([name, n, m]) => { const k = n - m, q = lossProb(n, m, p); return { name, n, m, overhead: n / k, q }; });
for (const r of rows) console.log(r.name.padEnd(14), 'pieces', String(r.n).padStart(2), 'overhead', r.overhead.toFixed(2) + 'x', ' P(object lost) =', r.q.toExponential(3));
const hi = 0.1; // a bad scenario, used to test the formula by simulation
console.log('stress case p = 0.1, erasure 6+3:', lossProb(9, 3, hi).toFixed(6), '| 3 copies:', lossProb(3, 2, hi).toFixed(6));
console.log('DATA ' + JSON.stringify({ rows, s63: lossProb(9, 3, hi), s3: lossProb(3, 2, hi) }));
1 copy pieces 1 overhead 1.00x P(object lost) = 1.000e-2
2 copies pieces 2 overhead 2.00x P(object lost) = 1.000e-4
3 copies pieces 3 overhead 3.00x P(object lost) = 1.000e-6
erasure 6+3 pieces 9 overhead 1.50x P(object lost) = 1.210e-6
erasure 10+4 pieces 14 overhead 1.40x P(object lost) = 1.857e-7
stress case p = 0.1, erasure 6+3: 0.008331 | 3 copies: 0.001000
The program computes, for five schemes, the exact probability that more than m of the n pieces are lost, using the binomial distribution, with an invented loss probability of 1 percent per piece before it can be rebuilt. One copy is lost with probability 1.00e-02, two copies with 1.00e-04 and three copies with 1.00e-06. Each extra copy multiplies the chance of loss by about the failure probability, a factor of a hundred here. The erasure code 6+3 uses 1.5 times the space and gives 1.21e-06, and 10+4, at 1.4 times the space, gives 1.86e-07. Compare it with three copies: the 10+4 scheme uses less than half of the space and is safer by a large factor in this model, which is why large storage systems use erasure coding for data that is rarely read.
Why not use it for everything? Rebuilding a lost piece or reading an object with erasure coding needs several pieces and some computation, so the delay is larger and small objects are inefficient, and replication is simple and fast. The numbers are also a model: the probability depends on how quickly a lost piece is rebuilt, since a second loss in the same period is what matters, and on whether failures are independent. Disks in one rack, bought together and powered by one supply can fail together, so the pieces must be placed in different racks and different availability zones. Durability also says nothing about availability: data can be safe yet unreachable for an hour during an outage, which is the subject of lesson 7. And durability does not protect against your own mistakes, because a deleted or overwritten object is gone, and the provider’s copies faithfully copy the deletion. Versioning and backups, in a separate account, protect against that.
Independent check: the exact probabilities were recomputed in Python with math.comb and agree with the JavaScript values to a relative error below 1e-15. The formula was also tested by simulation in a stress case with a loss probability of 10 percent, where events are common enough to count: two million random trials gave 0.00837 for 6+3 against the formula’s 0.00833, and 0.00100 for three copies against 0.00100, as the formula predicts within the noise. The loss probabilities of 1e-6 and below in the table are far too small to see in a simulation, which is why the exact formula matters, and why it was validated where the simulation can see the events.
Check by hand for three copies with p = 0.1: with all of them needed to be lost, the object is lost only if all 3 pieces are lost, which has the probability 0.1 x 0.1 x 0.1 = 0.001. With p = 0.01 it is 0.000001, which is 1e-6. For two copies the same reasoning gives p squared, 0.0001, so each extra copy multiplies the risk by p.
Eleven nines protects against disk failure and not against deletion, overwriting, a leaked key or a malicious script. Turn on versioning, and keep a separate copy under different credentials.
Block public access at the account level, and make a bucket public only deliberately. Most storage leaks are configuration errors, not attacks on the provider.
No cloud account is needed for this course. The cloud services in these lessons are small simulations that run on your own computer, in Python 3.13 or Node.js 22, because the ideas, such as access policies, queues, autoscaling and templates, are the same at every provider. Prices and names are invented or generic, and each provider’s services and prices change often, so check the current documentation of the provider you use. Every result was checked a second way. Quoted durability figures and storage classes differ by provider and change. Read the current service description.
Practice
Compute the loss probability of 8+2 and compare it with 3 copies. Change p to 0.05 and see which scheme degrades fastest. Explain in one paragraph why replicas in one rack are not independent.
Check what you learned
Five quick questions. Pick an answer and you will see straight away whether it is right and why.
What is an object key?
- A password
- The name that identifies an object in a bucket
- A disk
- A region
Slashes are only a naming convention.
How is an object updated in object storage?
- It is replaced whole
- Bytes are edited in place
- Lines are appended
- It cannot change
Write whole objects.
With three copies in a scheme that tolerates two losses, when is the object lost?
- When all three copies are lost
- When any one copy is lost
- When no copy is lost
- Never
Three copies tolerate two losses.
Why is erasure coding cheaper than copies?
- It uses fewer disks failing
- It is faster
- It needs no disks
- Parity pieces give protection with less extra space
1.4x versus 3x.
Does durability protect against accidental deletion?
- Yes always
- Only for small files
- Only for spot
- No, use versioning and backups
Copies copy the mistake.
Summary
- Object storage keeps whole objects by key in buckets.
- Replication and erasure coding turn unreliable disks into durable storage.
- Loss probability is a binomial tail; erasure coding uses less space.
- Durability does not replace backups or access control.
Questions
What is the difference between durability and availability?
Durability is the chance that data survives, availability is the chance that you can reach it right now. Data can be safe and temporarily unreachable.
Can I mount a bucket as a disk?
Some tools do it, but object storage has different performance and consistency than a disk, so it suits files you read and write whole, not a database.
What is a lifecycle rule?
A rule that moves old objects to cheaper storage or deletes them after a number of days, which keeps costs down automatically.
