Storage: history commits p99 46-190 ms from WAL checkpoints; saves stall under big uploads #298

Closed
opened 2026-10-14 15:09:36 +00:00 by kayg · 6 comments
Owner

From the #14 benchmark (#14 (comment)), on the perf VM:

  • History commits with SQLite: p99 is 46–190 ms on every volume, even with synchronous=NORMAL, against a target of under 10 ms. The spikes come from WAL checkpoints.
  • Note saves during a 1 GB copy (an upload): p99 is 1.6 s on 4K NVMe; on HDD the median is 10–21 s.

Proposed work, measured before and after on the perf VM:

  1. Group commit for history writes: batch updates that arrive within a few ms into one transaction.
  2. Checkpoints off the hot path: wal_autocheckpoint=0, plus a background PRAGMA wal_checkpoint(PASSIVE) on a timer or above a size threshold, with TRUNCATE when idle.
  3. Uploads must not starve note saves:
    • write uploads with bounded dirty data (periodic sync_file_range/fdatasync in chunks), or at a lower IO priority (ioprio/posix_fadvise);
    • keep notes and DBs on NVMe, with attachments allowed on HDD.
  4. Deploy: 4K volblocksize zvols with XFS for prod's data disk. Plan the migration separately and carefully.

Pass when the history-commit p99 is under 10 ms and the save p99 is under 50 ms during a 1 GB upload on NVMe.

From the #14 benchmark (https://git.kayg.org/kayg/calternal/issues/14#issuecomment-48251), on the perf VM: - **History commits** with SQLite: p99 is 46–190 ms on every volume, even with `synchronous=NORMAL`, against a target of under 10 ms. The spikes come from WAL checkpoints. - **Note saves during a 1 GB copy** (an upload): p99 is 1.6 s on 4K NVMe; on HDD the median is 10–21 s. **Proposed work, measured before and after on the perf VM:** 1. **Group commit for history writes:** batch updates that arrive within a few ms into one transaction. 2. **Checkpoints off the hot path:** `wal_autocheckpoint=0`, plus a background `PRAGMA wal_checkpoint(PASSIVE)` on a timer or above a size threshold, with TRUNCATE when idle. 3. **Uploads must not starve note saves:** - write uploads with bounded dirty data (periodic `sync_file_range`/fdatasync in chunks), or at a lower IO priority (`ioprio`/`posix_fadvise`); - keep notes and DBs on NVMe, with attachments allowed on HDD. 4. **Deploy:** 4K volblocksize zvols with XFS for prod's data disk. Plan the migration separately and carefully. Pass when the history-commit p99 is under 10 ms and the save p99 is under 50 ms during a 1 GB upload on NVMe.
Author
Owner

Findings so far (perf VM, 4K XFS on the NVMe and HDD zvols)

Measured with a new storage-bench (crates/perf) that drives the real code: History::append with 4 readers going (history), and Notes::save including the change journal (save), optionally while a 1 GB file is written over and over (upload). Every row is the median of 3 runs, caches dropped before each, all under flock /root/perf-vm.lock. Raw data: /root/i298/results.jsonl on the VM.

1. The disk itself has a p99 of 5 to 60 ms per flush

A raw 4 KiB pwrite + fdatasync loop on /mnt/z4-nvme (2000 flushes), at four points tonight:

p50 p90 p99 p99.9
4.9 10.3 51.8 138
3.9 8.1 61.4 373
2.5 3.4 5.4 12.6
4.1 7.1 27.3 141

A durable history commit needs at least one flush, so a commit p99 under 10 ms is not reachable on this VM with history kept durable before "Saved" (ADR 0020): the flush alone is above it most of the night. It swings a lot with whatever else the host pool is doing.

2. The p99 spikes were not the checkpoint

I moved checkpoints off the commit path (wal_autocheckpoint=0 plus a checkpoint thread: PASSIVE every 500 ms while writing, TRUNCATE after 2 s quiet) and measured it against dev:

history, 1 writer, NVMe p50 p90 p99 tx/s
dev 11.6 19.2 61.7 68
checkpoint thread 11.4 18.4 58.4 70

No difference beyond noise, and worse: with writes never pausing, a separate checkpointer can never let the log start over, so the WAL grew to 83 MB in a 4000-commit run (dev stays at 4.8 MB). I dropped it. The tails come from the disk (point 1).

3. What does cost: SQLite uses fsync, not fdatasync

The SQLite that rusqlite bundles is built without HAVE_FDATASYNC, so it flushes with fsync() (strace on the VM: one fsync per commit, no fdatasync). fsync also writes the file's times, so each commit waits for the file system's log too. With LIBSQLITE3_FLAGS=-DHAVE_FDATASYNC=1, locally (ext4 SSD) a history commit goes from p50 7.2 / p99 19 ms to p50 3.6 / p99 8 to 12 ms, and throughput from 122 to 245 commits/s: one flush per commit, as the raw disk. VM numbers for this follow.

4. A save made four flushes in a row

Pending record (history), the temp file, the folder, the "done" record. Now the temp file is written and flushed while history records the pending save (swapped in only once that is durable), and "done" is queued without waiting (a crash keeps the pending row, which matches the file; the next start promotes it, as load.rs already does):

note save, NVMe, no upload p50 p90 p99
dev 39.8 53.6 127.5
overlapped save 16.2 27.2 134.6
dev, 300 KB note 59.8 89.9 117.4
overlapped save, 300 KB note 31.0 47.8 91.3

p50 halves; p99 stays at the disk's noise (point 1).

5. Uploads: bounded steps help, going around the cache hurts

On a ZFS volume a flush carries everything written to the volume before it, so a note save during an upload waits for the upload's data. Saves during a looping 1 GB write on the same NVMe volume:

upload written as save p50 p90 p99 upload MB/s
dev (all of it, one fsync at the end) 71.5 1597 2191 458
O_DIRECT, 4 MiB steps 446 1202 1857 466
fdatasync every 4 MiB 115 220 490 130
fdatasync every 1 MiB 33 50 105 94
fdatasync every 256 KiB 27 44 103 48
dev's way, but to the HDD volume (notes on NVMe) 21 40 120 158

(The 1 MiB / 256 KiB / other-disk rows also have the overlapped save, so compare their tails, not the p50; a clean same-build comparison follows.) 1 MiB steps take the save p99 from 2.2 s to about 100 ms, roughly what saves see with no upload at all; the upload drops to about 95 MB/s, still close to what gigabit brings in. Putting attachments on another volume than notes and DBs is just as good, so the deploy layout in point 4 of the issue stands.

Plan

  • PR: SQLite fdatasync (build flag) + storage-bench.
  • PR: overlapped save.
  • PR: uploads in 1 MiB steps (write_atomic and a new write_atomic_from).
  • PR (#297): save at least every 5 s while someone types nonstop.

Running now: the full #44 harness (10k and 100k) dev vs all of the above, then the final same-build before/after on NVMe and HDD.

## Findings so far (perf VM, 4K XFS on the NVMe and HDD zvols) Measured with a new `storage-bench` (crates/perf) that drives the real code: `History::append` with 4 readers going (history), and `Notes::save` including the change journal (save), optionally while a 1 GB file is written over and over (upload). Every row is the median of 3 runs, caches dropped before each, all under `flock /root/perf-vm.lock`. Raw data: `/root/i298/results.jsonl` on the VM. ### 1. The disk itself has a p99 of 5 to 60 ms per flush A raw 4 KiB `pwrite` + `fdatasync` loop on `/mnt/z4-nvme` (2000 flushes), at four points tonight: | p50 | p90 | p99 | p99.9 | |---|---|---|---| | 4.9 | 10.3 | 51.8 | 138 | | 3.9 | 8.1 | 61.4 | 373 | | 2.5 | 3.4 | 5.4 | 12.6 | | 4.1 | 7.1 | 27.3 | 141 | A durable history commit needs at least one flush, so **a commit p99 under 10 ms is not reachable on this VM** with history kept durable before "Saved" (ADR 0020): the flush alone is above it most of the night. It swings a lot with whatever else the host pool is doing. ### 2. The p99 spikes were not the checkpoint I moved checkpoints off the commit path (`wal_autocheckpoint=0` plus a checkpoint thread: PASSIVE every 500 ms while writing, TRUNCATE after 2 s quiet) and measured it against dev: | history, 1 writer, NVMe | p50 | p90 | p99 | tx/s | |---|---|---|---|---| | dev | 11.6 | 19.2 | 61.7 | 68 | | checkpoint thread | 11.4 | 18.4 | 58.4 | 70 | No difference beyond noise, and worse: with writes never pausing, a separate checkpointer can never let the log start over, so the WAL grew to 83 MB in a 4000-commit run (dev stays at 4.8 MB). I dropped it. The tails come from the disk (point 1). ### 3. What does cost: SQLite uses `fsync`, not `fdatasync` The SQLite that rusqlite bundles is built without `HAVE_FDATASYNC`, so it flushes with `fsync()` (strace on the VM: one `fsync` per commit, no `fdatasync`). `fsync` also writes the file's times, so each commit waits for the file system's log too. With `LIBSQLITE3_FLAGS=-DHAVE_FDATASYNC=1`, locally (ext4 SSD) a history commit goes from p50 7.2 / p99 19 ms to **p50 3.6 / p99 8 to 12 ms**, and throughput from 122 to 245 commits/s: one flush per commit, as the raw disk. VM numbers for this follow. ### 4. A save made four flushes in a row Pending record (history), the temp file, the folder, the "done" record. Now the temp file is written and flushed while history records the pending save (swapped in only once that is durable), and "done" is queued without waiting (a crash keeps the pending row, which matches the file; the next start promotes it, as load.rs already does): | note save, NVMe, no upload | p50 | p90 | p99 | |---|---|---|---| | dev | 39.8 | 53.6 | 127.5 | | overlapped save | 16.2 | 27.2 | 134.6 | | dev, 300 KB note | 59.8 | 89.9 | 117.4 | | overlapped save, 300 KB note | 31.0 | 47.8 | 91.3 | p50 halves; p99 stays at the disk's noise (point 1). ### 5. Uploads: bounded steps help, going around the cache hurts On a ZFS volume a flush carries everything written to the volume before it, so a note save during an upload waits for the upload's data. Saves during a looping 1 GB write on the same NVMe volume: | upload written as | save p50 | p90 | p99 | upload MB/s | |---|---|---|---|---| | dev (all of it, one fsync at the end) | 71.5 | 1597 | 2191 | 458 | | `O_DIRECT`, 4 MiB steps | 446 | 1202 | 1857 | 466 | | fdatasync every 4 MiB | 115 | 220 | 490 | 130 | | fdatasync every 1 MiB | 33 | 50 | 105 | 94 | | fdatasync every 256 KiB | 27 | 44 | 103 | 48 | | dev's way, but to the **HDD volume** (notes on NVMe) | 21 | 40 | 120 | 158 | (The 1 MiB / 256 KiB / other-disk rows also have the overlapped save, so compare their tails, not the p50; a clean same-build comparison follows.) 1 MiB steps take the save p99 from 2.2 s to about 100 ms, roughly what saves see with no upload at all; the upload drops to about 95 MB/s, still close to what gigabit brings in. Putting attachments on another volume than notes and DBs is just as good, so the deploy layout in point 4 of the issue stands. ### Plan - PR: SQLite `fdatasync` (build flag) + `storage-bench`. - PR: overlapped save. - PR: uploads in 1 MiB steps (`write_atomic` and a new `write_atomic_from`). - PR (#297): save at least every 5 s while someone types nonstop. Running now: the full #44 harness (10k and 100k) dev vs all of the above, then the final same-build before/after on NVMe and HDD.
Author
Owner

SQLite with fdatasync on the perf VM (#377)

dev (583c46e) vs the same tree built with LIBSQLITE3_FLAGS=-DHAVE_FDATASYNC=1, nothing else changed. storage-bench, median of 3 runs each, caches dropped before each run, under the perf lock. Raw 4 KiB flush on the NVMe volume during this round: p50 4.9 / p99 31 ms, then 4.1 / 22 ms.

build p50 p90 p99 rate
history, 1 writer, NVMe dev 10.7 15.6 40.8 81 tx/s
fdatasync 12.1 20.1 67.7 65 tx/s
history, 4 writers, NVMe dev 17.8 38.1 144.8 153 tx/s
fdatasync 15.8 21.2 59.9 227 tx/s
note save, NVMe dev 33.8 46.9 122.3
fdatasync 22.7 35.0 98.8
history, 1 writer, HDD dev 17.7 37.2 76.0 45 tx/s
fdatasync 17.4 36.3 75.1 46 tx/s

On XFS over a ZFS volume a lone commit costs about the same either way (the device flush dominates; the single-writer difference is within the run-to-run spread, which is large tonight). It pays off where flushes queue up: with 4 writers +48% commits/s and p99 145 → 60 ms, and a note save (several flushes in a row) p50 34 → 23 ms. On ext4 (my workstation) it halves every commit: p50 7.2 → 3.6 ms, p99 19–22 → 8–12 ms.

Also: a round of the #44 harness I ran earlier compared builds on two different dev bases, so its differences mixed in #44's own merges; I'm rerunning it on one base (dev a305ee2: dev, dev + #298 PRs, dev + #298 PRs + #297).

Correction to the earlier save numbers: the overlapped save I measured also stopped waiting for the "done" record. CI caught a real case against that (edit_while_closed_is_merged_on_open: a save whose "done" is lost, then an outside edit while the server is down, is mistaken for an unwritten save, and text doubles). The save now waits for "done" again (3 flushes in a row instead of 4, not 2). New numbers follow; #378 is replaced by a new PR.

## SQLite with `fdatasync` on the perf VM (#377) dev (583c46e) vs the same tree built with `LIBSQLITE3_FLAGS=-DHAVE_FDATASYNC=1`, nothing else changed. `storage-bench`, median of 3 runs each, caches dropped before each run, under the perf lock. Raw 4 KiB flush on the NVMe volume during this round: p50 4.9 / p99 31 ms, then 4.1 / 22 ms. | | build | p50 | p90 | p99 | rate | |---|---|---|---|---|---| | history, 1 writer, NVMe | dev | 10.7 | 15.6 | 40.8 | 81 tx/s | | | fdatasync | 12.1 | 20.1 | 67.7 | 65 tx/s | | history, 4 writers, NVMe | dev | 17.8 | 38.1 | 144.8 | 153 tx/s | | | fdatasync | **15.8** | **21.2** | **59.9** | **227 tx/s** | | note save, NVMe | dev | 33.8 | 46.9 | 122.3 | | | | fdatasync | **22.7** | **35.0** | **98.8** | | | history, 1 writer, HDD | dev | 17.7 | 37.2 | 76.0 | 45 tx/s | | | fdatasync | 17.4 | 36.3 | 75.1 | 46 tx/s | On XFS over a ZFS volume a lone commit costs about the same either way (the device flush dominates; the single-writer difference is within the run-to-run spread, which is large tonight). It pays off where flushes queue up: with 4 writers +48% commits/s and p99 145 → 60 ms, and a note save (several flushes in a row) p50 34 → 23 ms. On ext4 (my workstation) it halves every commit: p50 7.2 → 3.6 ms, p99 19–22 → 8–12 ms. Also: a round of the #44 harness I ran earlier compared builds on two different dev bases, so its differences mixed in #44's own merges; I'm rerunning it on one base (dev a305ee2: dev, dev + #298 PRs, dev + #298 PRs + #297). **Correction to the earlier save numbers**: the overlapped save I measured also stopped waiting for the "done" record. CI caught a real case against that (`edit_while_closed_is_merged_on_open`: a save whose "done" is lost, then an outside edit while the server is down, is mistaken for an unwritten save, and text doubles). The save now waits for "done" again (3 flushes in a row instead of 4, not 2). New numbers follow; #378 is replaced by a new PR.
Author
Owner

All of #298 together on the perf VM (final build vs dev)

dev a305ee2 (+ storage-bench) vs dev a305ee2 + #377 (fdatasync) + #392 (overlapped save, "done" waited for) + #379 (1 MiB upload steps) + #297. Median of 3 runs each, caches dropped before every run, under the perf lock. The disk's own 4 KiB flush during this round: p50 3.7 / p99 8 ms at the start, p50 5.1 / p99 50 ms halfway.

Note saves (storage-bench save: append a line, then Notes::save, which includes the change journal; 200 saves of 0.5 to 30 KB notes, 100 of a 300 KB note):

build p50 p90 p99
NVMe, no upload dev 40.2 70.7 353.6
final 20.2 31.7 210.0
NVMe, 300 KB note dev 43.9 67.9 117.1
final 31.4 51.6 88.4
HDD, no upload dev 76.7 123.5 215.6
final 49.8 79.4 144.9

Note saves while a 1 GB file is written over and over on the same volume:

build, upload written as save p50 p90 p99 upload MB/s
NVMe dev, all at once 77.7 1568 2090 461
NVMe final, all at once (same build, old way) 45.8 1511 2357 417
NVMe final, 1 MiB steps (#379) 58.9 93.2 229.8 75
HDD dev, all at once (earlier round, 30 saves) 21 s 40 s 53 s 70
HDD final, 1 MiB steps 215 308 373 62

The same-build pair isolates #379: p90 1.5 s → 93 ms, p99 2.4 s → 230 ms under a full-speed upload; saves no longer queue behind the upload. On the HDD volume the stall goes from tens of seconds to a third of a second.

History commits in this round: dev p50 7.9 / p99 31 ms (1 writer) and 15.8 / 49 (4 writers); final 9.4 / 44 and 20.7 / 80. That is the opposite of the previous round's fdatasync-only A/B (where 4 writers went 17.8 / 145 → 15.8 / 60), with the raw disk swinging from p99 8 to 50 ms within this one round. So on this VM I can't separate fdatasync's effect on a lone commit from the disk's noise; a 6-pair interleaved A/B is running now to settle it. (On ext4 it halves every commit.)

Targets: history-commit p99 < 10 ms is below what this VM's disk does for a single flush most of the night (raw p99 5 to 60 ms), so no software change gets there here; it needs a disk whose flushes are fast (a SLOG or power-loss-protected NVMe). Note-save p99 < 50 ms during an upload: not met at p99 (230 ms), but p50/p90 under a full-speed upload are now 59 / 93 ms, close to a save with no upload on this disk (p99 210 ms there too).

Next: interleaved fdatasync A/B, then the #44 harness on one base (dev a305ee2: dev, + #298 PRs, + #298 PRs + #297).

## All of #298 together on the perf VM (final build vs dev) dev a305ee2 (+ `storage-bench`) vs dev a305ee2 + #377 (fdatasync) + #392 (overlapped save, "done" waited for) + #379 (1 MiB upload steps) + #297. Median of 3 runs each, caches dropped before every run, under the perf lock. The disk's own 4 KiB flush during this round: p50 3.7 / p99 8 ms at the start, p50 5.1 / p99 50 ms halfway. **Note saves** (`storage-bench save`: append a line, then `Notes::save`, which includes the change journal; 200 saves of 0.5 to 30 KB notes, 100 of a 300 KB note): | | build | p50 | p90 | p99 | |---|---|---|---|---| | NVMe, no upload | dev | 40.2 | 70.7 | 353.6 | | | final | **20.2** | **31.7** | **210.0** | | NVMe, 300 KB note | dev | 43.9 | 67.9 | 117.1 | | | final | **31.4** | **51.6** | **88.4** | | HDD, no upload | dev | 76.7 | 123.5 | 215.6 | | | final | **49.8** | **79.4** | **144.9** | **Note saves while a 1 GB file is written over and over on the same volume:** | | build, upload written as | save p50 | p90 | p99 | upload MB/s | |---|---|---|---|---|---| | NVMe | dev, all at once | 77.7 | 1568 | 2090 | 461 | | NVMe | final, all at once (same build, old way) | 45.8 | 1511 | 2357 | 417 | | NVMe | final, 1 MiB steps (#379) | **58.9** | **93.2** | **229.8** | 75 | | HDD | dev, all at once (earlier round, 30 saves) | 21 s | 40 s | 53 s | 70 | | HDD | final, 1 MiB steps | **215** | **308** | **373** | 62 | The same-build pair isolates #379: p90 1.5 s → 93 ms, p99 2.4 s → 230 ms under a full-speed upload; saves no longer queue behind the upload. On the HDD volume the stall goes from tens of seconds to a third of a second. **History commits** in this round: dev p50 7.9 / p99 31 ms (1 writer) and 15.8 / 49 (4 writers); final 9.4 / 44 and 20.7 / 80. That is the opposite of the previous round's fdatasync-only A/B (where 4 writers went 17.8 / 145 → 15.8 / 60), with the raw disk swinging from p99 8 to 50 ms within this one round. So on this VM I can't separate fdatasync's effect on a lone commit from the disk's noise; a 6-pair interleaved A/B is running now to settle it. (On ext4 it halves every commit.) **Targets**: history-commit p99 < 10 ms is below what this VM's disk does for a single flush most of the night (raw p99 5 to 60 ms), so no software change gets there here; it needs a disk whose flushes are fast (a SLOG or power-loss-protected NVMe). Note-save p99 < 50 ms during an upload: not met at p99 (230 ms), but p50/p90 under a full-speed upload are now 59 / 93 ms, close to a save with no upload on this disk (p99 210 ms there too). Next: interleaved fdatasync A/B, then the #44 harness on one base (dev a305ee2: dev, + #298 PRs, + #298 PRs + #297).
Author
Owner

fdatasync A/B, interleaved (#377)

To get past the disk's drift between rounds: dev a305ee2 vs the same tree with only LIBSQLITE3_FLAGS=-DHAVE_FDATASYNC=1, 6 pairs run back to back and alternating (dev, fdatasync, fdatasync, dev, ...), caches dropped before each run, NVMe volume, 4000 history commits per run with 4 readers. Medians over the 6 runs:

build p50 p90 p99 tx/s
1 writer dev 11.5 17.8 44.9 77
fdatasync 9.7 16.9 43.5 80
4 writers dev 17.5 27.0 88.3 188
fdatasync 18.6 28.8 77.8 196

On this VM (XFS over a ZFS volume) fdatasync is about neutral: a lone commit's p50 drops by ~15%, the rest is within noise; the device flush is the cost either way. The big round-to-round swings I posted before were the disk, not the change. Where the file system's log write is a separate cost (ext4 on my workstation) it halves every commit (p50 7.2 → 3.6 ms). It's the right flag for SQLite on Linux either way and costs nothing, so #377 stays, with its claims trimmed to this.

## fdatasync A/B, interleaved (#377) To get past the disk's drift between rounds: dev a305ee2 vs the same tree with only `LIBSQLITE3_FLAGS=-DHAVE_FDATASYNC=1`, 6 pairs run back to back and alternating (dev, fdatasync, fdatasync, dev, ...), caches dropped before each run, NVMe volume, 4000 history commits per run with 4 readers. Medians over the 6 runs: | | build | p50 | p90 | p99 | tx/s | |---|---|---|---|---|---| | 1 writer | dev | 11.5 | 17.8 | 44.9 | 77 | | | fdatasync | **9.7** | 16.9 | 43.5 | 80 | | 4 writers | dev | 17.5 | 27.0 | 88.3 | 188 | | | fdatasync | 18.6 | 28.8 | 77.8 | 196 | On this VM (XFS over a ZFS volume) `fdatasync` is about neutral: a lone commit's p50 drops by ~15%, the rest is within noise; the device flush is the cost either way. The big round-to-round swings I posted before were the disk, not the change. Where the file system's log write is a separate cost (ext4 on my workstation) it halves every commit (p50 7.2 → 3.6 ms). It's the right flag for SQLite on Linux either way and costs nothing, so #377 stays, with its claims trimmed to this.
Author
Owner

The #44 harness, one base: dev vs #298 PRs vs #298 PRs + #297

dev a305ee2 vs dev + #377 + #392 + #379 vs that + #408 (#297). calternal-perf --sizes 10k,100k --runs 3 --cold-runs 1 --idle-secs 120 --drop-caches, same harness binary for all three, run one after another under the perf lock. Reports: /root/i298/m8-{h2dev,h2no297,h2final}.{md,json} on the VM.

(An earlier harness round compared builds on two different dev bases, so #44's own merges were mixed into the differences; disregard it.)

Summary

  • Every gated budget holds in all three, except home.first_page@100000 p95 (dev 70, #298 127, both 121; budget 100), whose run-to-run noise is 220 to 540 %, over the 25 % rerun threshold. It is the first read after start; nothing in these PRs touches that path.
  • Save path, #298 PRs vs dev: sync.save_ack p50 6.2 → 3.5 ms (10k), 8.6 → 4.7 ms (100k); storm.save_ack at 100k p50 / p95 19.8 / 40.3 → 11.3 / 26.4 ms; storm.edits_per_s at 100k 1170 → 2070.
  • #297 on top: load.typing (5 chars/s for a minute, now saving every 5 s instead of once) CPU 0.73 → 0.6 % at 100k (budget 2 %), wake-ups 41 → 56 /s (not budgeted). shutdown at 100k p50 / p95 64 / 88 → 275 / 773 ms with 242 % noise (budget 1000): one slow run; worth watching.
  • Idle stays at 0 CPU and 0 wake-ups everywhere.

10000 notes (p50 / p95; noise is the spread of the runs' p50s)

metric dev #298 PRs #298 PRs + #297 budget
cold.index 2.73 / 2.73 (0%) 2.13 / 2.13 (0%) 1.71 / 1.71 (0%) p95 10
home.first_page 19.2 / 32.3 (97%) 18.8 / 24.1 (51%) 18.2 / 25.6 (85%) p95 300
home.page 1.57 / 1.93 (133%) 1.37 / 1.68 (59%) 1.59 / 2.24 (28%) p95 50
home.page_next 1.49 / 1.71 (74%) 1.32 / 1.64 (90%) 1.76 / 2.05 (26%) p95 50
home.page_tag 6.48 / 8 (102%) 6 / 7.67 (52%) 6.8 / 9.39 (33%) p95 50
home.page_title 1.28 / 1.6 (84%) 1.19 / 1.58 (55%) 1.72 / 2.35 (44%) p95 50
idle.cpu_pct 0 / 0 (0%) 0 / 0 (0%) 0 / 0 (0%) p95 0.1
idle.rss 101 / 101 (0%) 94.9 / 94.9 (0%) 89.1 / 89.1 (0%)
idle.wakeups_per_s 0 / 0 (0%) 0 / 0 (0%) 0 / 0 (0%) p95 0.2
journal.catch_up 69 / 112 (63%) 63.1 / 117 (96%) 90.7 / 91.4 (25%) p95 1000
load.typing_cpu_pct 0.9 / 0.9 (0%) 0.581 / 0.581 (0%) 0.567 / 0.567 (0%) p95 2
load.typing_wakeups_per_s 37.5 / 37.5 (0%) 42.2 / 42.2 (0%) 55.7 / 55.7 (0%)
mem.idle 14.7 / 14.9 (2%) 14.5 / 14.8 (3%) 14.7 / 14.8 (2%) p95 64
mem.peak 72.1 / 105 (68%) 71.4 / 91.9 (40%) 64.4 / 87.1 (36%) p95 256
open.api_get 8.23 / 12.7 (110%) 5.13 / 10.9 (241%) 9.47 / 13.9 (46%) p95 50
open.long_note 10.9 / 18 (67%) 10.9 / 13 (20%) 12.9 / 19.8 (55%) p95 250
open.note 1.32 / 3.67 (286%) 1.18 / 2.66 (124%) 2.1 / 3.84 (73%) p95 15
search.query 4.62 / 19 (19%) 4.65 / 14.7 (29%) 4.84 / 11.4 (45%) p95 100
shutdown 48.3 / 48.8 (8%) 65.4 / 66 (32%) 65.5 / 66.9 (34%) p95 1000
startup.healthz 42 / 97.8 (152%) 39.2 / 91.2 (140%) 37.9 / 61.1 (76%) p95 300
storm.converge 172 / 175 (5%) 172 / 185 (13%) 166 / 180 (22%) p95 2000
storm.edits_per_s 2.05e+03 / 2.24e+03 (71%) 2.59e+03 / 3.7e+03 (80%) 2.6e+03 / 3e+03 (32%) p50_min 1000 (target)
storm.save_ack 12.8 / 23 (149%) 9.06 / 19.5 (82%) 9.5 / 19.2 (31%) p95 150
sync.round_trip 0.54 / 0.652 (19%) 0.564 / 0.785 (43%) 0.565 / 0.774 (11%) p95 10
sync.save_ack 6.18 / 7.03 (105%) 3.46 / 5.3 (160%) 3.91 / 10.7 (131%) p95 40

100000 notes (p50 / p95; noise is the spread of the runs' p50s)

metric dev #298 PRs #298 PRs + #297 budget
cold.index 22 / 22 (0%) 36.3 / 36.3 (0%) 25.3 / 25.3 (0%) p95 60
home.first_page 25.3 / 70.3 (220%) 30.3 / 127 (335%) 19.6 / 121 (539%) p95 100
home.page 1.66 / 2.09 (32%) 1.55 / 2.01 (59%) 3.3 / 12.9 (83%) p95 50
home.page_next 1.76 / 2.3 (33%) 1.78 / 2.75 (64%) 2.67 / 3.62 (48%) p95 50
home.page_tag 4.3 / 6.6 (43%) 3.83 / 5.88 (70%) 4.83 / 17.8 (127%) p95 50
home.page_title 1.64 / 2.38 (43%) 1.43 / 1.71 (70%) 1.68 / 2.75 (58%) p95 50
idle.cpu_pct 0 / 0 (0%) 0 / 0 (0%) 0 / 0 (0%) p95 0.1
idle.rss 497 / 497 (0%) 438 / 438 (0%) 419 / 419 (0%) p95 100
idle.wakeups_per_s 0 / 0 (0%) 0 / 0 (0%) 0 / 0 (0%) p95 0.2
journal.catch_up 786 / 869 (25%) 757 / 1.06e+03 (58%) 875 / 1.15e+03 (33%) p95 2000
load.typing_cpu_pct 0.8 / 0.8 (0%) 0.733 / 0.733 (0%) 0.6 / 0.6 (0%) p95 2
load.typing_wakeups_per_s 37.2 / 37.2 (0%) 41.3 / 41.3 (0%) 56.3 / 56.3 (0%)
mem.idle 14.6 / 14.8 (2%) 14.6 / 14.6 (1%) 14.7 / 14.8 (2%) p95 64
mem.peak 496 / 543 (31%) 482 / 486 (24%) 432 / 490 (19%) p95 256 (target)
open.api_get 11.1 / 17.4 (28%) 10.3 / 16.3 (72%) 9.15 / 13.7 (38%) p95 50
open.long_note 10.7 / 11.9 (24%) 10.1 / 12.6 (32%) 11.6 / 13.2 (23%) p95 250
open.note 1.51 / 2.67 (57%) 1.55 / 3.43 (86%) 2.46 / 5.38 (56%) p95 15
search.query 5.11 / 24.2 (25%) 4.4 / 16.7 (20%) 4.8 / 23.5 (19%) p95 100
shutdown 87.5 / 87.6 (20%) 64 / 88.2 (67%) 275 / 773 (242%) p95 1000
startup.healthz 54.3 / 72.6 (66%) 49.1 / 117 (166%) 44.6 / 94.5 (120%) p95 300
storm.converge 171 / 186 (11%) 165 / 176 (7%) 185 / 202 (85%) p95 2000
storm.edits_per_s 1.17e+03 / 1.35e+03 (38%) 2.07e+03 / 2.43e+03 (76%) 1.24e+03 / 1.42e+03 (63%) p50_min 1000 (target)
storm.save_ack 19.8 / 40.3 (42%) 11.3 / 26.4 (61%) 17.8 / 43.1 (14%) p95 150
sync.round_trip 0.606 / 1.29 (45%) 0.577 / 0.82 (60%) 0.572 / 1.44 (94%) p95 10
sync.save_ack 8.6 / 16.1 (33%) 4.7 / 13.5 (346%) 6.87 / 13 (56%) p95 40
## The #44 harness, one base: dev vs #298 PRs vs #298 PRs + #297 dev a305ee2 vs dev + #377 + #392 + #379 vs that + #408 (#297). `calternal-perf --sizes 10k,100k --runs 3 --cold-runs 1 --idle-secs 120 --drop-caches`, same harness binary for all three, run one after another under the perf lock. Reports: `/root/i298/m8-{h2dev,h2no297,h2final}.{md,json}` on the VM. (An earlier harness round compared builds on two different dev bases, so #44's own merges were mixed into the differences; disregard it.) **Summary** - Every gated budget holds in all three, except `home.first_page@100000` p95 (dev 70, #298 127, both 121; budget 100), whose run-to-run noise is 220 to 540 %, over the 25 % rerun threshold. It is the first read after start; nothing in these PRs touches that path. - Save path, #298 PRs vs dev: `sync.save_ack` p50 6.2 → 3.5 ms (10k), 8.6 → 4.7 ms (100k); `storm.save_ack` at 100k p50 / p95 19.8 / 40.3 → 11.3 / 26.4 ms; `storm.edits_per_s` at 100k 1170 → 2070. - #297 on top: `load.typing` (5 chars/s for a minute, now saving every 5 s instead of once) CPU 0.73 → 0.6 % at 100k (budget 2 %), wake-ups 41 → 56 /s (not budgeted). `shutdown` at 100k p50 / p95 64 / 88 → 275 / 773 ms with 242 % noise (budget 1000): one slow run; worth watching. - Idle stays at 0 CPU and 0 wake-ups everywhere. **10000 notes** (p50 / p95; noise is the spread of the runs' p50s) | metric | dev | #298 PRs | #298 PRs + #297 | budget | |---|---|---|---|---| | cold.index | 2.73 / 2.73 (0%) | 2.13 / 2.13 (0%) | 1.71 / 1.71 (0%) | p95 10 | | home.first_page | 19.2 / 32.3 (97%) | 18.8 / 24.1 (51%) | 18.2 / 25.6 (85%) | p95 300 | | home.page | 1.57 / 1.93 (133%) | 1.37 / 1.68 (59%) | 1.59 / 2.24 (28%) | p95 50 | | home.page_next | 1.49 / 1.71 (74%) | 1.32 / 1.64 (90%) | 1.76 / 2.05 (26%) | p95 50 | | home.page_tag | 6.48 / 8 (102%) | 6 / 7.67 (52%) | 6.8 / 9.39 (33%) | p95 50 | | home.page_title | 1.28 / 1.6 (84%) | 1.19 / 1.58 (55%) | 1.72 / 2.35 (44%) | p95 50 | | idle.cpu_pct | 0 / 0 (0%) | 0 / 0 (0%) | 0 / 0 (0%) | p95 0.1 | | idle.rss | 101 / 101 (0%) | 94.9 / 94.9 (0%) | 89.1 / 89.1 (0%) | | | idle.wakeups_per_s | 0 / 0 (0%) | 0 / 0 (0%) | 0 / 0 (0%) | p95 0.2 | | journal.catch_up | 69 / 112 (63%) | 63.1 / 117 (96%) | 90.7 / 91.4 (25%) | p95 1000 | | load.typing_cpu_pct | 0.9 / 0.9 (0%) | 0.581 / 0.581 (0%) | 0.567 / 0.567 (0%) | p95 2 | | load.typing_wakeups_per_s | 37.5 / 37.5 (0%) | 42.2 / 42.2 (0%) | 55.7 / 55.7 (0%) | | | mem.idle | 14.7 / 14.9 (2%) | 14.5 / 14.8 (3%) | 14.7 / 14.8 (2%) | p95 64 | | mem.peak | 72.1 / 105 (68%) | 71.4 / 91.9 (40%) | 64.4 / 87.1 (36%) | p95 256 | | open.api_get | 8.23 / 12.7 (110%) | 5.13 / 10.9 (241%) | 9.47 / 13.9 (46%) | p95 50 | | open.long_note | 10.9 / 18 (67%) | 10.9 / 13 (20%) | 12.9 / 19.8 (55%) | p95 250 | | open.note | 1.32 / 3.67 (286%) | 1.18 / 2.66 (124%) | 2.1 / 3.84 (73%) | p95 15 | | search.query | 4.62 / 19 (19%) | 4.65 / 14.7 (29%) | 4.84 / 11.4 (45%) | p95 100 | | shutdown | 48.3 / 48.8 (8%) | 65.4 / 66 (32%) | 65.5 / 66.9 (34%) | p95 1000 | | startup.healthz | 42 / 97.8 (152%) | 39.2 / 91.2 (140%) | 37.9 / 61.1 (76%) | p95 300 | | storm.converge | 172 / 175 (5%) | 172 / 185 (13%) | 166 / 180 (22%) | p95 2000 | | storm.edits_per_s | 2.05e+03 / 2.24e+03 (71%) | 2.59e+03 / 3.7e+03 (80%) | 2.6e+03 / 3e+03 (32%) | p50_min 1000 (target) | | storm.save_ack | 12.8 / 23 (149%) | 9.06 / 19.5 (82%) | 9.5 / 19.2 (31%) | p95 150 | | sync.round_trip | 0.54 / 0.652 (19%) | 0.564 / 0.785 (43%) | 0.565 / 0.774 (11%) | p95 10 | | sync.save_ack | 6.18 / 7.03 (105%) | 3.46 / 5.3 (160%) | 3.91 / 10.7 (131%) | p95 40 | **100000 notes** (p50 / p95; noise is the spread of the runs' p50s) | metric | dev | #298 PRs | #298 PRs + #297 | budget | |---|---|---|---|---| | cold.index | 22 / 22 (0%) | 36.3 / 36.3 (0%) | 25.3 / 25.3 (0%) | p95 60 | | home.first_page | 25.3 / 70.3 (220%) | 30.3 / 127 (335%) | 19.6 / 121 (539%) | p95 100 | | home.page | 1.66 / 2.09 (32%) | 1.55 / 2.01 (59%) | 3.3 / 12.9 (83%) | p95 50 | | home.page_next | 1.76 / 2.3 (33%) | 1.78 / 2.75 (64%) | 2.67 / 3.62 (48%) | p95 50 | | home.page_tag | 4.3 / 6.6 (43%) | 3.83 / 5.88 (70%) | 4.83 / 17.8 (127%) | p95 50 | | home.page_title | 1.64 / 2.38 (43%) | 1.43 / 1.71 (70%) | 1.68 / 2.75 (58%) | p95 50 | | idle.cpu_pct | 0 / 0 (0%) | 0 / 0 (0%) | 0 / 0 (0%) | p95 0.1 | | idle.rss | 497 / 497 (0%) | 438 / 438 (0%) | 419 / 419 (0%) | p95 100 | | idle.wakeups_per_s | 0 / 0 (0%) | 0 / 0 (0%) | 0 / 0 (0%) | p95 0.2 | | journal.catch_up | 786 / 869 (25%) | 757 / 1.06e+03 (58%) | 875 / 1.15e+03 (33%) | p95 2000 | | load.typing_cpu_pct | 0.8 / 0.8 (0%) | 0.733 / 0.733 (0%) | 0.6 / 0.6 (0%) | p95 2 | | load.typing_wakeups_per_s | 37.2 / 37.2 (0%) | 41.3 / 41.3 (0%) | 56.3 / 56.3 (0%) | | | mem.idle | 14.6 / 14.8 (2%) | 14.6 / 14.6 (1%) | 14.7 / 14.8 (2%) | p95 64 | | mem.peak | 496 / 543 (31%) | 482 / 486 (24%) | 432 / 490 (19%) | p95 256 (target) | | open.api_get | 11.1 / 17.4 (28%) | 10.3 / 16.3 (72%) | 9.15 / 13.7 (38%) | p95 50 | | open.long_note | 10.7 / 11.9 (24%) | 10.1 / 12.6 (32%) | 11.6 / 13.2 (23%) | p95 250 | | open.note | 1.51 / 2.67 (57%) | 1.55 / 3.43 (86%) | 2.46 / 5.38 (56%) | p95 15 | | search.query | 5.11 / 24.2 (25%) | 4.4 / 16.7 (20%) | 4.8 / 23.5 (19%) | p95 100 | | shutdown | 87.5 / 87.6 (20%) | 64 / 88.2 (67%) | 275 / 773 (242%) | p95 1000 | | startup.healthz | 54.3 / 72.6 (66%) | 49.1 / 117 (166%) | 44.6 / 94.5 (120%) | p95 300 | | storm.converge | 171 / 186 (11%) | 165 / 176 (7%) | 185 / 202 (85%) | p95 2000 | | storm.edits_per_s | 1.17e+03 / 1.35e+03 (38%) | 2.07e+03 / 2.43e+03 (76%) | 1.24e+03 / 1.42e+03 (63%) | p50_min 1000 (target) | | storm.save_ack | 19.8 / 40.3 (42%) | 11.3 / 26.4 (61%) | 17.8 / 43.1 (14%) | p95 150 | | sync.round_trip | 0.606 / 1.29 (45%) | 0.577 / 0.82 (60%) | 0.572 / 1.44 (94%) | p95 10 | | sync.save_ack | 8.6 / 16.1 (33%) | 4.7 / 13.5 (346%) | 6.87 / 13 (56%) | p95 40 |
Author
Owner

Closing during the 26 Oct handover cleanup: The storage tail fixes landed in dev (PRs #377, #379, #385, #392).

Closing during the 26 Oct handover cleanup: The storage tail fixes landed in dev (PRs #377, #379, #385, #392).
kayg closed this issue 2026-10-26 08:46:09 +00:00
Sign in to join this conversation.
No milestone
No project
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#298
No description provided.