Skip to content

Batch SQLite record writes during snapshot install - #2021

Merged
callumalpass merged 2 commits into
mainfrom
sprint-w6-snapshot-install-perf
Nov 28, 2026
Merged

callumalpass merged 2 commits into
mainfrom
sprint-w6-snapshot-install-perf

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Refs #1648

SQLite snapshot staging now inserts multiple records, links, and unique values per statement. It clears old lookup keys for the IDs in each chunk and preserves the last write for repeated IDs. The existing transaction and staging swap still determine when the records become visible. The parameter count stays within the app and hosted codecs’ 100-parameter limit.

Snapshot install benchmark

The paired browser measurements below compared the original baseline (dc4747f59) with the pre-rebase candidate (670a48b56).

Seven alternating A/B and B/A pairs per host, with a fresh on-disk Chromium profile for each run. Both builds used the same encrypted fixture, SQLite WASM and OPFS access-handle pool. Each run reached the snapshot head, verified 10,050 confirmed records and closed cleanly. Timing ends before tail replay. The transport served fixture bytes from memory.

Median per install Pinned baseline This change Change
GCP desk, Chrome 155, wall time 4,844 ms 4,521 ms −6.7%
GCP desk, SQLite host execution 3,628 ms 3,463 ms −4.5%
SQL statements 70,880 1,956 −97.2%
Host request bytes 29,258,471 25,766,695 −11.9%
Host calls 536 536 0%
Shared local host, wall time 5,937 ms 8,566 ms +44.3%

The candidate was faster in 7/7 GCP pairs and 4/7 shared-host pairs. GCP paired wall times in milliseconds, in run order (baseline/candidate), were 4856/4524, 4900/4720, 5115/4507, 4790/4453, 4760/4490, 4802/4521 and 4844/4527. Shared-host pairs were 5067/3567, 6273/3914, 5937/10138, 11145/10363, 11406/8566, 4633/10887 and 2606/5320. Shared-host baseline timings ranged from 2.61 to 11.41 s while other jobs were active. These are synthetic install measurements. Production approval-to-first-row latency and parser-specific timing were outside the measurement.

Verification

  • The native regression replaces an ID across chunks and again within a 102-row write. It checks pre-swap invisibility and post-swap record, link and unique lookups.
  • The new native release benchmark can be repeated from runtime with rcargo test --release -p mdbn-bench --test catalog_reindex snapshot_install_at_10k -- --ignored --nocapture. Candidate median was 354 ms across seven installs.
  • Store and platform tests, scoped Clippy, architecture checks, remote workspace typecheck, local Server CI gates and the daemon E2E passed.
  • Regenerated the SDK runtime integrity pin and served-method inventory from remapped WASM and verified the runtime pin.

Verification after #2015 and #2016

Rebased on 5859fd6b3. The SDK pin now points at runtime source 80279ab7b. At head 5c08f5765, the remapped WASM passed the real Node SQLite ABI smoke; the Chromium OPFS smoke recovered 1k, 5k and 20k rows. All 389 store/platform tests passed. Seven native release installs each verified 10,050 records and issued 1,410 SQL statements (374 ms median). Pin and method-inventory tests, remote workspace typecheck, all three SDK package checks and the daemon E2E passed.

@callumalpass
callumalpass force-pushed the sprint-w6-snapshot-install-perf branch from 670a48b to 5c08f57 Compare November 28, 2026 10:26
@callumalpass
callumalpass added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit b639385 Nov 28, 2026
46 checks passed
@callumalpass
callumalpass deleted the sprint-w6-snapshot-install-perf branch November 28, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant