Repository navigation
sminos 1.46.1: an idle uplink stops re-reading what did not move - #489
Merged
Merged
Conversation
…ks a host file only once it moved An idle uplink opened every open project's uplink.json three times each upload pass (dead, voided, host_sent: 37 % of its 7,550 file calls a second on the MacBook) and walked every event of every host file each pass. - HubLog.state reads through sminos.json_at: a stat while the file holds still (save writes it whole, by rename), a new dict for each caller. - Link.upload_pass reads it once for a project's turn and hands it to the upload's fresh draw (dead and voided) and the host pass (host_sent); keep_host_sent reads it once. - The host pass skips a host file whose _log_file_held key did not move and whose session writers' events are all at or below host_sent as it is now (HubLog.host_files); `again` walks every one. - HubLog.is_own builds its set of names once per machine_identity tuple, which a renaming welcome replaces. - desk() reads the plugin manifest by stat: a version bump alone restarts no uplink, so once a process would report a stale version. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…each log a generation recorded_project (and last_project, same shape) walked every registered project for each session whose directory the uplink may not read, opening log/<name>.<session>.jsonl under every machine name and statting a missing streams.json each time: 26 sessions x 101 projects x 1.65 names on the MacBook every cache generation, nearly every open failing (the 10 s bursts, 22 % of the uplink's file calls). - _holding_projects lists projects/ and each project's log/ once a cache generation (_log_listed, cleared with _RECORDED) and yields only the projects whose log holds a writer file of the session under its name now or a former one that held it, plain or an audience stream; no lstat of each project.json, since known_project reads it anyway. - _writer_events, given the listing, opens only listed files and reads streams.json only once a stream file of the writer is listed. - known_projects lists projects/ instead of globbing, in sorted(glob)'s order, without glob's lstat of every project.json. - withheld asks getcwd only for a path inside a protected folder. - words_due and reach_due read the shared merged log, so addressees' log_memo holds while no file moved; nothing they hand out is changed in place (the asks keep the events, the frames copy them, deliver_verdict, deliver_reach and words_unanswered read the log again). Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…st in TECH-DEBT The doctrine paragraph of scripts/CLAUDE.md states what the upload pass reads by stat and once, what one log listing a generation answers, and what the host pass skips. TECH-DEBT's "sminos uplink idle cost" holds what was left out on purpose (the second member publish, seats() per member read, the whole own-writer look at each scan, Plane.tick's unconditional forget, the host and outbox probes), each with its measured share and its trigger, and what bench_scale.py lacks to reproduce the cost. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ed, never a kept listing The generation's listings (_holding_projects) are filled by the first session asked and reused for every later one, so a session's first last_project lookup in a generation could miss a writer file or audience stream made after the listing. While the statements are unknown, _session_project takes that answer as the session's project and a reconciliation can move it there (reviewer-high, P2). last_project goes back to 1.46.0's read: the registrations globbed at the call, known_project, _own_events with no listing. The listings stay recorded_project's alone, whose answer is a Guessed nothing joins, moves or retires on. The doctrine, the docstrings and TECH-DEBT say so; the regression tests ask another session first in the generation, then write a newer joined (plain, and in an audience stream) and require last_project to answer the new project. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
sminos daemon uplinkidled at 11–13 % of a core on two Macs. A file-call trace of one of them (58 hub projects open, 101 registered, 73 seats, nobody speaking) showed about 7,550 file calls a second:uplink.jsonopened and parsed three times on every upload pass (1.6 passes a second), by a read that was outside the stat-keyed cache.getcwdbefore knowing a path is in a protected folder, the plugin manifest opened once per project per presence pass, and smaller sites.On the interpreter side, the words and reach passes copied and re-indexed every log every 10 s (the memo was keyed on a list that was a fresh copy each time), and the host pass walked every host event on every pass.
What changes
Nothing the daemon does or when it notices a change, with one exception noted below.
HubLog.state()readsuplink.jsonby stat (json_at), and one project's turn in a pass reads it once (Link.upload_pass).recorded_projectlists each project'slog/once per cache generation and reads only the projects that hold a writer file of the session (plain or an audience stream, under the name now or a former one). Its answer is always aGuessed, which nothing joins, moves or retires a session on.last_project, whose answer a reconciliation does act on, reads every project's files at the time of the call, as before.known_projectslistsprojects/without glob's extra lstat.withheld()asks for the working directory only for a path inside a protected folder.desk()reads the plugin manifest by stat.words_due/reach_dueindex the shared merged log, so the addressee index is kept while no file of the log moves. Every consumer only reads the events; the ask frames copy them.Link.host_passskips a host file that has not moved since a pass found nothing in it past the cursor;HubLog.is_ownkeeps its set of names while the identity holds.The one difference: a
streams.jsonentry naming a stream whose file was never written no longer triggers the registration repair thatwriter_pathdid as a side effect of that read.Left for later, in
docs/doperpowers/TECH-DEBT.mdwith measured shares and triggers: publishing members once a tick, oneseats()per member read, how often the whole own-writer look runs, when the plane forgets its caches, the probes for projects with no local member, and whatbench_scale.pylacks to reproduce this cost.Tests
sminos/tests/test_idle_reads.py(21 tests) counts calls rather than time: no open of an unchangeduplink.json;recorded_projectandlast_projectequal the 1.46.0 implementation on a fixture with a former name, a stream-only session and a moved retirement;recorded_projectmakes no failed open and at most one listing of eachlog/per generation;last_projectsees a writer file or a stream written after another session's lookup in the same generation; nogetcwdoutside protected folders; one addressee index across passes over an unchanged log; an unchanged host file not walked again, and an appended event, a cursor that went back and a rename all followed.After it is installed
The same trace on the same machine, for the before and after figures.
Hold the merge until the P5 closing run's machine swaps are done: a sminos update restarts the daemons.
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)