Checkpoint Policy Tuning
MuroDB can defer WAL truncate (checkpoint) using policy thresholds. This helps reduce commit-time overhead on write-heavy workloads.
Configuration Knobs
Checkpoint policy can be configured in two ways:
- Environment variables (process default, applied at session construction)
- SQL runtime options (
SET ..., session scope, non-persistent)
For full option-by-option semantics, see Runtime Configuration.
Environment variable names:
MURODB_CHECKPOINT_TX_THRESHOLDMURODB_CHECKPOINT_WAL_BYTES_THRESHOLDMURODB_CHECKPOINT_INTERVAL_MS
SQL runtime option names:
checkpoint_tx_thresholdcheckpoint_wal_bytes_thresholdcheckpoint_interval_ms
Semantics:
- Checkpoint runs when any enabled trigger fires.
MURODB_CHECKPOINT_TX_THRESHOLD=1(default): checkpoint every commit/rollback.MURODB_CHECKPOINT_TX_THRESHOLD=0: disable tx-count trigger.*_WAL_BYTES_THRESHOLD=0/*_INTERVAL_MS=0: disabled.- Runtime
SETvalues follow the same semantics, but are session-only and not persisted.
Runtime example:
SET checkpoint_tx_threshold = 8;
SET checkpoint_wal_bytes_threshold = 1048576;
SET checkpoint_interval_ms = 1000;
Recommended Starting Profiles
Low-latency / conservative
MURODB_CHECKPOINT_TX_THRESHOLD=8
MURODB_CHECKPOINT_WAL_BYTES_THRESHOLD=1048576
MURODB_CHECKPOINT_INTERVAL_MS=1000
Use this when you want modest commit-speed gains with tight WAL growth control.
Write-throughput focused
MURODB_CHECKPOINT_TX_THRESHOLD=64
MURODB_CHECKPOINT_WAL_BYTES_THRESHOLD=8388608
MURODB_CHECKPOINT_INTERVAL_MS=5000
Use this for update/insert-heavy workloads where throughput is prioritized over immediate WAL truncation.
Time-driven only
MURODB_CHECKPOINT_TX_THRESHOLD=0
MURODB_CHECKPOINT_WAL_BYTES_THRESHOLD=0
MURODB_CHECKPOINT_INTERVAL_MS=1000
Useful when transaction size/shape is bursty and you want predictable checkpoint cadence.
Tuning Procedure
- Start from the conservative profile.
- Run workload benchmark and record throughput/latency.
- Increase
MURODB_CHECKPOINT_TX_THRESHOLDstepwise (for example:8 -> 16 -> 32 -> 64). - Keep safety bounds with either
MURODB_CHECKPOINT_WAL_BYTES_THRESHOLDorMURODB_CHECKPOINT_INTERVAL_MS. - Stop increasing when throughput gain flattens or WAL/recovery cost becomes unacceptable.
What to Monitor
Use:
SHOW DATABASE STATS;
Track at least:
failed_checkpointsdeferred_checkpointscheckpoint_pending_opscheckpoint_policy_tx_thresholdcheckpoint_policy_wal_bytes_thresholdcheckpoint_policy_interval_ms
And from filesystem:
ls -lh mydb.wal
Guardrails
failed_checkpoints > 0means truncate is failing; investigate disk I/O.checkpoint_pending_opsgrowing continuously with WAL size means policy is too loose for current workload.- Larger deferred windows can increase restart recovery time because WAL replay work increases.
- Durability boundary is unchanged: commit durability still depends on WAL
sync.