Terminology (6)Terms used in this lesson
Term on the front, definition on the back. Paste with tabs between fields and a new line between cards, or import the download in Anki as Basic.
- Back-of-envelope estimate
- A quick calculation from named, rough inputs to see whether a design is in the right order of magnitude.
- Factor
- One named input to the estimate, such as daily users or bytes per upload, given as a low and a high end.
- Range
- The lowest and highest results the factors allow, found by multiplying all low ends and all high ends.
- Widening ratio
- A factor’s high end divided by its low end. The estimate’s range ratio is the product of these.
- Order of magnitude
- A factor of ten. Estimates aim to be right to within one.
- Significant digits
- The digits that carry meaning. Rough inputs justify one or two.
Why this matters
Capacity plans, cost forecasts and design reviews start before there is data. A quick estimate catches designs that are off by orders of magnitude, but only if it is honest about what its inputs are: guesses with ends. Carrying the ends through tells you whether the answer is already clear and, if not, which guess is worth an afternoon of measuring.
This lesson assumes powers of ten and scientific notation.
What a rough estimate can decide
A back-of-envelope estimate breaks a quantity into a few factors that can be estimated separately. Units explain how they combine: a count per day multiplied by an amount per item gives an amount per day.
When the inputs are uncertain, keep their bounds through the calculation. For positive factors, the result is a range of allowed values. Compare that whole range with the limit to decide whether the available information settles the question or calls for a better measurement.
01Name the factors
Name the factors
A design doc estimates 11 TB of new photos a day from three midpoint guesses. Each guess was really a range, and their ends multiply: the same inputs allow anything from 1 TB to 40 TB. A useful estimate keeps that range, and names which guess to check first.
Daily photo storage is users × uploads per user × bytes per upload. Each factor is a range someone can defend: 2–5 million daily users, 0.5–2 uploads each, 1–4 MB per photo. Here MB = 10⁶ bytes and TB = 10¹² bytes. Uploads per daily user and mean bytes per upload must describe the same population and day. Treat the stated intervals as bounds, not confidence intervals. Multiplying their ends encloses all allowed combinations; correlation may make the extreme combinations unreachable, leaving a conservative range.
02Multiply the ends
Multiply the ends
Predict the three lines this program prints.
// Daily upload storage: users × uploads per user × bytes per upload
const factors: [number, number][] = [
[2e6, 5e6],
[0.5, 2],
[1e6, 4e6]
];
const low = factors.reduce((p, [l]) => p * l, 1);
const high = factors.reduce((p, [, h]) => p * h, 1);
const midpoint = factors.reduce((p, [l, h]) => p * ((l + h) / 2), 1);
console.log(`${low.toExponential(1)} ${high.toExponential(1)}`);
console.log(midpoint.toExponential(1));
console.log(`${(low / 3).toExponential(1)} ${(high / 2).toExponential(1)}`); // after resizing by 2-3×
Write 2e6 for two million, and print with toExponential(1) for two significant digits. Numbers stay exact as integers only up to about 9 × 10¹⁵; the lab uses approximate binary64 values and a supplied common display helper.
03Ratios, not differences
Ratios, not differences
| Factor | Range | High ÷ low |
|---|---|---|
| Daily users | 2–5 million | 2.5 |
| Uploads per user | 0.5–2 | 4 |
| Bytes per upload | 1–4 MB | 4 |
The range’s own ratio, 40, is the product 2.5 × 4 × 4. Users have the largest spread in absolute terms, 3 million, yet narrow the estimate least. Uploads per user and photo size tie. If measuring either one could fix it to a known value while the other bounds stay unchanged, the total ratio would fall from 40 to 10. That is a useful priority only when measurement cost and achievable narrowing are comparable.
04Divide by a range
Divide by a range
Server-side resizing shrinks each photo by a factor of 2 to 3. Dividing by a range swaps its ends: the low estimate divides by 3, the high estimate by 2, giving 3.3 × 10¹¹ to 2.0 × 10¹³ bytes. Dividing low by 2 and high by 3 would make the range look narrower than the inputs allow.
05Compare the whole range
Compare the whole range
06Size the upload storage
Size the upload storage
The planner first needs endpoints rather than one midpoint. It then needs a measurement priority that survives a change of units. Once resizing enters the model, a plausible repair that divides matching endpoints still understates the storage range and can approve an over-budget design.
Photo upload storage
Range of the estimate, widest input, then fits, exceeds or measure.
In the frontend A range estimate widget in Next.js and Svelte Optional
An internal planning tool takes each factor as a range and shows the estimate as a range together with the factor worth measuring, and names the widest factor as a measurement candidate. The caller supplies a nonempty list of valid positive ranges; this display does not infer probabilities or measurement costs.
type Factor = { name: string; low: number; high: number };
// Every input is a range; the answer is a range plus the factor worth measuring first.
export function StorageEstimate({ factors }: { factors: Factor[] }) {
const low = factors.reduce((p, f) => p * f.low, 1);
const high = factors.reduce((p, f) => p * f.high, 1);
const widest = factors.reduce((best, f) =>
f.high / f.low > best.high / best.low ? f : best
);
return (
<p>
{low.toExponential(1)} to {high.toExponential(1)} bytes per day. Largest widening
ratio: {widest.name}. Compare measurement effort before choosing.
</p>
);
}
Check this idea later
Sources
Values above were computed in Node 22 and run in Go 1.27, Rust 1.99 and Apple clang 17. The upload feature is a worked model.
Sign in to keep your read marks on every device. Sign in
Was this helpful?