Change-stream lag¶
The change stream is what makes recent seconds restorable. Its lag is the time between a commit on the database and the moment that commit is stored in the bucket, which is the worst-case data loss (RPO) if the database disappeared at that instant.
Tenax uploads every completed WAL segment (16 MiB) or binlog file at once, and the segment that is still being
written every partialInterval (default 60 s). On a quiet database the partial upload sets the lag; on a busy
one segments complete quickly and the upload throughput sets it.
Single commits¶
One-row updates at random moments on an otherwise idle Postgres 16, streamed by Tenax's streamer code (the Go WAL
receiver of ADR 0005, segment summaries with pg_waldump, zstd and age, upload to MinIO). Lag is measured from the
moment the commit returned to the moment a segment listed in MinIO contains it.
partialInterval |
Samples | p50 | p90 | Max |
|---|---|---|---|---|
| 5 s | 20 | 4.2 s | 5.6 s | 6.2 s |
| 60 s (default) | 8 | 23.1 s | 42.6 s | 56.2 s |
The lag is roughly the time left until the next partial upload plus the time to summarize and upload it, so it
ranges from about a second to a little more than partialInterval. Set partialInterval on the policy (or
the target) to trade a lower RPO against more frequent uploads.
A bulk write¶
A single update of 500,000 rows of the 2,000,000-row table:
| Measure | Value |
|---|---|
| Statement duration | 4.6 s |
| WAL written | 438 MiB |
| Time from commit to the commit being stored | 19.6 s |
| WAL through the stream, end to end | about 18 MiB/s (438 MiB in 24.2 s) |
| Complete WAL segments stored since the base backup | 29: 464 MiB raw, 86 MiB stored (0.19) |
During a burst the stream falls behind by the WAL it has not uploaded yet, and catches up at about 18 MiB/s on this
machine (summarizing each segment with pg_waldump, compressing, encrypting and uploading it). The
TenaxStreamLagHigh alert fires when the lag stays high; see Monitoring.
Not measured here¶
- MySQL binlog lag. The streamer uses the same upload path, so the partial-interval behaviour is the same; the binlog side was not timed in this run.
- Lag against a remote bucket. Each upload adds the bucket's PUT latency (tens to hundreds of milliseconds) to the numbers above.
Machine and versions¶
One VM: Intel Xeon @ 2.80 GHz, 4 vCPUs (one thread per core), 15 GiB RAM, Linux 6.18. Go 1.26.10, Docker 29.8.2,
Postgres 16.15 (official image), MinIO built from images/minio, both on tmpfs on the same VM; the streamer ran in
the test process. Measured on 2026-10-21. The 60 s row used a 200,000-row table (the lag of a single commit does not
depend on the table size).
Reproduce¶
hack/perf/run.sh local
# the default interval, fewer samples:
TENAX_PERF_PARTIAL_SECONDS=60 TENAX_PERF_LAG_SAMPLES=8 TENAX_PERF_ROWS=200000 hack/perf/run.sh local
Results: artifacts/perf/postgres.md (sections "Change-stream lag" and "Bulk write through the stream").