You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(cli): archive snapshot volumes with multi-threaded zstd in one container (#1061)
`abi stack snapshot create` archived each stateful volume with a separate
`alpine tar czf` (single-thread gzip) container, run sequentially. On a real
3.88GB TDB2 (fuseki) volume this took ~146s and produced a 1.06GB archive,
with the wall-clock dominated by single-thread gzip on the one large volume.
Two changes:
- Compress with multi-threaded zstd instead of gzip. A tiny helper image
(alpine + zstd, ~6MB) is baked once via `ensure_snapshot_helper_image()`
before the stack is stopped, so its one-time build never lands in the
downtime window and there is no per-snapshot package-mirror dependency.
Compression runs inside the container, so only the compressed bytes cross
the docker VM->host boundary. Measured: ~146s -> ~23s on the fuseki volume,
and the archive roughly halves (1.06GB -> 501MB).
- Archive every volume in a SINGLE helper container (`archive_volumes`)
instead of one container per volume, paying container/image startup once.
Volumes are mounted read-only at /from/<key> and streamed
`tar cf - | zstd -T0 -3` to /to/<key>.tar.zst. `set -eo pipefail` so a
failed tar aborts the run rather than being masked by zstd's exit code.
Volume archives are now `.tar.zst` (centralised in `volume_archive_name`);
`extract_volume` decompresses with `zstd -dc | tar xf -`. No backward-compat
shim is needed (no existing snapshots). Cross-volume parallelism was
deliberately not added: one 3.88GB volume is ~81% of the bytes, so parallel
archiving caps at ~1.2x, and a per-archive `-T0` already saturates all cores.
The clean `docker compose stop` is kept (Fuseki/TDB2 needs a clean checkpoint;
`docker pause` only yields a crash-consistent, in-flight-lossy image).
`storage/` intentionally stays on host-side gzip to preserve the audited
`_safe_extract`/`_assert_safe_members` guard and avoid a host-zstd dependency.
Tests: 56 pass; batched archive + per-volume extract verified byte-identical
end-to-end on real volumes.
0 commit comments