Experiment 029: Periodic PASSIVE Checkpointing

Date: 2026-04-08

Status: Accepted

Commit:8822bd2

Hypothesis

The current writer policy uses:

That is a good default, but it still leaves checkpoint timing entirely to SQLite.

If checkpoints happen at unlucky commit boundaries, burst workloads can still see

tail-latency spikes.

A coarse manual policy might do better:

If even that crude policy improves p95/p99 write latency, a built-in smarter

checkpoint scheduler becomes worth considering.

Change

Added an experiment-only benchmark:

It compares two policies on a burst of 6000 single-row inserts with an 8KB text

payload:

  1. Baseline: legacy SQLite autocheckpoint (wal_autocheckpoint=10000)
  2. Manual: wal_autocheckpoint=0 plus PRAGMA wal_checkpoint(PASSIVE) every

500 writes

Measured:

Results

PolicyWrite p50Write p95Write p99Write maxRead p95Checkpoint p95WAL noop
baseline-autocheckpoint-100000.06ms0.12ms0.22ms53.60ms0.24msn/abusy=0 log=4752 ckpt=0
manual-passive-every-5000.05ms0.08ms0.12ms9.27ms0.19ms11.26msbusy=0 log=2062 ckpt=2062

This is the first checkpoint-oriented experiment with clearly non-noisy signal:

The trade-off is explicit checkpoint work (11.26ms p95 on checkpoint calls), but

that work is happening at predictable intervals instead of surfacing as a 53ms

write outlier.

Decision

Accepted.

This does not justify shipping PRAGMA wal_checkpoint(PASSIVE) calls from the

Dart layer as-is. The adopted implementation instead moved checkpoint scheduling

into the writer connection via a lower-level WAL hook.

Compared with the earlier wal_autocheckpoint tuning experiment, this is the

first result that makes the scheduler itself look worth deeper implementation.