---
title: "Performance methodology: tree size"
url: "https://nsta1.github.io/Orleans.Lattice/docs/lattice/performance-methodology-tree-size.html"
source: "https://github.com/NSTA1/Orleans.Lattice/blob/release/10.5/docs/lattice/performance-methodology-tree-size.md"
agent_spec: "https://nsta1.github.io/Orleans.Lattice/docs/agents/deployment.yaml"
package: "Orleans.Lattice"
version: "10.5.0"
documents: "Orleans.Lattice 10.5.0 (release line 10.5)"
built: "2026-12-05"
all-pages: "https://nsta1.github.io/Orleans.Lattice/llms.txt"
bundle: "https://nsta1.github.io/Orleans.Lattice/docs/lattice/llms-full.txt"
---
# Performance methodology: tree size

Part of the [Orleans.Lattice documentation](architecture.md).

This page explains how the tables in [Performance: tree size](performance-tree-size.md) are produced. The ladder runs on the Layer 3 rig and reuses its seeding, grading and storage metrics, which [Layer 3 methodology](performance-methodology-layer3.md) describes. This page covers only what differs.

## What it measures

As one tree grows, how does a client's point-read latency change, and how
long does it take to load the tree to that size? Each rung of the ladder is a
tree size. For each rung the page reports:

- the seed segment (keys added at this rung), its seed time and seed rate;
- `GetAsync` latency at p50, p95, p99 and p99.9;
- how many reads were measured;
- peak silo CPU and memory.

The results page's summary names the first degraded rung: the first whose
p95 is at least `-KneeFactor` (1.5) times the baseline (smallest) rung's p95.

## How it differs from a Layer 3 cell

| | Layer 3 cell | Tree-size rung |
|---|---|---|
| Independent variable | Silo count | Keys in the tree |
| Workload | Every workload | `get-point` only |
| Silos | 1-8 | 4 (`-LadderSilos`) |
| Keyspace read | One key per simulated vehicle | Every key seeded so far, uniformly |
| Cohorts | Median of up to three per cell, fresh storage each | One execution for the whole ladder |
| Published latency | Silo-side per-call quantiles | Client-side `GetAsync` timings |

The rig is as in [The rig](performance-methodology-layer3.md#the-rig), with
64 shards, 16 WAL partitions and 245-byte values. The offered read load
is 125 vehicles per silo at 5 Hz: 2,500 reads/s on 4 silos, held constant
across rungs so only the tree size changes.

## The ladder

`benchmark/tree-size-report.ps1` drives
`run-cohort-aca.ps1 -WorkloadMode get-point -TreeSizeLadder <sizes>`, which
runs the whole ladder in one producer execution. The sizes must be strictly
ascending. For each rung the producer:

1. **Seeds** the keys between the previous rung and this one, with the bulk
   load described under
   [How a cohort is graded](performance-methodology-layer3.md#how-a-cohort-is-graded).
   One tree grows from rung to rung, and no key is written twice.
2. **Reads** for `-DurationSec` (60 s), each key taken by a fixed prime stride
   that spreads reads evenly over every key seeded so far.
3. Logs `tree-size-rung index=.. rung=.. phase=seed|measure|end`, so the log
   splits into one segment per rung, each with its own latency, verification
   and `FINAL` lines.

Storage is reset once, before the first rung. Seed time is the producer's
wall clock across the rung's seed, retries included. A seed has no overall time
limit: it fails when no chunk lands for `-PreseedStallSec`, or when one chunk
fails eight times or with a non-transient error.

### Why reads run on the warm cluster

The silos that seeded a rung stay up to read it. A bulk-loaded leaf's
checkpoint is the WAL position at which it was loaded, so a tree opened by
freshly started silos replays the WAL appended since, leaf by leaf,
serialised per partition. Reading on a cold cluster would
measure that recovery, not steady-state reads. For the same reason the
silos keep the Orleans default grain collection age
(`-GrainCollectionAgeSec 0`): a shorter age speeds the seed but makes every
reactivated leaf replay its WAL partition.

## Read latency

The producer times each `GetAsync` from issue to completion, so every figure
includes the client-to-silo hop. Samples land in logarithmic buckets about
4.4% wide, and each published quantile is the **upper edge** of the bucket
it falls in, so it can overstate the true value by up to one bucket width.

- **Steady**: samples from 15 s into the read window to its end. This is the
  published figure.
- **Total**: every sample, logged alongside it but not published.

The steady window still contains first-touch leaf activations: a uniform
read over millions of keys keeps reaching leaves it has not read before.
That is what drives the multi-second p99.9.

## Read verification

Every read is checked against the value seeded for its key, without an
extra storage round trip, and logged as
`read-verify-final verified=.. mismatch=.. missing=..`. A rung with any
mismatched or missing key is flagged `INCONSISTENT` in its row and cannot be
the baseline or the degraded threshold. That is the only hard gate on a rung.

## Silo CPU and memory

Peak CPU and peak memory are the highest one-minute Azure Monitor
`UsageNanoCores` and `WorkingSetBytes` maxima across the silo replicas,
between the rung's seed and end markers. Each is also shown as a share of
the replica limit (4 vCPU, 8 GiB). The window includes the seed, so the
peak usually comes from seeding, not reading.

## What bounds these numbers

[What bounds these numbers](performance-methodology-layer3.md#what-bounds-these-numbers)
applies in full. In addition:

- **Seed rate.** One storage account seeds about 1,100-1,500 keys/s, so
  seed time grows roughly linearly with segment size. `run-cohort-aca.ps1 -WalAccounts`,
  which `tree-size-report.ps1` does not pass through, may raise it.
- **Silo memory.** Working set grows with tree size, and the 8 GiB replica
  cap bounds the largest tree a fixed silo count can hold.
- **One cohort per rung** unless `-Repeats` is raised. Treat a difference
  under about 15% between rungs as noise.
- **Uniform reads** are the worst case for leaf residency. A skewed
  workload keeps a hot set active and reads faster.
- **Reads only.** Nothing writes during a read window.

## Re-running it

As in [Re-running it](performance-methodology-layer3.md#re-running-it), with
the ladder in place of a silo sweep. From `benchmark/`:

```powershell
./tree-size-report.ps1 -NamePrefix <prefix> -SiloCounts 4 -LadderSilos 4 `
  -Sizes 1000000,3000000,6000000,10000000 -VehiclesPerSilo 125 -DurationSec 60
```

Useful options:

- `-Resume` continues a sweep that stopped; `-DryRun` re-renders the page
  from `benchmark/.run/tree-size-report/<prefix>/state.json`.
- `-Repeats N` runs N independent ladders per silo count; the table then
  shows the median of each quantile.
- `-KneeFactor`, `-SpreadGatePct` and `-SpreadFloorMs` tune the grading.
- `-PreseedStallSec` (default 900) and `-PreseedKeysPerSecFloor`
  (default 250) bound the seed and the producer execution ceiling.
