Skip to content
About
Main content
Model

The square-root rule

A cost that grows with the interval against a fixed cost spread over it: the best interval is a square root, the same shape as the economic order quantity of a warehouse.

Interval
how long you wait (or how much you gather) before paying the fixed cost
Growing cost
cost per unit of interval that accumulates while you wait (reads slowed by deltas, time spent waiting)
Fixed cost
cost paid once per interval (a rewrite, an fsync)

Recurring principle: Fixed cost per operation

How it behaves

One input on the horizontal axis, the others held fixed.

Data table
Cost per hour by compaction interval (a·w = 360, b·U = 40)
Compaction interval τ (hours)Seconds of work per hour
0.022.01K
0.0211.87K
0.0231.75K
0.0251.63K
0.0261.53K
0.0281.43K
0.031.33K
0.0321.25K
0.0351.16K
0.0371.09K
0.041.02K
0.043951
0.046890
0.049833
0.053780
0.056731
0.06685
0.065642
0.069602
0.074566
0.08532
0.085500
0.091471
0.098444
0.105419
0.112397
0.12376
0.129357
0.138339
0.148324
0.159309
0.17297
0.182285
0.195275
0.209267
0.224259
0.24253
0.257248
0.275244
0.295242
0.316240
0.339240
0.363241
0.389243
0.417246
0.447250
0.478256
0.513263
0.549271
0.589280
0.631290
0.676302
0.724316
0.776331
0.831347
0.89365
0.954385
1.02407
1.1431
1.17457
1.26484
1.35515
1.44547
1.55583
1.66621
1.78662
1.9706
2.04753
2.18805
2.34860
2.51919
2.69982
2.881.05K
3.081.12K
3.31.2K
3.541.29K
3.791.38K
4.061.47K
4.361.58K
4.671.69K
51.81K

Worked examples, recomputed

Every number the mechanisms quote for this relationship is recomputed from it, so none of them disagrees with it.

Where it appears

Each mechanism states it in its own names. The general symbol each name stands for is shown with it.

  • Persistence & Durability

    When a system says "yes, your data is safe", what exactly has it promised, and what did it have to do to keep that promise?

    W (wait before the flush) = · fsync ÷ λ (fsync share) = · 1/2 (average wait) =

    Read it in place →

  • Indexing

    When does a separate "where is it?" structure pay for itself, and what does it cost to keep it true?

    nlist (centroids) = · N · nprobe (vectors compared in probed cells) = · 1 (per centroid) =

    Read it in place →

  • Distributed Systems Coordination

    Who is allowed to decide, and how does everyone else learn the decision without asking?

    P (partitions) = · f (fixed cost per partition) = · c (imbalance) =

    Read it in place →

  • Fault Tolerance & Delivery Semantics

    What is the cheapest thing that can be safely done twice?

    I (checkpoint interval) = · C (cost of one checkpoint) = · 1 / (2·MTBF) (lost work per unit interval) =

    Read it in place →

  • Scheduling & Workload Management

    Which work runs now, which work waits, and who pays for the waiting?

    τ (checkpoint interval) = · 1/(2M) (lost work per unit interval) =

    Read it in place →

  • Table & Storage Maintenance

    Who pays for the gap between the order data arrives in and the order it is read in: the writer, every reader, or a background job, and what is the break-even?

    T (interval) = · C (one rewrite) = · r/2 (degradation) =

    Read it in place →