Learn
Lesson · Storage Engines and Indexes · Filters and the trade-off

The RUM Trade-off

Read amplification, update amplification and memory amplification cannot all be minimised at once. Levelled trees, tiered trees and B-trees sit at three corners of the same triangle, each best at something and paying for it somewhere else — and the disk bandwidth an engine needs is the ingest rate multiplied by its update amplification, which is never the ingest rate.

read × update × memory — choose two, and pay in the third engine read update memory disk write at 50 MB/s in levelled LSM 5 25 11/10 1.25 GB/s tiered LSM 50 5 10 250.00 MB/s B-tree 4 125/4 3/2 1.56 GB/s compaction bandwidth = ingest × update amplification
Three engines, one triangle, and the bandwidth each corner implies

Core ideas

What this lesson establishes

Three ratios that describe any storage engine, and the observation that pushing any one of them down pushes another up.

1

Three amplifications describe an engine

Read amplification is the storage reads one logical lookup performs. Update amplification is the bytes written per byte ingested. Memory amplification is the bytes stored per byte of unique data. Every engine has all three, all three are ratios, and a design is a choice about which of them to make small.

2

Each shape's strength causes its weakness

A tiered tree writes each byte only 5 times, the least of the three, and pays by probing 50 runs on a lookup and keeping 10 copies of a key. A levelled tree buys the reads back to 5 and writes 25. A B-tree reads in 4 and writes 31.25 bytes to change one row. The connection is causal rather than coincidental: merging less means keeping more, and keeping more means searching more.

3

The bandwidth a device needs is ingest × update amplification

At 50 MB/s of ingest the three engines demand 1.25 GB/s, 250.00 MB/s and 1.56 GB/s of sustained write bandwidth. None of those is 50 MB/s. Sizing the disk to what the application hands the engine is the misconception this page exists to kill, and it is off by between five and thirty-one times.

The material

Three amplifications, three engines, one triangle

What each shape is best at, what it pays for it, and how much disk bandwidth each one actually needs.

Definition · Read, update and memory amplification

For a storage engine, read amplification RA is the number of storage reads a logical lookup performs; update amplification UA is the bytes written to storage per byte ingested; memory amplification MA is the bytes occupied per byte of unique data.

The RUM conjecture is that no engine minimises all three: a design that is best in one is, in general, worse in at least one other.

Memory amplification is a measure of space, not of RAM. A tiered tree with MA = 10 is keeping ten copies of a key on disk while it waits to merge them, and that is ten times the storage bill for the same unique data. The word is historical and it costs people an argument every time.

F = 10 L = 5 ingest 50 MB/s 4 kB pages, 128 B rows, ⅔ fill engine read update memory bandwidth at 50 MB/s levelled LSM 5 25 11/10 1.25 GB/s tiered LSM 50 5 10 250.00 MB/s B-tree 4 125/4 = 31.25 3/2 1.56 GB/s levelled RA = L UA = L·F/2 MA = 1 + 1/F tiered RA = L·F UA = L MA = F B-tree RA = height UA = page/row MA = 1/fill

The two LSM rows are the same tree with two compaction policies. A levelled tree merges each incoming run into the level below immediately, so each level holds one sorted run and a lookup probes L of them — at the cost of rewriting F/2 bytes per byte per level. A tiered tree lets runs accumulate and merges F of them at once, so it writes each byte once per level and a lookup has F runs to search on every level. RA and UA swap places almost exactly.

Example · Where a B-tree's triple comes from

Nothing in the B-tree row is a table lookup. Its read amplification is the height — 4, from a billion keys at a fanout of 500, by the integer search of “The Height of a B-tree”. Its update amplification is page over row: writing a whole 4 000 B page to change a 128 B row is 4 000/128 = 31.25. Its memory amplification is one over the fill factor: pages kept about two-thirds full occupy 1/(2/3) = 3/2 times the space of the rows in them.

The bandwidth question

Compaction bandwidth is ingest × UA, and it is the number a device is chosen against. At 50 MB/s the levelled tree needs 1.25 GB/s, the B-tree 1.56 GB/s and the tiered tree 250.00 MB/s. The tiered engine is the only one of the three that a modest device can feed, and it is also the one that will probe fifty runs to answer a lookup. That is the trade stated in the two units that matter.

So the way to use the triangle is not to rank the corners. It is to name the amplification your workload cannot afford and then read what the other two cost. A write-heavy ingest pipeline that is queried rarely can live at the tiered corner. A point-lookup service on expensive storage cannot afford MA = 10 and will not go there. A workload with both constraints is a workload that needs two engines.

What the triple does not include: compression, which moves MA and nothing else; a block cache, which moves the observed RA without moving the engine's; and any constant factor at all. These are ratios, so they compare shapes rather than products, and an implementation can be a factor of two better or worse than its shape at every corner.

Interactive

The RUM trade-off, as three points on one triangle

Read, update and memory amplification, computed for three engine shapes

Three corners, and no engine at the centreRead, update and memory amplification cannot all be minimised at once
levelled LSMtiered LSMB-treethe corner each pays in

Method

Placing a workload on the triangle

The engine is chosen last. The first three steps are about the workload and the device.

1

Write down what the workload demands, in the same three units

How many lookups a second and how many of them miss; how many bytes a second arrive; how much storage you are willing to buy. Those are the read, update and memory sides, stated before any engine is named.

2

Compute each engine's triple from its own parameters

L and F give both LSM rows. The page size, the row size and the fill factor give the B-tree's update and memory amplification, and its height gives its read amplification.

3

Multiply every update amplification by the ingest rate

That is the sustained write bandwidth each engine requires. Compare the three numbers against the device you actually have, and some corners will disappear before you have chosen anything.

4

Name the corner you are paying in and check you can afford it

Every engine is expensive somewhere. The decision is finished when you can say which amplification you are paying and what it costs in the unit it is measured in — probes, bytes a second, or terabytes.

Corners, and what each one costs

Score 0 / 0

Three engines at F = 10, L = 5, ingesting 50 MB/s

Same parameters, three shapes, and then the one column that turns the comparison into a hardware decision.

F = 10 L = 5 ingest 50 MB/s 4 kB pages 128 B rows ⅔ fill N = 10⁹, B = 500 levelled LSM read L = 5 update L · F/2 = 25 memory 1 + 1/F = 11/10 = 1.1 bandwidth 25 × 50 MB/s = 1.25 GB/s tiered LSM read L · F = 50 update L = 5 memory F = 10 bandwidth 5 × 50 MB/s = 250.00 MB/s B-tree read height at N = 10⁹, B = 500 = 4 update 4 000 / 128 = 125/4 = 31.25 memory 1 / (2/3) = 3/2 = 1.5 bandwidth 31.25 × 50 MB/s = 1.56 GB/s

Read down each block and then across. Every engine is best at something: the tiered tree writes the least, the B-tree reads the least, the levelled tree stores the least. Every engine is worst at something too, and the worst figure is always the direct consequence of the best one.

None of the three bandwidth figures is 50 MB/s. That is the misconception the page is built around, and it is the most expensive arithmetic error in this course: a device chosen against the ingest rate is short by a factor of between five and thirty-one, and the failure arrives weeks later as compaction debt rather than immediately as an error.

For a faded rehearsal, drop the fanout to 4 and keep five levels. The supplied first move is that the levelled update amplification falls to 10. Compute all three triples at F = 4, say which engine moved most and which did not move at all, and then compute the three bandwidths at the same 50 MB/s. Check them in the lab before opening the quiz.

Common mistakes

1
Sizing a device to the ingest rateThe device sees ingest × UA. At 50 MB/s into a levelled tree that is 1.25 GB/s, and into a B-tree 1.56 GB/s. The engine does not fail when the device is undersized; it falls behind, and falling behind raises the read amplification as well, so the system gets worse in two directions from one bad multiplication.
2
Reading the triangle as a rankingThere is no best corner. A page that says “tiered engines are write-optimised” has said something true and useless: the sentence that helps names the two prices as well — fifty probes on a lookup and ten times the storage. Any comparison quoting one amplification is a comparison with the cost removed.
3
Reading memory amplification as RAMIt is bytes stored per byte of unique data, and it lands on the storage bill. MA = 10 for a tiered tree means ten copies of a key on disk waiting to be merged, which is a decision about how much storage to buy — not about how much memory the process needs.

Check your understanding

✓
Finish when “which engine is best” reads as a malformed question.

You should be able to compute all three amplifications for a levelled tree, a tiered tree and a B-tree from stated parameters, turn each update amplification into a device bandwidth, and name which corner a given workload is paying in.

Note: Every number on this page assumed the write reached durable storage. “fsync and Group Commit” is where that assumption gets priced: a single fsync caps durable commits at 1/t_fsync a second no matter what the rest of the engine can do, and the only way past it costs latency.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.