Perf squeeze: server hot paths, average and worst case #512
Open
opened 2026-10-16 18:39:39 +00:00 by kayg
·
29 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
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
kayg/calternal#512
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Measure current dev at 10k and 100k on SSD and HDD, profile the worst server costs, and make safe improvements without weakening durability or isolation. Evidence and gate output will be posted here.
Starting unattended performance work on branch issue/perf-squeeze. Base origin/dev:
312bc892ae. Five interleaved baseline passes per disk and Home size are planned. No merge or deployment is authorized.Environment finding: the initial local build stopped before compiling product code because cc is absent from PATH (error: linker
ccnot found). Located the installed Nix compiler and OpenSSL development files and set a job-only environment outside the repository. Release binaries are being built directly on the perf VM to use its native toolchain. SSD has 9.9 GB available and HDD 25 GB; all new VM files use a private perfsq-512 directory. No shared processes or build directories were changed.Baseline verification: local workspace Clippy completed successfully with all targets and warnings denied (exit 0). The job-only Nix compiler environment resolved the missing linker. Native release build on the perf VM is in final server LTO. The external 20-client probe is ready: 50 rounds per client, each with a page read, note read, search and durable notes.append, followed by checking all 1,000 unique writes exactly once. Baseline and after probes will use identical scripts and fixture seeds.
First baseline finding, SSD / 10k / one run (preliminary, not a before/after claim):
The largest waits so far are search catch-up and cold indexing. Note opens are already about 1–3 ms, so the historical fixed 51 ms open cost is gone on current dev. No correctness failures in this run. Continuing the interleaved matrix before selecting fixes.
Baseline correctness finding: cargo test --workspace finished with exit 0, including tests/isolation.rs and the note-room and action isolation tests. Baseline workspace Clippy also exited 0. First HDD/100k run is still doing the full warm workload. CPU profiling of cold indexing, search catch-up and journal catch-up is queued under the perf VM lock, using a separate copy so it does not change baseline fixtures.
First HDD / 100k baseline finding (one run, preliminary):
The cold-index CPU profile captured 6,085 samples with no lost samples over 55.3 seconds. Its top self symbol is _raw_spin_unlock_irqrestore at 13.39%, including futex wakes from malloc/realloc. Investigating allocation work in note descriptions before changing it. The profiler wrapper initially treated its intentional SIGINT as failure even though perf wrote valid data; fixed only the private wrapper to accept that exit. Remaining profiles are queued under the VM lock. Existing HDD budget breaches are recorded, not hidden.
Profiles of the three largest requested waits are now captured on the HDD / 100k Home using perf cpu-clock at 99 Hz with DWARF stacks. Cold indexing: 6,085 samples, no samples lost; allocator and futex work is prominent, tags::scan::spans is 7.56% self and starts_word 2.05%. Search catch-up: tags::scan::spans is 5.84% self, starts_word 1.41%, malloc 3.31%, and allocator/kernel wakeup costs dominate. Journal catch-up: JSON string serialization is 5.46% self, Value serialization 2.37%, SQLite execution 2.75%, malloc 3.13%, plus kernel/lock costs. Journal already serializes a typed response, so avoiding a JSON tree there would require a wider storage/API change; keeping this pass focused on the measured description costs shared by cold indexing and search.
First patch: plain cleaned lines borrow their text; formatting replacements run only when their marks occur; note description no longer copies the whole note. A new regression failed on the old code with
plain line should not allocate: "Plain text", then passed with the patch. Four search-description tests pass, including replacement order, links and Unicode.Second candidate: skip tag parsing on hash-free lines after fence tracking. A regression verifies that fences without hashes still hide code-block tags, including quoted/list fences. All six scanner tests passed before the change. Release and interleaved fixture benchmarks are queued under the VM lock. No durability settings or isolation paths are changed.
Fix 1 committed as
f9f8496f50: borrow unchanged cleaned lines and remove the whole-note copy during description. Five interleaved before/after passes over real fixture text (1,535,671 bytes, 17,588 lines; 30 cleaning/joining repetitions per pass) produced identical 1,441,863-byte output. Median before 319.417 ms, after 115.279 ms: 63.9% less time in this component. This is a component result, not a claimed whole-server speedup. Full HDD/100k measurement of the allocation-only binary is queued.Independent read-only review found no actionable issues. Final code passed cargo fmt --all --check, workspace Clippy with warnings denied, and workspace tests including isolation. Final gate output and full before/after tables will follow after the matrix.
Fix 2 committed as
be555c1dfc: skip tag parsing on lines without hashes, after fence tracking. The real-fixture corpus was 1,535,671 bytes with 1,960 tags. Every before/after span matched exactly. Across five interleaved passes of 30 repetitions, median component time fell from 348.028 ms to 142.184 ms (59.1% less). All six scanner tests and the full workspace suite pass, including the new fence regression. This component result does not substitute for the full matrix.Gate output verbatim at head
be555c1dfc, part 1/2. Local heavy commands used the required build-slot wrapper and four Cargo jobs.Gate output verbatim at head
be555c1dfc, part 2/2. Local heavy commands used the required build-slot wrapper and four Cargo jobs.Allocation-only full-server finding, HDD / 100k, one run per binary so far. The component speedup did not translate to a faster first whole-server sample. These samples were not adjacent, so they do not establish a regression or a gain; the interleaved matrix is needed. No correctness failures.
Both final patches are now built. Continuing all five before/after passes on both disks and sizes; no performance budget is being relaxed.
Build comparability finding: cargo tree shows that building only -p calternal enables fewer features than the baseline build selecting -p calternal -p calternal-perf -p calternal-fixtures. The differences are futures-util async-await/default/macro features and getrandom std/sys_rng. Both the allocation-only server sample and the first final-binary sample used the single-package build. Those server samples are invalid for before/after comparison and will be excluded from the final table, while retaining their evidence here. The standalone component benchmarks compare both functions in one binary, so those remain valid.
Rebuilding the final product with the exact baseline command and toolchain. A separate final matrix will run five valid passes per disk and size against that binary; baseline runs continue unchanged. The invalid after driver is being allowed to exit through a job-private harness wrapper that refuses its old binary. No process was killed. The old concurrency probe also refuses that invalid binary. Product head remains
be555c1dfc. No gate or budget is weakened.The matching release build passed with the exact baseline command: cargo build --release --locked -j4 -p calternal -p calternal-perf -p calternal-fixtures. Valid measurements now use the calternal-final binary and final-* reports; the earlier after-* reports are excluded. Product head is unchanged.
First valid SSD / 10k result, with baseline drift shown explicitly:
No correctness failures, and this valid final run passed the existing SSD budgets. The unchanged baseline itself moved from 2.252 to 1.530 seconds for cold indexing and from 6.016 to 4.012 seconds for search catch-up. No whole-server speedup claim from the first pair; finishing all five interleaved passes.
Testing an isolated follow-up hypothesis before deciding whether it belongs on the branch: search profiling showed heavy allocator/futex contention with 16 background file readers sharing the deployed two malloc arenas. A candidate with four readers will be built using the exact baseline package selection and measured at HDD / 100k. This changes only a concurrency bound, not durability or user isolation. The candidate lives in a private VM source directory; branch head and the valid final matrix remain unchanged. If it does not improve whole-server results, it will be rejected and recorded here.
First valid final HDD / 100k comparison (preliminary; n=1 final, not a five-run conclusion):
No correctness failures. Cold indexing is lower than both initial baselines, search catch-up is within their range, and save acknowledgement still has a large outlier. Existing HDD budget breaches remain visible. Continuing the matrix and the isolated four-reader experiment.
Rejected the four-reader candidate; branch remains
be555c1dfcwith the two measured component fixes. One HDD / 100k sample for each bound does not show a worthwhile whole-server gain. Cold indexing and API p95 were worse with four, search catch-up was nearly unchanged. No correctness failures.Independent review also noted that the limit is process-wide, so lowering it may amplify cold-discovery and cross-user queue delays if throughput does not improve. Keeping sixteen is the safer choice. The candidate was tested only in private VM sources and was never committed. Continuing the existing five-pass before/final matrix and the scheduled 20-client probes.
The first full idle sample is complete: baseline dev
312bc892, SSD, 10k notes, pass 5. After the Home settled and rooms closed, the 300-second window recorded idle.cpu_ticks = 0, idle.cpu_pct = 0.0%, idle.wakeups_per_s = 0.0, idle.rss = 26.53515625 MB and 11 threads. The harness reports no correctness failures. This is RSS after use; startup mem.idle is measured separately. The other idle cells and after comparison are still running under the VM lock.Baseline complete at dev
312bc892ae: five interleaved runs per disk and Home size, 20 reports total. Each run includes cold indexing and the full warm workload. Page cache was dropped before starts. Pass 5 adds the stock 60-second typing load and 300-second idle sample after rooms settle. All reports contain the required metrics, fixture sizes match, and there are no correctness failures.Per-run p50/p95 values use the harness median rule; single-value metrics pool the five runs, and max is the largest sample. Idle metrics have one sample per cell. Memory follows the harness MB label (MiB). Search catch-up includes the extra quiet checks around typing and idle in pass 5.
before: ssd, 10000 notes, 5 interleaved runs
before: ssd, 100000 notes, 5 interleaved runs
before: hdd, 10000 notes, 5 interleaved runs
before: hdd, 100000 notes, 5 interleaved runs
Baseline budget messages below are verbatim. Baseline runs did not use --gate, so exit 0 means the harness completed; it does not mean all budgets passed.
Baseline 20-client mixed reads and writes is complete on both disks, at dev
312bc892. Each probe starts a fresh server on the indexed 100k-note Home after its matrix finishes, waits for note and search indexes to settle, then runs 20 clients without think time. Each client makes 50 rounds of page, note, search and durable append requests, rotating the order. There are 1,000 samples per operation and disk. All 1,000 appended markers per disk were found exactly once. Each run held the perf VM lock.The HDD search tail reaches 1.707 seconds and durable append reaches 879.829 ms. The full before/after tail table will be added after the final probes. This is a closed-loop mixed workload: slower writes reduce the rate of subsequent reads, so the disks should be compared within the same phase and operation rather than ranked from read latency alone.
Startup RSS check at base
312bc892and headbe555c1is complete. Twenty interleaved starts per binary, alternating order, after one discarded warmup pair. Both binaries use the same indexed 10k Home and stock allocator/log settings. RSS is sampled immediately after healthz, without opening a Home. The entire comparison held the perf VM lock.The median difference is 0.050781 MiB (0.371%), within the observed process-to-process spread. Baseline also produced a 14.03125 MiB sample. The higher single sample in the full matrix does not show a sustained startup memory increase. All maxima remain visible above.
The first after 300-second idle sample (SSD, 10k notes) recorded 0 CPU ticks, 0 wakeups/s, 11 threads and 26.7578125 MiB RSS after use, versus baseline 26.53515625 MiB. The other three after idle cells are still running.
The primary HDD/100k after cell is complete (five runs). Cold-index median is 42.414 s versus 49.445 s before; save-ack p95 is 58.937 ms versus 82.811 ms, while its maximum is worse: 1995.020 ms versus 1218.771 ms. Shutdown maximum is also worse (3331.564 versus 3082.647 ms). These maxima will remain in the report.
The 300-second idle window recorded zero CPU ticks and wakeups, but RSS after use is 43.30859375 MiB versus baseline 37.9375 MiB. Startup mem.idle medians remain 13.22265625 versus 13.2890625 MiB. A single after-use RSS sample is insufficient to decide whether the 5.37109375 MiB difference is allocator variation or a regression. I have queued one additional full HDD/100k run per binary, each with the same 300-second idle window, under the VM lock. These validation repeats are separate from the primary five-run table and use the completed baseline work directory, leaving the final mixed-probe input untouched.
The primary SSD/100k after idle sample is complete: 0 CPU ticks, 0 wakeups/s, 11 threads and 39.5078125 MiB RSS after use, versus baseline 41.7890625 MiB. Thus the primary after-use RSS change has opposite signs on SSD (-2.28125 MiB) and HDD (+5.37109375 MiB). Both 100k cases remain asleep when idle. The additional full HDD before/after validation pair is now running to check process-to-process variation; no conclusion about the HDD RSS difference is being hidden or assumed.
The additional full baseline HDD/100k run is complete, with no correctness failures. Its 300-second idle sample recorded 0 CPU ticks, 0 wakeups/s and 47.19921875 MiB RSS after use. The unchanged baseline therefore spans 37.9375 to 47.19921875 MiB across its two full idle samples (9.26171875 MiB spread). The primary after sample, 43.30859375 MiB, falls inside that observed baseline range. This supports process-to-process allocator variation rather than a sustained RSS increase; the matching after repeat is still queued and will be reported too.
The repeat also shows why wall times need care: baseline cold indexing was 43.431 s in this run, versus the primary five-run median 49.444537 s. Save-ack p95 was 66.096 ms and maximum 211.471 ms. The primary maxima, including the worse after maximum, remain in the report. Direct same-executable CPU benchmarks are the clearest evidence for the individual fixes.
The primary before/after matrix is complete and audited: 40 reports, five per phase/disk/size, matching fixtures, required metrics present and no correctness failures. Only the comparable before-* and final-* builds are used. Aggregate gated budgets pass on SSD; HDD still exceeds cold startup, API get, save ack and (100k) shutdown limits. Eleven individual after invocations returned gate exit 1; ten were HDD and one was an SSD API-get sample.
Before/after server performance. Base
312bc892ae; headbe555c1dfc. Same release toolchain, fixture seed and harness; dropped page cache before each start. Five interleaved runs per cell. Latency distributions use the median of per-run p50/p95, and max is the largest sample. Single-value metrics pool the runs. Idle measurements use one 300-second sample per cell after rooms settle. Both binaries were built with matching Cargo feature unification:cargo build --release --locked -j4 -p calternal -p calternal-perf -p calternal-fixtures. Each invocation resets from the pristine seed-1 fixture and includes one cold and one warm run; pass 5 also includes the stock 60-second typing load and extra quiet checks. Memory follows the harness MB label (MiB).ssd-10000
ssd-100000
hdd-10000
hdd-100000
Aggregate budget findings (same percentile method as the harness):
After gate messages below are verbatim. These are budget failures, not correctness failures.
The additional full HDD/100k validation after run and final 20-client probes are still running. Their complete results will follow before the PR is opened.
All measurements are complete at
be555c1dfc: 40 primary cold/warm invocations plus two full HDD validation invocations, with no correctness failures. All four 20-client probes verified their 1,000 durable appends exactly once. All 10 full idle windows met CPU and wakeup budgets (zero CPU ticks throughout; at most one wakeup in 300 seconds).The full paired HDD validation idle RSS is 47.19921875 MiB before and 47.2109375 MiB after, a 0.01171875 MiB difference. The primary after RSS lies within the observed unchanged-baseline variation. Together with the 20 interleaved startup checks, the measurements do not show a sustained idle RSS increase.
Worst-case results remain mixed. SSD append p99 rose from 155.103 to 302.955 ms, and HDD search p99 from 1113.187 to 1851.468 ms. HDD append p99 improved from 872.065 to 593.469 ms. These are single concurrency probes per phase/disk in a closed-loop workload. Faster reads can increase the subsequent write rate, so the table is evidence of observed behavior rather than proof that every tail improved. The PR will be marked work in progress for these tail regressions and the remaining HDD gate failures.
20 concurrent clients on an indexed 100k-note Home, after note and search indexes settle. No think time. Each client runs 50 mixed rounds with page, note, search and durable append operations. Each operation has 1,000 samples per phase and disk; all 1,000 appended markers were verified exactly once. Latencies are milliseconds.
ssd post-load RSS / peak RSS (MiB): before 102.371 / 102.371; after 91.383 / 91.383.
hdd post-load RSS / peak RSS (MiB): before 97.363 / 97.363; after 103.289 / 103.289.
Additional HDD/100k validation pair. One full cold and warm run per binary, including the same 60-second typing load and 300-second idle window. Both runs reset the completed baseline work directory from the same pristine fixture. These are separate from the primary five-run table. Each run held the VM lock.
Validation gate output, verbatim:
Finished the perf squeeze job at head
be555c1dfc, on issue/perf-squeeze, based on dev312bc892ae. The branch is pushed and one PR is open into dev: #514The PR is marked WIP because HDD performance gates remain red and some concurrent p99/max results worsened. It contains the complete primary before/after table, concurrent tails and validation memory/tail results. Two product commits reduce search-text allocation and skip tag parsing on lines without hashes. Direct same-executable benchmark times fell 63.9% and 59.1%, with identical output. These are function benchmarks, not a claim that every endpoint or tail improved.
All 40 primary reports and both full HDD validation reports have no correctness failures. All four 20-client probes verified 1,000 appends each exactly once. All 10 full idle windows met CPU/wakeup budgets. The paired full idle RSS was 47.199 versus 47.211 MiB; the separate 20-start checks found a 0.051 MiB median difference within process variation.
The before/after perf table: #512 (comment)
Concurrent and additional full validation tables: #512 (comment)
Code gate output below is verbatim for this head. All local heavy code gates ran through the approved build-slot wrapper with four Cargo jobs and the requested external target directory.
Primary after perf gate output, verbatim:
Additional full validation perf gate output, verbatim:
The issue remains open. The PR has not been merged.
Starting the clean tail and HDD durability measurements for issue #512. Branch: none (read-only job as requested). Worktree: detached at origin/dev. Base SHA:
080c55e184.#512 tails re-measure and HDD save profile (2026-10-17)
TL;DR
notes.listp95/p99 at 20 clients reads 1.1–1.2× in B on both disks (p 0.08–0.71). #514 doesn't touch the list path, so this is most likely noise. A re-run after merge would settle it.notes.appendcosts more as its note grows. On SSD, 1-client append p50 rose from 12 to 125 ms as the probe notes reached about 3,500 lines. Each append forks the whole document (ydoc::fork(state)). This is worth its own issue.notes.getp99 of 600–680 ms when its p95 is about 75 ms.sync.save_ackp95 ≤ 40 ms budget is reachable on this disk only if saves and checkpoints stop queueing in front of the history commit./root/perf-vm.lock. Raw data is on the perf VM in/root/tails-512/out.Does #514 regress tails?
No. Headline (p99 at 20 clients, 10 paired rounds, 1,000 samples per action per start):
Milliseconds. The full tables (1, 5 and 20 clients; p50, p95, p99 and max; both disks) follow.
How it was measured
devat080c55e. B is the same tree merged withissue/perf-squeeze(be555c1). The merge is clean (tree 3d8a47a), and onlycrates/notes/src/search.rsandcrates/notes/src/tags/scan.rsdiffer. Both were built on the perf VM with the baseline commandcargo build --release --locked -j4 -p calternal -p calternal-perf -p calternal-fixtures, each in its own target dir. A first build that shared one target dir produced a B byte-identical to A, because cargo tracks workspace sources by the first checkout's path. That build was caught by its sha256 and thrown away before any measurement.calternal-fixturesand indexed once by A. One copy is on the SSD (/root, ext4) and one on the HDD (/mnt/b/hdd-ext4, rotational), the same disks as #514's probe. A and B share each Home: #514's search text is byte-identical, so the index is identical./root/tails-512/tails.py): the same op mix as #514'smixed.py. Each client runs rounds ofnotes.list(50),notes.getof its own note,search.queryand a durablenotes.appendwith an Idempotency-Key, with the order rotated per client and no think time. After each phase, every appended marker is checked to be in the note exactly once (all passed). One server start runs three phases: 1 client × 200 rounds, 5 × 100 and 20 × 50, giving 200, 500 and 1,000 samples per action. There is an 8 s gap between phases so debounced saves finish.GLIBC_TUNABLES=glibc.malloc.arena_max=2andRUST_LOG=warnmatch the harness.sync, drop the page cache, and take the VM lock.perf record -a -e ext4:ext4_sync_file_enter,ext4_sync_file_exit(kernel tracepoints, low overhead) plus the server's ownhistory.commitdebug lines. It ran on sample notes never written before (manifest samples 100+), on both disks, at 1, 5 and 20 clients. A first try withstrace -fslowed the server about 10× and distorted the save count (900 saves instead of about 140), so it was discarded.Full A/B tables
SSD, 1 client
10 paired rounds; 200 samples per op per start.
SSD, 5 clients
10 paired rounds; 500 samples per op per start.
SSD, 20 clients
10 paired rounds; 1000 samples per op per start.
HDD, 1 client
10 paired rounds; 200 samples per op per start.
HDD, 5 clients
10 paired rounds; 500 samples per op per start.
HDD, 20 clients
10 paired rounds; 1000 samples per op per start.
Side finding: append cost grows with the note
Per start, the 1-client
notes.appendp50 for the probe note (paired A and B agree):The probe note grows by about 350 lines per start (to about 3,500 by round 10), and append p50 grows about 10× with it.
api_editstarts every append byydoc::fork(Some(&ydoc::state(doc))), which encodes and decodes the whole document, and the save then rewrites the whole file. The same fork-per-append pattern applies to long daily logs. This deserves its own issue (measure-first), separate from #514.HDD: where save time goes
Raw fsync cost of each disk (fio, 4 KiB writes, queue depth 1, 20 s each)
SQLite already calls
fdatasyncon its WAL (seen in the traces), so that saving is already taken. On a new or growing file,fdatasynccosts as much asfsync, because the file's size has to reach the journal either way.What one save does today (from the code)
Notessave (crates/notes/src/room/save.rs), with the room busy the whole time:settle(): typing still on its way to history lands first (usually already done).last edited, at most once a minute) are written as small edits through history.set_pending(one WAL commit, fdatasync) and the new file written under a temp name andfsynced.renameat2(RENAME_EXCHANGE)swaps it in, then the Notes folder isfsynced.promote(one more WAL commit), which the room waits for.On ext4, steps 4 and 5 are two journal commits. The "Saved" check (
sync.save_ack) andnotes.appendwait only for the history commit of the change itself. File saves happen 750 ms after the last change, or 5 s after the first unsaved one, but they share the disk with those commits, and they block the note's room.Where save time goes: traces
All disk-sync time (ext4
fsync/fdatasyncenter→exit, every thread), grouped by file. "share" is the share of all sync wait in the traced window. The history commit line comes from the server's ownhistory.commitdebug log (the time the writer thread holds a transaction, including its fsync).HDD, 1 client(s), fresh notes
history commits: 212; writes per commit mean 1.00, p95 1, max 1; commit time p50 27.0 p95 103.0 p99 176.2 max 218.8 ms
probe 1 clients, wall 20.6 s; page p50 5 p99 20; get p50 3 p99 137; search p50 14 p99 440; write p50 37 p99 218
traced window 20.4 s; total sync wait 9.30 s
HDD, 5 client(s), fresh notes
history commits: 319; writes per commit mean 1.81, p95 4, max 4; commit time p50 34.2 p95 100.8 p99 156.6 max 198.9 ms
probe 5 clients, wall 21.6 s; page p50 12 p99 60; get p50 6 p99 352; search p50 33 p99 1219; write p50 77 p99 463
traced window 24.6 s; total sync wait 23.19 s
HDD, 20 client(s), fresh notes
history commits: 423; writes per commit mean 3.25, p95 9, max 19; commit time p50 43.4 p95 121.5 p99 200.0 max 302.1 ms
probe 20 clients, wall 30.2 s; page p50 33 p99 135; get p50 13 p99 566; search p50 198 p99 4383; write p50 147 p99 1111
traced window 32.7 s; total sync wait 77.62 s
SSD, 20 clients, fresh notes (for contrast)
history commits: 658; writes per commit mean 1.94, p95 5, max 15; commit time p50 16.1 p95 76.8 p99 141.8 max 206.9 ms
probe 20 clients, wall 21.2 s; page p50 38 p99 169; get p50 14 p99 236; search p50 200 p99 813; write p50 100 p99 463
traced window 23.7 s; total sync wait 21.64 s
How to read the tables:
notes.appendp50 37 ms on HDD against a 21 ms fdatasync). Backgroundmeta.dbcheckpoints come second (23%, 59 ms each). The note list re-describes the note after every change, and its WAL checkpoints about every 16 appends.notes.get(served by the room) andnotes.appendto that note wait behind it. That is the long tail: on HDD at 20 clients, get p50 is 12 ms and p95 74 ms, but p99 is 600–680 ms.OPTIONS for kayg (nothing built; kayg decides)
What "safe" means today (ADR 0020): "Saved" means the change is in
history.db(synchronous=FULL), so a power cut never loses an acknowledged change. The file is written after history, and crash recovery uses the pending row to tell our half-finished save from an outside edit. Gains are estimated from the traces above (HDD, 20 clients, fresh notes) unless marked as measured.notes.getp99 from ~600–680 ms toward its ~75 ms p95, andnotes.appendp99 down by about one save (~300 ms). No change at 1 client (few saves).tests/kill9.rs,save::crash) re-run with edits arriving mid-save.fsyncof the folder covers them all, then all are answered.Notes/), so batches would be large.promote. Queue it in the history writer (FIFO, so it still commits before any laterset_pending), and free the room right after the folder fsync.set_pendingis ordered after this promote by the single writer. Worth a crash-point test before trusting it.history.db,meta.dbandindex.db(wal_autocheckpoint=0, then PASSIVE checkpoints in a quiet moment, assearch.dbalready does).history.dbstays synchronous=FULL.sync.save_ackand append, and no p50 change.journal_size_limit).fdatasyncinstead offsyncfor the note temp file and folder..mdfile trails the live note longer (Obsidian or sync tools see edits later), and an outside edit made meanwhile is merged later.Not options, because they are already in place: history group commit (measured 3.25 writes per commit at 20 clients), one history fsync per acknowledged change,
fdatasyncon SQLite WALs, andsynchronous=NORMALon the rebuildable databases (meta, index journal, search). "Defer index writes" therefore means O4 for checkpoints, plus optionally coalescingmeta.dbrefreshes longer under load. That second part is rebuildable data with no durability effect, and it is worth about 5–23% of HDD sync wait (largest at 1 client).Suggested order, if kayg wants any: O4 (small, same guarantee) → O2 → O1 (biggest tail win, needs the crash tests) → O3 folded into O1. Skip O5. O6 is a product call. Never O7 as written.
Reproduce
All on the perf VM (
root@10.69.69.63), scripts in/root/tails-512/:build.shandbuildB.sh(builds),prep.sh(Homes),rounds.sh(ROUNDS="1 2 …" PHASES=1:200,5:100,20:50),profile3.sh(traced fresh-note runs),tails.py(probe;--ktrace,--offset N). Results:/root/tails-512/out/(r*-{ssd,hdd}-{A,B}.jsonhold every sample;kf-*.perf.txtandkf-*.server.loghold the traces). Binaries and the fixture:/mnt/z4-nvme/tails-512/. The two test Homes and the build dirs were deleted afterwards to give the root disk its space back (it sits at 98%).kayg referenced this issue2026-11-05 23:21:12 +00:00