M9: parking (scale) #10

Closed
opened 2026-10-02 00:16:05 +00:00 by jhgaylor · 2 comments
Owner

Depends on: #3

Trigger: Panes with real history still blow the memory budget after step 1 (rerun the S9 benchmark).

Step 1 (cheap memory wins) is split out as a separate issue and comes first.

From PLAN.md, section "M9".


Superlogical's server numbers are about 400KB per terminal against 5MB for
tmux, and unparking takes about 200µs.

  • Trigger: any one of these:

    • geek's daemon holds more than about 50 panes;
    • an agent fleet runs;
    • RSS per idle pane is measured above 2MB.

    Measure first. The milestone starts with a benchmark (RSS per pane at
    empty, full screen and 10k scrollback; per attached client) committed as a
    test.

  • Step 2: parking, only if panes with real history still blow the budget.
    S9 found nothing that argues for PTY or client-buffer parking. Parking
    can't save the shells and shims either (0.75–0.87 GB at 500 panes).

  • Stalled clients: a client that stops reading cost about 28 MB in one
    burst, and up to about 64 MB per client from the 1,024-frame queue. Cap the
    queue in bytes, not frames.

  • CI benchmark: S9's bench.py at 50 idle panes (3.07–3.11 MB per pane
    over four runs) is the regression test M9 wants. Leave headroom.

  • Terminal parking.

    • After 60s with no PTY reads, write the VT state as a GHOSTSNP checkpoint,
      using the M2 path and S5's format, and free the engine.
    • Typing doesn't unpark it.
    • Attaching streams the parked snapshot from disk.
    • Parked state is encrypted with the key decided for M4c.
  • PTY parking. Idle or unwatched PTYs move off their own read tasks onto
    one shared epoll task.

    • Parked PTYs keep each pane's output byte counter and last_output_ms current (#37's activity signal, from S16). Reading them never unparks a pane.
  • Client buffer parking. Free an idle client's per-pane buffers.

  • Done when:

    • 500 idle shells on geek cost under 1MB each in daemon RSS;
    • attaching to a parked pane draws it in under 50ms;
    • the benchmark guards against regressions in CI.
**Depends on:** #3 **Trigger:** Panes with real history still blow the memory budget after step 1 (rerun the S9 benchmark). Step 1 (cheap memory wins) is split out as a separate issue and comes first. _From PLAN.md, section "M9"._ --- Superlogical's server numbers are about 400KB per terminal against 5MB for tmux, and unparking takes about 200µs. - **Trigger:** any one of these: - geek's daemon holds more than about 50 panes; - an agent fleet runs; - RSS per idle pane is measured above 2MB. Measure first. The milestone starts with a benchmark (RSS per pane at empty, full screen and 10k scrollback; per attached client) committed as a test. - **Step 2: parking, only if panes with real history still blow the budget.** S9 found nothing that argues for PTY or client-buffer parking. Parking can't save the shells and shims either (0.75–0.87 GB at 500 panes). - **Stalled clients:** a client that stops reading cost about 28 MB in one burst, and up to about 64 MB per client from the 1,024-frame queue. Cap the queue in bytes, not frames. - **CI benchmark:** S9's `bench.py` at 50 idle panes (3.07–3.11 MB per pane over four runs) is the regression test M9 wants. Leave headroom. - **Terminal parking.** - After 60s with no PTY reads, write the VT state as a GHOSTSNP checkpoint, using the M2 path and S5's format, and free the engine. - Typing doesn't unpark it. - Attaching streams the parked snapshot from disk. - Parked state is encrypted with the key decided for M4c. - **PTY parking.** Idle or unwatched PTYs move off their own read tasks onto one shared epoll task. - Parked PTYs keep each pane's output byte counter and `last_output_ms` current (#37's activity signal, from S16). Reading them never unparks a pane. - **Client buffer parking.** Free an idle client's per-pane buffers. - **Done when:** - 500 idle shells on geek cost under 1MB each in daemon RSS; - attaching to a parked pane draws it in under 50ms; - the benchmark guards against regressions in CI.
Author
Owner

From S16: PTY parking must keep each pane's output byte counter and last_output_ms current (#37's activity signal).

From S16: PTY parking must keep each pane's output byte counter and last_output_ms current (#37's activity signal).
Author
Owner

Closing: the trigger doesn't hold after #3 (decided per #55; PLAN.md M9 "Step 2 … not now").

  • RSS per idle pane is 1.78 MB at 500 panes, under the 2 MB trigger. It was 3.30 MB; full table on #3 and #55.
  • Real use: geek's daemon holds 7 panes in 25 MB RSS (53 threads) after the 0.4.0 upgrade, far under about 50 panes.
  • Panes with full history are about 18 MB each now (they were up to 149 MB). 500 of them would be about 9 GB, which is the case parking would address.
  • The rest of the 1 MB done bar is libghostty's ReleaseSafe page fill: the upstream fix in #63, not parking.
    Reopen when geek holds more than about 50 panes with real history, or a fleet's daemon passes about 2 GB. memory.rs guards the idle cost in CI.
Closing: the trigger doesn't hold after #3 (decided per #55; PLAN.md M9 "Step 2 … not now"). - RSS per idle pane is 1.78 MB at 500 panes, under the 2 MB trigger. It was 3.30 MB; full table on #3 and #55. - Real use: geek's daemon holds 7 panes in 25 MB RSS (53 threads) after the 0.4.0 upgrade, far under about 50 panes. - Panes with full history are about 18 MB each now (they were up to 149 MB). 500 of them would be about 9 GB, which is the case parking would address. - The rest of the 1 MB done bar is libghostty's ReleaseSafe page fill: the upstream fix in #63, not parking. Reopen when geek holds more than about 50 panes with real history, or a fleet's daemon passes about 2 GB. memory.rs guards the idle cost in CI.
jhgaylor referenced this issue from a commit 2026-10-02 17:01:03 +00:00
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.

Depends on
Reference
jhgaylor/illogical#10
No description provided.