Skip to content

perf(wasix): reduce initdb latency with private initialization - #246

Merged
f0rr0 merged 4 commits into
mainfrom
f0rr0/wasix-startup-writeback
Oct 4, 2026
Merged

f0rr0 merged 4 commits into
mainfrom
f0rr0/wasix-startup-writeback

Conversation

@f0rr0

@f0rr0 f0rr0 commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fresh directory startup spends roughly 5–6 seconds initializing catalogs directly on the host filesystem, including repeated syncs of intermediate files. Initialize the unpublished cluster in private memory, then copy the complete PGDATA tree, including WAL, into private staging inside the managed root and publish it through the existing checked durability barriers and rename protocol.

Use four bounded workers for copy and file sync, plus an optional Linux writeback hint before the checked barriers. Bootstrap uses 8MB shared buffers and --no-sync only in private memory; restore the 128MB serving default before publication. The measured directory configuration uses the default serving settings: fsync=on, full_page_writes=on, and synchronous_commit=on. Existing caller startup GUCs, including fsync and buffer overrides, continue to apply to serving. Reuse the existing private permission helpers (0700 directories, 0600 files), runtime-directory setup, and publication cleanup/error handling. Online backup retains its separate WAL capture behavior.

Routing caller durability settings consistently through WASIX preparation, publication, and serving remains a separate follow-up. #241 covers native startup defaults. This diff retains the existing checked publication barriers, including when a caller selects fsync=off for serving; that remaining lifecycle inconsistency is not fixed here. The temporary private bootstrap settings do not replace caller-selected serving settings.

Measured startup

Optimized standalone Node addon on Linux x86_64/ext4, Node 24.18.0, warm SDK/OS caches, separate processes, no overlapping builds. Oliphaunt.open timing excludes import and explicit seed archive reads; every sample also queried and closed successfully.

Configuration Median open latency Samples
Fresh directory, no seed 1,058ms 21
Seeded directory 468ms 3
Fresh memory 850ms 3

Fresh directory samples ranged from 927–1,152ms. This substantially improves the original startup, but the fresh-start median still exceeds the under-one-second target. The latency target and full release qualification remain unresolved.

Release Intent

  • Package/API/runtime change: PR title uses perf:. The shared Rust WASIX implementation also serves the Node SDK.
  • Docs/CI/repository-only change: no release intended.
  • Source/input/runtime asset change: existing product ownership applies; producer pins, generated metadata, and release metadata are unchanged.

Verification

  • Moon affected checks and tests passed: Rust formatting, lint, owner tests and package; NAPI Rust formatting/lint, typecheck and tests. All 12 tasks including prerequisites passed, covering 154 Rust library tests, eight public API tests, doctests, five NAPI unit tests, and package/provenance checks.

  • Product-specific smoke/package/perf checks: 19 real consumer tests covering fresh/seeded memory and directory storage, reopening, persistence, backup/restore, transaction recovery, async admission/close, standard/ICU resources, seed rejection, serving settings and buffer overrides.

  • Six injected EIO publication cases (fresh/seeded file, staging-directory and post-rename parent barriers) failed cleanly and retried on the same root. Unsupported Linux writeback hints also succeeded through the checked sync fallback. This is error-path testing, not physical power-loss testing.

  • CI changes passed ci-workflows:check, including pinned actionlint 1.7.12 and zizmor 1.25.2, workflow security, gate behavior, 70 planning tests and 10 transfer/gate regressions. CI workflow and tooling formatting/lint checks also passed.

Local qualification used the reviewed implementation at 3070117e. Rebased onto main after #245 merged; git range-diff confirms all three startup patches are identical, and all four implementation file hashes match the qualification receipt. git diff --check passes. Packaging fixes are already in main and are excluded from this diff.

Full release addon/carrier and exact-head hosted/platform qualification remain incomplete. The previous CI failure came from skipped selected producers and WASIX aggregates accepting skipped host builds. This update explicitly requires successful planning, Checks and Tests results for source producers and successful selected hosts for WASIX aggregates. Hosted qualification of the updated head is pending. Local runtime/performance evidence uses an optimized standalone candidate; it does not establish full release readiness.

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
oliphaunt-docs Ready Ready Preview Oct 4, 2026 6:40pm UTC

@f0rr0
f0rr0 merged commit 410e5dc into main Oct 4, 2026
72 checks passed
@f0rr0
f0rr0 deleted the f0rr0/wasix-startup-writeback branch October 4, 2026 20:01

This branch was successfully deployed

1 active deployment
Preview — c1db710c Deployed Oct 4, 2026 by vercel[bot]
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