Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ getrandom = { version = "=0.3.4", features = ["wasm_js"] }
gloo-net = { version = "0.7", features = ["http"] }
gloo-timers = { version = "0.3", features = ["futures"] }
js-sys = "0.3"
rmp-serde = "1"
serde = { version = "^1.0.228", features = ["derive"] }
serde_json = "^1"
tokio = { version = "^1", features = ["full"] }
Expand Down
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ tokio::join!(viz.clone().serve_on(listener), async {

**The recording is not on your thread.** A finished tick crosses to a tape thread over a bounded channel, and that thread does the naming, bucketing, thinning and cost accounting; the graph pays a `Display`, a clipped `Debug` and one push, into buffers the tape hands back. `Backpressure` says what a full channel means: `Block` for a replay, which wants the whole tape and whose feed will wait, and `Drop` for a live run, where a fill must never queue behind a study aid — dropped ticks are counted into `ActivationFrame::dropped` rather than passing for a quiet market.

**The tape is the storage.** A live run cannot be re-run, so ticks are kept rather than replayed-by-rewinding. Past `capacity`, the buffer *thins* instead of dropping its front: the newest `capacity / 2` ticks stay whole, and everything older is decimated to every `stride`-th tick (`stride` only doubles). A run many times the capacity stays walkable end to end, with the freshest stretch still tick-exact — where a plain ring would make the beginning of a long recording unreachable for the rest of the run. The per-node series the chart draws is downsampled online into `bucket_ms` buckets and never dropped.
**The tape is the storage.** A live run cannot be re-run, so ticks are kept rather than replayed-by-rewinding. Past `capacity`, the buffer *thins* instead of dropping its front: the newest `capacity / 2` ticks stay whole, and everything older is decimated by *fire* rather than by index — each node keeps one fire in `2^k`, and `k` rises only for whichever node is claiming most of the backbone. So a run many times the capacity stays walkable end to end with its freshest stretch still tick-exact, and the rare event a human scrubs for — the 5-minute bar, the classification — survives the squeeze that the book flood absorbs. See *Picking a `capacity`* below for what to size it to. The per-node series the chart draws is downsampled online into `bucket_ms` buckets and never dropped.

#### The view

Expand All @@ -78,12 +78,75 @@ The DAG panel is DOM-inspector-style and present-moment only: one column per top
| `c` | skip to the next `Classify` |
| `n` | skip to the next change in the nodes you clicked |

Two things the nav says about a thinned stretch. Where a step covers more than one absolute tick it shows a `×n` next to the position — the resolution the tape is admitting to, rather than a stepper that looks like it is skipping. And a scan that walks a sealed recording to its end without a hit leaves the cursor where it was and reports that it found nothing, instead of answering a failed search by jumping to the end of the run.

An op can name a tick that has not been recorded yet. The server says so (`pending`) rather than blocking, and the control that outran the feed shows a `⟳` while it re-issues itself.

#### HTTP

`GET /api/topology` · `GET /api/day` · `GET /api/status`, and `POST /api/{step,seek,seek_ts,step_until,step_until_change}`. Shapes live in `exec_viz::api_types`, which both halves compile — the wasm client depends on `exec_viz` with `default-features = false`, leaving just the wire types and none of the axum/tokio server half.

### Picking a `capacity`

`capacity` is the only number `Viz::new` asks for that has no right answer — it is RAM traded
against reactivity, and the exchange rate is your graph's, not this crate's. What it constrains:

| | |
|---|---|
| `capacity / 2` | the newest ticks kept **whole** — the stretch that stays tick-exact |
| `capacity / 4` | the ceiling on the thinned *backbone*, and so how deep the squeeze goes |
| `capacity / 2` | the recycle channel's depth: one pass frees between a quarter and a half of the buffer, and the recorder takes all of it back rather than allocating |
| `capacity` | the bound on the carry-forward scan a frame does for every quiet node, which is what landing a cursor costs |

Thinning is **per node, not per tick**: a pass raises the exponent of whichever node is claiming most
of the backbone until the backbone fits, so a node firing 288 times a day keeps all 288 while the
book-driven flood beside it is decimated. What that means for sizing — **a node's whole run stays
addressable as long as its fires fit inside its max-min fair share of `capacity / 4`.** Rare nodes
are never the ones cut, so in practice the share is the whole backbone minus what the handful of
greedy nodes settle at. In the block below, at `capacity` 20 000 the backbone is 5 000: the two nodes
that each want ~3 000 land on ~1 790 apiece, and everything rarer than that keeps every fire it ever
had. Read the other way: a 5-minute bar over three days is 864 fires and is safe from about 8 000;
over a month it is 8 640 and wants ~65 000.

Bigger is not free, and the price is not where it looks. Recording cost does not move with
`capacity` at all — the graph thread's leg of a fire is the same two renderings either way. What
moves is the cost of *landing* a cursor, because a frame carries every node's standing value and a
node quiet for a while is found by scanning back for it.

The block below is one synthetic graph on one machine. `Viz::bytes` is exported so the same reading
can be taken against yours.

<!-- capacity:begin -->
```
318420 ticks (2 days at spl's 159210/day), 5 nodes, 107 B/tick of card faces
fires over the run: Book=318420 Screen=3185 Bar:1m=2895 Bar:5m=579 Bar:1h=49

footprint — Viz::bytes over the retained ticks
2048 │▬ 3.0 MB (1477 B/tick)
8192 │▬▬ 5.4 MB (818 B/tick)
20000 │▬▬▬▬ 11.3 MB (665 B/tick)
65536 │▬▬▬▬▬▬▬▬▬▬▬ 33.8 MB (554 B/tick)
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 132.6 MB (524 B/tick)

reactivity — /api/seek mid-tape *above* a bare 53µs loopback hop, median of 64
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 14µs
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 34µs

addressability — fires still reachable by `step_until`, against the run's own
capacity retained Book Screen Bar:1m Bar:5m Bar:1h
2048 2007 2007/318420 251/3185 231/2895 147/579 49/49
8192 6557 6557/318420 691/3185 899/2895 579/579 49/49
20000 16951 16951/318420 1796/3185 1784/2895 579/579 49/49
65536 61047 61047/318420 3185/3185 2895/2895 579/579 49/49
262144 252884 252884/318420 3185/3185 2895/2895 579/579 49/49
```
<!-- capacity:end -->

Produced by `cargo r --release -p exec_viz --example capacity`, which splices it in here and writes
it to `docs/capacity.txt` — the numbers are read, not typed.


<br>
Expand Down
61 changes: 61 additions & 0 deletions docs/.readme_assets/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
### Picking a `capacity`

`capacity` is the only number `Viz::new` asks for that has no right answer — it is RAM traded
against reactivity, and the exchange rate is your graph's, not this crate's. What it constrains:

| | |
|---|---|
| `capacity / 2` | the newest ticks kept **whole** — the stretch that stays tick-exact |
| `capacity / 4` | the ceiling on the thinned *backbone*, and so how deep the squeeze goes |
| `capacity / 2` | the recycle channel's depth: one pass frees between a quarter and a half of the buffer, and the recorder takes all of it back rather than allocating |
| `capacity` | the bound on the carry-forward scan a frame does for every quiet node, which is what landing a cursor costs |

Thinning is **per node, not per tick**: a pass raises the exponent of whichever node is claiming most
of the backbone until the backbone fits, so a node firing 288 times a day keeps all 288 while the
book-driven flood beside it is decimated. What that means for sizing — **a node's whole run stays
addressable as long as its fires fit inside its max-min fair share of `capacity / 4`.** Rare nodes
are never the ones cut, so in practice the share is the whole backbone minus what the handful of
greedy nodes settle at. In the block below, at `capacity` 20 000 the backbone is 5 000: the two nodes
that each want ~3 000 land on ~1 790 apiece, and everything rarer than that keeps every fire it ever
had. Read the other way: a 5-minute bar over three days is 864 fires and is safe from about 8 000;
over a month it is 8 640 and wants ~65 000.

Bigger is not free, and the price is not where it looks. Recording cost does not move with
`capacity` at all — the graph thread's leg of a fire is the same two renderings either way. What
moves is the cost of *landing* a cursor, because a frame carries every node's standing value and a
node quiet for a while is found by scanning back for it.

The block below is one synthetic graph on one machine. `Viz::bytes` is exported so the same reading
can be taken against yours.

<!-- capacity:begin -->
```
318420 ticks (2 days at spl's 159210/day), 5 nodes, 107 B/tick of card faces
fires over the run: Book=318420 Screen=3185 Bar:1m=2895 Bar:5m=579 Bar:1h=49

footprint — Viz::bytes over the retained ticks
2048 │▬ 3.0 MB (1477 B/tick)
8192 │▬▬ 5.4 MB (818 B/tick)
20000 │▬▬▬▬ 11.3 MB (665 B/tick)
65536 │▬▬▬▬▬▬▬▬▬▬▬ 33.8 MB (554 B/tick)
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 132.6 MB (524 B/tick)

reactivity — /api/seek mid-tape *above* a bare 53µs loopback hop, median of 64
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 14µs
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 34µs

addressability — fires still reachable by `step_until`, against the run's own
capacity retained Book Screen Bar:1m Bar:5m Bar:1h
2048 2007 2007/318420 251/3185 231/2895 147/579 49/49
8192 6557 6557/318420 691/3185 899/2895 579/579 49/49
20000 16951 16951/318420 1796/3185 1784/2895 579/579 49/49
65536 61047 61047/318420 3185/3185 2895/2895 579/579 49/49
262144 252884 252884/318420 3185/3185 2895/2895 579/579 49/49
```
<!-- capacity:end -->

Produced by `cargo r --release -p exec_viz --example capacity`, which splices it in here and writes
it to `docs/capacity.txt` — the numbers are read, not typed.
4 changes: 3 additions & 1 deletion docs/.readme_assets/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tokio::join!(viz.clone().serve_on(listener), async {

**The recording is not on your thread.** A finished tick crosses to a tape thread over a bounded channel, and that thread does the naming, bucketing, thinning and cost accounting; the graph pays a `Display`, a clipped `Debug` and one push, into buffers the tape hands back. `Backpressure` says what a full channel means: `Block` for a replay, which wants the whole tape and whose feed will wait, and `Drop` for a live run, where a fill must never queue behind a study aid — dropped ticks are counted into `ActivationFrame::dropped` rather than passing for a quiet market.

**The tape is the storage.** A live run cannot be re-run, so ticks are kept rather than replayed-by-rewinding. Past `capacity`, the buffer *thins* instead of dropping its front: the newest `capacity / 2` ticks stay whole, and everything older is decimated to every `stride`-th tick (`stride` only doubles). A run many times the capacity stays walkable end to end, with the freshest stretch still tick-exact — where a plain ring would make the beginning of a long recording unreachable for the rest of the run. The per-node series the chart draws is downsampled online into `bucket_ms` buckets and never dropped.
**The tape is the storage.** A live run cannot be re-run, so ticks are kept rather than replayed-by-rewinding. Past `capacity`, the buffer *thins* instead of dropping its front: the newest `capacity / 2` ticks stay whole, and everything older is decimated by *fire* rather than by index — each node keeps one fire in `2^k`, and `k` rises only for whichever node is claiming most of the backbone. So a run many times the capacity stays walkable end to end with its freshest stretch still tick-exact, and the rare event a human scrubs for — the 5-minute bar, the classification — survives the squeeze that the book flood absorbs. See *Picking a `capacity`* below for what to size it to. The per-node series the chart draws is downsampled online into `bucket_ms` buckets and never dropped.

### The view

Expand All @@ -40,6 +40,8 @@ The DAG panel is DOM-inspector-style and present-moment only: one column per top
| `c` | skip to the next `Classify` |
| `n` | skip to the next change in the nodes you clicked |

Two things the nav says about a thinned stretch. Where a step covers more than one absolute tick it shows a `×n` next to the position — the resolution the tape is admitting to, rather than a stepper that looks like it is skipping. And a scan that walks a sealed recording to its end without a hit leaves the cursor where it was and reports that it found nothing, instead of answering a failed search by jumping to the end of the run.

An op can name a tick that has not been recorded yet. The server says so (`pending`) rather than blocking, and the control that outran the feed shows a `⟳` while it re-issues itself.

### HTTP
Expand Down
Loading
Loading