Sizing and TCO

ch03 · Where the numbers come from

Builds on ch02.

A video summary of this chapter, generated from the page by an AI tool (how it was made). The page is the authority; the video needs a network connection.

The question

What is the difference between a number you measured, a number you were told, and a number you decided?

Once a measurement, a figure you were told and a figure you decided are typed into the same column of a spreadsheet, nothing on screen tells them apart. The spreadsheet does not record which kind each number is, so you cannot tell a measurement from a decision, and neither can whoever opens the file after you.

The material

Three claims, wearing the same clothes

Every input in this book declares which of three things it is.

fact: traceable to something: a stamped measurement, an invoice, or a published specification. A stamped measurement is a result file in bench/results/. It records the figure, the unit, what produced it (the body of data and the software, or the machine), and a fingerprint of the code that created it. The build refuses a fact whose source cites nothing. An assumption dressed as a fact is worse than one labelled as an assumption, because the label hides the doubt a reviewer would otherwise challenge.

vendor_claim: stated by the vendor selling it. Often true, and never checked here. It carries its mark in the tables on this page (the ◐ symbol), and when you click a node in a model, its Provenance line names it a vendor claim. It is never quietly promoted to a fact. Once a quoted throughput becomes “the throughput” in your head, the model holds a fact it never earned.

assumption: a decision this model makes. Naming it as one is what lets a reviewer argue with it. An assumption nobody can find is not a weaker claim than a measurement. It is a stronger one, because nothing can dislodge it.

A vendor’s specification

Every input in ch02’s file was either outside your control (how many requests arrive, how much is held, how fast both grow) or decided by you (how long the fleet has to last). The next input, ram_per_host, is how much memory each host carries. You choose which memory modules to fit, so its file says decided: you. What the number means is not yours to decide: it comes off the vendor’s spec sheet, so its provenance is vendor_claim. These two lines answer different questions. decided: records who chooses the value; provenance records who stands behind the number and how much they are claiming. The form that takes is:

  ram_per_host:
    kind: input
    decided: you
    unit: GiB/host
    value: 64
    provenance:
      kind: vendor_claim
      source: >-
        spec sheet: the modules fitted. The sheet says 64 GB and
        means GiB — appendix D — and the operating system will
        report less than either, which is os_reserve's job
    range: [8, 1024]

The source has two clauses. The second, the sheet says gigabytes and means gibibytes, names the gap between what a spec sheet writes and what it counts. Appendix D covers that decimal-against-binary gap. There is a second gap: the operating system keeps some memory for itself before the service sees any. The next input, os_reserve, carries it, and Appendix D does not cover this one. Writing both down is the discipline: the claim is recorded as a claim, and what is doubtful about it is recorded beside it.

os_reserve is an assumption: one number for the share of memory the kernel, the agents and the page cache floor keep. It has not been measured on these hosts. With os_reserve, the model reaches its first node about hardware rather than data: ram_for_service, the memory the service can use per host, which is ram_per_host times one minus os_reserve. The input is:

  os_reserve:
    kind: input
    decided: outside
    unit: dimensionless
    value: 0.1
    provenance:
      kind: assumption
      source: >-
        The share of memory the kernel, the agents and the page
        cache floor keep before the service sees any. One number
        for now: it differs from host to host and has not been
        measured on these hosts, so ch04 replaces it with a spread.
    range: [0.0, 0.4]
OutputWhat the model saysUnit
peak request rate at horizon29,703request/second
records held at horizon55.7TB
memory the service can use, per host0.0618TB/host

Source — web_service_provenance-reference · the model to explore; each input with a range has a slider

input nodes7
derived nodes2
grown nodes2
What the toolkit calls itdefinitional model

Source — web_service_provenance-reference · the model to explore; each input with a range has a slider

The graph below has three more nodes than ch02’s. The output table’s final row is in decimal terabytes per host; ram per host itself is in gibibytes per host—the build converts between units. Since a gibibyte is larger than a gigabyte, the row is larger than what you would get by taking the reserve from the vendor’s sheet figure and reading it as decimal gigabytes. That difference is the first gap, now visible.

The graph as ch03 leaves it. Click ram per host to see whose claim it is.

Still a definitional model, and a vendor’s claim does not change that. A claim is about a number: how much you should trust it. The distinction this book is built on is about the shape of the arithmetic: whether the chain of multiplications stops applying somewhere. So a model can be built entirely out of figures a salesperson supplied and still be a definitional model, and a model built entirely out of your own measurements can be a conditional one. What flips it is a limit the system runs into, and ch06 adds the first.

Three claims, counted

Here is the census of the running example as this chapter leaves it. It is short, and one row of it is the claim above:

InputProvenanceSource
○annual growth factor
annual_growth
assumption
Not measured. The service owners estimate the factor demand is multiplied by each year. It is a share of the demand, not a fixed amount: the model assumes this service grows by a share of itself. One number cannot say how sure they are of it, so ch04 replaces it with a spread.
○horizon
horizon
assumptionthe refresh cycle this fleet is bought against
●one year
one_year
factdefinition
○os reserve
os_reserve
assumption
The share of memory the kernel, the agents and the page cache floor keep before the service sees any. One number for now: it differs from host to host and has not been measured on these hosts, so ch04 replaces it with a spread.
○peak request rate, day one
peak_request_rate_t0
assumption
The service owners estimate the request rate in the busy hour. They have a spread of plausible rates in mind and round it to one number; ch04 replaces it with the spread.
◐ram per host
ram_per_host
vendor claim
spec sheet: the modules fitted. The sheet says 64 GB and means GiB — appendix D — and the operating system will report less than either, which is os_reserve’s job
○records held, day one
stored_data_t0
assumption
The service owners estimate what the service holds today: its database and the objects users have uploaded, before replication, indexes or compression. It has not been counted yet, and counting it would turn the estimate into a fact.
7 inputs1 fact, 1 vendor claim, 5 assumptions

Source — web_service_provenance-reference · the model to explore; each input with a range has a slider

The book’s second model is the observability platform, and its inputs include all three kinds of claim. Both its vendor claims are figures quoted for a component: the collector’s throughput per core and the query tier’s scan rate. The census table below shows facts and vendor claims; one row counts assumptions, and the tally sums all three kinds. The complete census, every input with its source, is in Appendix F.

InputProvenanceSource
◐collector throughput, as quoted
collector_throughput_quoted
vendor claim
throughput per core as documented by the collector. Unverified here, and marked as a claim in every figure it appears in
●one sample per series
one_sample_per_series
factdefinition
●one year
one_year
factdefinition
◐query scan rate, as quoted
query_scan_rate_quoted
vendor claimseries scanned per second per query node, quoted
○22 more, not listed hereassumption
26 inputs2 facts, 2 vendor claims, 22 assumptions

Source — observability-reference · the model to explore; each input with a range has a slider · 2 measured constants have no measurement yet, so figures that depend on them say not yet measured (why)

The tally at the bottom of each table shows what kind of claim each model rests on. Both models on this page rest primarily on assumptions. A labelled assumption is acceptable—a reviewer can find it and argue with it. An unlabelled assumption is not acceptable, because nothing marks it as a decision anyone could challenge.

A measured constant is not a fact about the world

A compression ratio is not a property of compression. It is a property of some data and some software at some version, and it moves when either changes. The software is the codec—the program that compresses or encodes the data. The data is a corpus—a declared body of data the codec runs over. Every corpus in this repository is generated by code in bench/measure.py, the same way every time, from starting numbers the result records. Numbers like bytes per sample, spans per request, and throughput per core behave the same way—this book calls them measured constants and gives them their own node kind, measured. Every one names the implementation it belongs to:

ConstantTargetValueStandard errorMeasured against
logs-line-bytescorpus32.4 bytes / line± 0.0044python zlib (DEFLATE level 6)
metrics-sample-bytescorpus9.37 bytes / sample± 0.0009this repository’s encoder, not any product’s
records-compressioncorpus3.58± 0.0009python zlib (DEFLATE level 6)
traces-span-bytescorpus73.6 bytes / span± 0.0173python zlib (DEFLATE level 6)
collector-throughput-per-core—not yet measured——
traces-spans-per-request—not yet measured——

Source — bench/results/, one row per stamped result

The Measured against column names the implementation. One of these constants, bytes per sample, was produced by an encoder in this repository, not by any product. That encoder writes whole bytes, whereas a production format that packs bits uses fewer bytes per sample. The figure is correct, and it describes that encoder. If you copied it into a model of a real system, your model would be wrong by an amount this page does not measure.

A fact is a number with a traceable source, not a number true everywhere: a stamped measurement, an invoice, or a published specification. A measured constant is traceable to its stamped result, but it is true only of the data and software it was measured from.

The method transfers. The number does not.

Four targets, and who can check each

A measurement means something only against what it was taken from: a body of data, a machine, a running system, or one of this book’s own model files.

Every stamped result declares a target: what it was taken against. The target decides who can check the result.

TargetWhat it isWho can check it
corpusa codec or an encoder over a declared body of datayou, with the repository
modela model file evaluated in this repositoryyou, with the repository
riga throughput or a latency, on the reference machinewhoever has that machine
estatean observation of a running systemonly those who run the system; not this repository

A corpus result may carry no rate and no duration. CI re-derives every one on every push. A model result is evidence about what the book’s own models say, and about nothing else. The toolkit refuses a rig measurement on any machine but the reference one: a throughput measured on whatever machine was free is indistinguishable from a real one once it is a number in a table. The Target column of the constants table above shows each measured constant’s target.

The target this repository cannot check, only disclose

An observation of a running system cannot be repeated by you or anyone else, because there is no corpus to re-run and no machine to re-run it on—the system has moved on. The observability model includes one such quantity: spans per request, how many spans one request emits in one instrumented application at one version. The build cannot derive it, the reference machine cannot measure it, and it belongs to the estate target.

estate is held to the strictest disclosure rules in the book: the system, the window, and when you observed it. That disclosure is the only verification an estate figure receives.

When a page uses an estate figure, it says so where it uses it, not in a footnote, so you can tell which numbers rest on someone’s word. Some quantities can only be known by watching a real system. The book discloses them; it does not claim they can be checked.

When nobody has measured it

Two rows of the constants table above say not yet measured. The first is collector throughput per core, a timing and thus a rig measurement—it needs the reference machine. The second is spans per request from the earlier section, an estate observation of an instrumented application you run.

Not measured yet

observability declares 2 constant(s) that nobody has measured:

  • collector throughput per core, measured — needs bench/results/collector-throughput-per-core.json

  • spans per request — needs bench/results/traces-spans-per-request.json

6 node(s) downstream of those cannot be computed. In the book’s tables they are shown as not yet measured; on the interactive model page their boxes show —. Nothing is estimated in their place: this book publishes measurements or it publishes nothing.

Source — observability-reference · the model to explore; each input with a range has a slider · 2 measured constants have no measurement yet, so figures that depend on them say not yet measured (why)

A measured node with no value leaves nothing downstream with a value either; the toolkit works this out from the graph with nothing marked by hand. The box names each missing constant, the result file it needs, and counts the nodes downstream that cannot be computed.

The observability model declares collector throughput twice, on purpose: once as the vendor’s quoted figure, and once as a measured constant. The table below shows the two side by side, each with the pipeline capacity it produces: collector cores times throughput per core.

QuantityWhat the model saysUnitWhere it comes from
◐collector throughput, as quoted6.00MB/s/corevendor claim
collector throughput per core, measurednot yet measuredMB/s/core
measured: bench/results/collector-throughput-per-core.json does not exist
quoted pipeline capacity96.0MB/scollector_cores * collector_throughput_quoted
measured pipeline capacitynot yet measuredMB/scollector_cores * collector_throughput_measured

Source — observability-reference · the model to explore; each input with a range has a slider · 2 measured constants have no measurement yet, so figures that depend on them say not yet measured (why)

The quoted row has a value, and so does its capacity. The measured row has neither. The only pipeline capacity the model can compute today rests on the vendor’s claim, and the table shows that instead of filling the gap. No placeholder, no estimate, no number borrowed from a different stack and quietly rounded. This gap stays visible on purpose: after one copy-paste, a placeholder cannot be distinguished from a measurement.

Three questions, not one label

The chapter has asked three separate questions of a number. They do not collapse into one label. Each gets its own answer.

QuestionWhat answers itThe possible answers
Who stands behind it?the input’s provenance, in the model filefact, vendor_claim, assumption
What was it measured against?the stamped result’s targetcorpus, model, rig, estate
Has this repository measured it?whether the stamped result existsyes, or not yet measured

The observability model’s collector throughput appears twice and shows all three questions apart. The quoted figure is an input whose provenance is a vendor_claim. The measured figure is a measured constant whose target is rig, the reference machine. It has not been measured, so it reads not yet measured. The same quantity gets a different answer to each question.

The rig, and why the book will not let you fake it

Not measured yet — this needs the reference machine

Collector throughput per core is a timing: take it on the reference machine (make measure-rig) and commit the result. No reference machine is declared yet: rig/machine.yml does not exist, so the toolkit refuses this measurement on every computer.

Nothing is estimated in its place: this book publishes measurements or it publishes nothing.

The toolkit refuses to produce a rig measurement except on a machine that matches a declared reference machine. The reference machine is declared in a file that names its processor model and core count, and the toolkit compares your running processor against that declaration. If no declaration exists, the toolkit refuses on every machine.

An environment variable would have been easier—you could set one and run anywhere. But setting a variable by accident would let you stamp a laptop timing as a reference measurement. The declaration must be a file that names the silicon, so a rig result cannot be produced by accident.

What a measurement is worth

One measurement is a number. On its own it gives no measured idea of how far it would move if you took it again. So every constant in this book is measured over several shards: independently generated pieces of its corpus, each from its own starting number, which the result records. The result reports the mean of the shards’ figures, with the standard error of that mean beside it.

Value
Mean over 8 shards32.36 bytes / line
Standard error of that mean± 0.00437 bytes / line
Spread between shards0.0124 bytes / line
Lowest / highest shard32.34 / 32.37

Source — logs-line-bytes · bench.measure.log_lines — JSON service logs, five templates, six services, 128-bit trace ids, seeds 0-7 · python zlib (DEFLATE level 6)

The table walks one constant through: bytes per compressed log line. It shows the mean over the shards, the standard error of that mean, the spread between shards, and the lowest and highest shard.

The spread between shards is how far a typical shard’s figure sits from the mean. The standard error is that spread divided by the square root of the number of shards.

You can check it against the table. The standard error is smaller than the spread because it is about the mean, and a mean of several shards moves less than any one shard does.

That standard error becomes the measured node’s uncertainty, and ch13 carries it through the model like any other. The build refuses a measured constant whose standard error is zero: zero claims it was measured exactly.

A standard error also tells you what more measuring would buy. It falls as one over the square root of the count, so halving it takes four times as many shards. Problem 3.2 is that arithmetic. Do it before agreeing to a measurement campaign, not during one.

What this cannot tell you

Whether a corpus resembles your data. Every constant above was measured over a corpus this repository generates. For the record compression ratio, the corpus is a mix of three kinds of record: user profiles, orders and events. Those proportions and schemas were chosen, not observed, so they are an assumption. Nothing in this repository measures how the compression ratio changes when the mixture changes. The standard error you see covers only shard-to-shard variation with the mixture held constant. To measure what the mixture does, you would need to run the records generator over some of your own records, or with a different mixture, and compare the ratios.

Whether a vendor_claim is true. Nothing here checks one. They are marked so you can see how much of your model rests on them. The table under When nobody has measured it sets the quoted collector throughput beside the measured one, which has no value yet. Where only the claim exists, that is what you have.

Whether an estate observation happened. It is someone’s word, with a disclosure attached: what system, over what window, when. The disclosure lets you trace the figure to whoever took it. It does not make the figure checkable, or true.

Whether an assumption is reasonable. The provenance census counts them. It does not read them. A model can be all assumptions, all sourced, all defensible-sounding, and completely wrong.

Key takeaways

  • Every input says what kind of claim supports its value. A fact is traceable to something, a vendor’s claim was stated by the vendor and is never quietly promoted, and an assumption is a decision a reviewer can argue with.

  • A measured constant belongs to some data and some software at some version. The method transfers. The number does not.

  • Four targets, and this repository cannot check the fourth. You can re-derive a corpus or a model result with the repository. A rig timing can be taken only on the reference machine a file declares, and the toolkit refuses it anywhere else. An estate observation of a running system is someone’s word, with a disclosure attached: what system, over what window, when.

  • A constant nobody has measured has no value, and nor does anything downstream of it. No placeholder, no estimate, no number borrowed from a different stack.

  • One measurement says nothing about its own wobble. A constant is measured over several shards, and the result reports their mean with a standard error—the spread divided by the square root of the shard count. Halving that error takes four times as many shards.

Problems

Three, in tests/where_the_numbers_come_from/. The first two have tests. The third does not.

3.1 — Take a constant, and stamp it so somebody else could check it. Pick a quantity a codec decides and measure it over a corpus you generate deterministically, in several shards. Hand back what a stamp records: the mean over the shards as the value, the standard error of that mean, the figure from each shard, a unit for each figure with no time in it, and the corpus and codec that produced them. What a measurement is worth, above, works a standard error through from its shards. The test stamps the answer, holds it to every rule in bench.stamp.provenance_problems, and checks that your standard error matches the shards you provide.

tests/where_the_numbers_come_from/stubs.py · measure_somethingyours to edit
def measure_something(shards: int = 8) -> dict:
    """Problem 3.1 - take a constant, and stamp it so somebody else could check it.

    Pick any quantity a codec or an encoder decides. The obvious ones are already taken by
    ``bench/run_corpus.py``; reach for a different one. Three ideas, each a ratio: how much a
    thousand UUIDs shrink when compressed together; what base64 encoding costs, as encoded size
    over raw size; how much smaller a column of timestamps gets when you store the differences
    between them.

    Return four parts as one dictionary:

        {
            "summary": {"value": ..., "sd": ..., "shards": shards},
            "units": {"value": ..., "sd": ..., "shards": ...},
            "produced_by": {"corpus": ..., "codec": ...},
            "per_shard": [...],
        }

    ``per_shard`` is the figure measured on each shard, one number per shard, in shard order.
    ``value`` is the mean of ``per_shard``. ``sd`` is the standard error of that mean: the spread
    between the shards divided by the square root of their number. It is not the spread itself.
    The key is called ``sd`` because the book's own stamps use that name.

    Every figure in ``summary`` needs a unit the toolkit knows, and none may have time in it. It
    knows data units such as ``byte`` and ``bit``; ``dimensionless``, for a ratio or a plain
    count such as the number of shards; and the book's counting units: ``request``, ``span``,
    ``sample``, ``series``, ``line``, ``query``, ``host``, ``node``, ``core``, ``label``,
    ``drive``, ``failure``. They combine, as in ``byte/line``. There is no unit for a UUID.

    The test stamps the answer as a ``corpus`` result, because a codec is deterministic and anyone
    can re-run it. It names this file as the code that produced the figure, so a re-run can be
    told from a retyping. Then it holds the result to every rule in
    ``bench.stamp.provenance_problems``:

    * a ``corpus`` and a ``codec`` in ``produced_by``, because a compression figure without the
      body of data it compressed is an anecdote;
    * a unit for every figure in the summary - and not one with time in it, because how fast the
      codec ran is a property of your computer;
    * a ``value`` and an ``sd``, measured over ``shards`` independently generated pieces of
      corpus. One measurement is a number; the interesting question is how much it would move if
      you did it again.

    Generate the corpus in this file, deterministically, from starting numbers you state, so that
    anyone can generate the same one. A constant measured over data nobody else can obtain is a
    constant nobody else can check.
    """
    raise NotImplementedError("problem 3.1")

The same check at a desk: python3 -m pytest tests/where_the_numbers_come_from/test_problem_1_measure.py -m problem

3.2 — What would it cost to be more sure? Given a standard error at some number of shards, work out how many shards would be needed to reach a target standard error. Halving your uncertainty costs four times the measuring. Work it out before the measurement campaign starts, while the answer can still affect the decision.

tests/where_the_numbers_come_from/stubs.py · shards_neededyours to edit
def shards_needed(observed_sd: float, at_shards: int, target_sd: float) -> int:
    """Problem 3.2 - how much more measuring would it take?

    You have measured a constant over ``at_shards`` pieces of corpus and got a standard error of
    ``observed_sd``. You want ``target_sd``. Return the number of shards that would get you there,
    rounded up.

    The standard error of a mean falls as one over the square root of the count. Here you use that
    relationship backwards: from the error you want to the count that would buy it.

    This is the arithmetic that stops a measurement campaign before it starts: work out what
    halving your uncertainty costs before agreeing to halve it.

    Return the total number of shards needed, including the ones you already have, not the number
    of extra ones. Refuse a target of zero.
    """
    raise NotImplementedError("problem 3.2")

The same check at a desk: python3 -m pytest tests/where_the_numbers_come_from/test_problem_2_shards.py -m problem

3.3 — Label your own numbers. No test: these are your numbers, and nothing here can check them.

Take the quantities you wrote down for ch02’s problem 2.5 and put one of three words against each: fact, vendor_claim, assumption. Then, for every fact, write the source you would hand to someone who asked: a document, an invoice, a measurement with a date on it. Write the thing you would send, not where you think it came from.

Any figure you read off a system you run (from a dashboard, a log line count, a monitoring tool) is what this chapter calls an estate observation. Its source is the system, the window it covers, and when you read it. Without those three, it is not yet a fact.

The useful work is reclassification. Count how many started as facts and ended as vendor claims once you looked for the source. Count how many ended as assumptions because the source was a conversation. The census tables on this page show how many inputs in the book’s own models are assumptions. That is why the labels are mandatory rather than encouraged.

A good answer has a source line for every fact that you could paste into an email, a system, a window and a date for every estate figure, and at least one line that changed category while you were writing it. If nothing changed category, you have labelled what you believe rather than what you can show.

Where to go next

ch04 is about growth: the input that moves the web service’s busy-hour demand at the horizon more than any other input. Growth cannot be measured at all: a growth rate is a claim about the future, and no amount of provenance discipline turns one into a measurement.

ch13 carries a measured constant’s standard error through the model like any other uncertainty.

By Chris Snow, in collaboration with Claude (Anthropic) · Prose and figures: CC BY-NC 4.0 · Code and models: Apache 2.0