S16: spike before the swarm (about a day) #36

Closed
opened 2026-10-02 04:07:04 +00:00 by jhgaylor · 3 comments
Owner

Blocks: #37, #38, #39, #40

Swarm track: one live view of every pane on every machine. Panes form clusters on their own, and anything that needs you lifts out to a "needs you" rail. Today the page shows one host's tabs at a time, and attention is a four-state badge per tab. This spike measures what the rest of the track needs.


Done 2026-10-02, apart from the phone runs. See spikes/s16-swarm and PLAN.md's "S16". Merged in b0d6c1b.

Question Result Verdict
Delta summaries vs whole State At 500 panes with 50 busy, whole-State broadcasts are 34/s at 195 KB each: 6.6 MB/s to every client, and 14.7% of a core (20.4% with 5 clients). Field-level deltas at 1 Hz carry the same plus activity in 4.6 KB/s (0.44 KB/s compressed) Go
Activity signal A cumulative byte counter and last_output_ms in Status, set under the lock State::output already takes. The mux turns it into a rate; no timer, and parked panes aren't woken Go (read, not built)
Server-side previews 50 panes at 1 Hz: 0.8% of a core, 1.1 ms per capture (p50), about 43 B per pane (2.2 KB/s) Go
Canvas 2D Laptop: 2,000 panes at 60 fps, 5,000 at 51. Phone proxy (4x CPU throttling): 500 at 60, 2,000 at 36. Physics is about half of each frame Go to about 2,000 panes, no WebGL
One page, many daemons 20 daemons (600 panes) add about 14 MB. Chrome spaces out WebSocket connections to one address past about 8: waking with 8 took 10–21 ms, 12 about 110 ms, 20 took 2.2–4.6 s Go, with relayed daemons on one socket
Classification kind from /proc argv first: 52 of 54 labelled commands right, and it catches aliases (c for claude). Only 8 of 105 real commands ran inside a git repo Go; "by project" needs a fallback group

Still to run: a real phone for the canvas test, daemons on different addresses, a local control relay, and classification on real work (the real history was too thin to measure).

The plan as written:

  • Summary cost on the daemon:
    • At M9's benchmark scale (500 panes on geek), what does a per-pane summary cost to keep and to send? The summary is cwd, command, running, attention, current/last command, bytes per second, and last output time.
    • Today every change sends the whole State. Measure that at 500 panes against field-level deltas batched to 1–2 Hz.
    • Measure bytes per second over the M18 relay with 10% of panes busy.
  • Activity signal: what does an output-rate EMA and last_output_ms cost when kept in the PTY reader? Does it wake parked panes (M9)?
  • Previews: what does rendering the last 6 lines of a pane from the VT grid cost (as /api/panes/{id}/capture does), at 1 Hz, for 50 visible panes? Compare that with sending output bytes and rendering on the client.
  • Classification: run heuristics over geek's and jake-mini's real panes, then hand-check them:
    • kind (shell, build, test, agent, server, logs, editor, or a block type) from the foreground command and process tree (procinfo.rs);
    • project from the cwd's git root.
  • Fleet connections: one browser holding summary connections to 5 and to 20 daemons at once, each its own Noise channel (direct, dial-out and relay). Check memory, reconnect storms after a laptop sleeps, and Chrome's Local Network Access prompt for many tailnet hosts.
  • Rendering: the prototype's canvas renderer, measured at 500, 2,000 and 5,000 panes on the laptop and a mid-range phone. Is Canvas 2D enough, or does it need WebGL?

Output: a short write-up in spikes/s16-swarm/, with numbers for each item and go/no-go on delta summaries, server-side previews and Canvas 2D.

**Blocks:** #37, #38, #39, #40 *Swarm track: one live view of every pane on every machine. Panes form clusters on their own, and anything that needs you lifts out to a "needs you" rail. Today the page shows one host's tabs at a time, and attention is a four-state badge per tab. This spike measures what the rest of the track needs.* -------- **Done 2026-10-02, apart from the phone runs.** See [spikes/s16-swarm](../src/branch/main/spikes/s16-swarm/README.md) and PLAN.md's "S16". Merged in b0d6c1b. | Question | Result | Verdict | |---|---|---| | Delta summaries vs whole `State` | At 500 panes with 50 busy, whole-`State` broadcasts are 34/s at 195 KB each: 6.6 MB/s to every client, and 14.7% of a core (20.4% with 5 clients). Field-level deltas at 1 Hz carry the same plus activity in 4.6 KB/s (0.44 KB/s compressed) | **Go** | | Activity signal | A cumulative byte counter and `last_output_ms` in `Status`, set under the lock `State::output` already takes. The mux turns it into a rate; no timer, and parked panes aren't woken | **Go** (read, not built) | | Server-side previews | 50 panes at 1 Hz: 0.8% of a core, 1.1 ms per capture (p50), about 43 B per pane (2.2 KB/s) | **Go** | | Canvas 2D | Laptop: 2,000 panes at 60 fps, 5,000 at 51. Phone proxy (4x CPU throttling): 500 at 60, 2,000 at 36. Physics is about half of each frame | **Go** to about 2,000 panes, no WebGL | | One page, many daemons | 20 daemons (600 panes) add about 14 MB. Chrome spaces out WebSocket connections to one address past about 8: waking with 8 took 10–21 ms, 12 about 110 ms, 20 took 2.2–4.6 s | **Go**, with relayed daemons on one socket | | Classification | `kind` from `/proc` argv first: 52 of 54 labelled commands right, and it catches aliases (`c` for `claude`). Only 8 of 105 real commands ran inside a git repo | **Go**; "by project" needs a fallback group | **Still to run:** a real phone for the canvas test, daemons on different addresses, a local control relay, and classification on real work (the real history was too thin to measure). **The plan as written:** - **Summary cost on the daemon:** - At M9's benchmark scale (500 panes on geek), what does a per-pane summary cost to keep and to send? The summary is cwd, command, `running`, attention, `current`/`last` command, bytes per second, and last output time. - Today every change sends the whole `State`. Measure that at 500 panes against field-level deltas batched to 1–2 Hz. - Measure bytes per second over the M18 relay with 10% of panes busy. - **Activity signal:** what does an output-rate EMA and `last_output_ms` cost when kept in the PTY reader? Does it wake parked panes (M9)? - **Previews:** what does rendering the last 6 lines of a pane from the VT grid cost (as `/api/panes/{id}/capture` does), at 1 Hz, for 50 visible panes? Compare that with sending output bytes and rendering on the client. - **Classification:** run heuristics over geek's and jake-mini's real panes, then hand-check them: - **kind** (shell, build, test, agent, server, logs, editor, or a block type) from the foreground command and process tree (`procinfo.rs`); - **project** from the cwd's git root. - **Fleet connections:** one browser holding summary connections to 5 and to 20 daemons at once, each its own Noise channel (direct, dial-out and relay). Check memory, reconnect storms after a laptop sleeps, and Chrome's Local Network Access prompt for many tailnet hosts. - **Rendering:** the prototype's canvas renderer, measured at 500, 2,000 and 5,000 panes on the laptop and a mid-range phone. Is Canvas 2D enough, or does it need WebGL? **Output:** a short write-up in `spikes/s16-swarm/`, with numbers for each item and go/no-go on delta summaries, server-side previews and Canvas 2D.
Author
Owner

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.
Author
Owner

Done 2026-10-02, apart from the phone runs: spikes/s16-swarm/README.md, merged in b0d6c1b. Results are in PLAN.md under "S16: swarm spike": go on delta summaries, previews and Canvas 2D (up to about 2,000 panes). Still to run: a real phone, daemons on different addresses, and a local control relay.

Done 2026-10-02, apart from the phone runs: spikes/s16-swarm/README.md, merged in b0d6c1b. Results are in PLAN.md under "S16: swarm spike": go on delta summaries, previews and Canvas 2D (up to about 2,000 panes). Still to run: a real phone, daemons on different addresses, and a local control relay.
Author
Owner

Closing: done 2026-10-02 and on main (b0d6c1b; PLAN.md, S16; spikes/s16-swarm/README.md). Its findings are in #37, #39 and #40. Still pending: a real phone run of the canvas, fleet connections across a real tailnet, and classification on a week of real panes, noted in the README.

Closing: done 2026-10-02 and on main (b0d6c1b; PLAN.md, *S16*; spikes/s16-swarm/README.md). Its findings are in #37, #39 and #40. Still pending: a real phone run of the canvas, fleet connections across a real tailnet, and classification on a week of real panes, noted in the README.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#36
No description provided.