This directory contains the testbench Python project — a unified suite for testing, benchmarking, profiling, and stress-testing vykar. Run with uv from the repository root.
uv run --project scripts/testbench scenario scripts/scenarios/simple-backup.yaml
uv run --project scripts/testbench scenario scripts/scenarios/5xchurn.yaml --backend local --runs 3Compares vykar with restic, rustic, borg, and kopia.
Local test/benchmark repositories are always created under /mnt/repos so the source corpus and repository stay on separate SSDs.
uv run --project scripts/testbench benchmark --runs 3
uv run --project scripts/testbench benchmark --runs 5 --tool vykar
uv run --project scripts/testbench benchmark --runs 3 --dataset ~/corpus-remoteuv run --project scripts/testbench bench-report all ~/runtime/benchmarks/<STAMP>
uv run --project scripts/testbench bench-report chart ~/runtime/benchmarks/<STAMP>Runs repeated backup/restore/verify cycles.
uv run --project scripts/testbench stress --iterations 100 --backend local
uv run --project scripts/testbench stress --iterations 50 --check-every 5 --verify-data-every 10uv run --project scripts/testbench profile --mode backup --backend local
uv run --project scripts/testbench profile --mode backup --profiler perf --skip-build
uv run --project scripts/testbench profile --mode backup-incremental --skip-buildbackup profiles a backup of the whole corpus into a repo seeded with snapshot-1; backup-incremental re-runs a backup of an unchanged corpus (repo open, cache-hit walk, commit).
Peak RSS drifts between sweeps and varies run to run, so binaries are only comparable within one sweep. mem-ab runs every variant once per round, rotates the order, restores the same repository and cache snapshot before each run, and reports medians plus round-paired deltas against the first variant. Run it with two copies of the same binary first to see the noise floor.
uv run --project scripts/testbench mem-ab --variant base=/path/to/vykar-base --variant cand=target/profiling/vykar
uv run --project scripts/testbench mem-ab --variant base=a --variant cand=b --workload incremental --rounds 8Sweeps take a host-wide lock (/tmp/vykar-mem-ab.lock), so concurrent invocations queue instead of perturbing each other.
--workload both (the default) means the two backup workloads. --workload restore backs up the whole --source once and measures vykar restore -R mem-ab latest <dest>. The repository is not copied per run (restore does not change it); only the small cache directory is reset, and <dest> (--restore-dest, default $RUNTIME_ROOT/mem-ab-restore-dest, so not on /mnt/repos) is recreated empty before and deleted after every run. --reuse-work-dir (implies --keep) reuses a work dir seeded by an earlier restore sweep, or seeds it if absent:
uv run --project scripts/testbench mem-ab --workload restore --work-dir /mnt/repos/mem-ab-restore --reuse-work-dir \
--variant base=~/runtime/restore-mem/bin/vykar-base --variant cand=target/profiling/vykar --rounds 5Every run also polls /proc/<pid>/status every 50 ms: results.tsv gains peak VmRSS/RssAnon/RssFile/RssShmem/Threads columns, the summary shows median peak RssAnon and RssFile+RssShmem, and <workload>.r<N>.<variant>.timeline.tsv holds the samples. Polled peaks can miss spikes shorter than the interval; maxrss_kb (from wait4) stays the exact total.
Runs vykar backup against a network backend with simulated WAN latency on loopback and compares binaries the same way mem-ab does (each variant once per round, order rotated, medians plus round-paired deltas against the first variant). --backend is s3 (MinIO), rest (vykar-server), sftp (sshd) or local (unshaped reference). Every run gets a fresh repository (init + timed backup, plus a timed no-change backup with --incremental), which is deleted afterwards.
uv run --project scripts/testbench net-ab --backend s3 --variant base=/path/to/vykar-base --variant cand=target/release/vykar
uv run --project scripts/testbench net-ab --backend sftp --variant base=a --variant cand=b --rounds 5 --delay-ms 20 --rate 1gbit
uv run --project scripts/testbench net-ab --backend rest --variant base=a --variant cand=a --variant-conn cand=8 --incremental- Shaping: only the backend's TCP port (taken from the repository URL: MinIO 9000,
REST_URL8585,SFTP_PORT22 by default) is routed through netem onlo(prio qdisc with 4 bands, u32 sport/dport filters into band 4).--delay-msis per direction, so RTT = 2x (default 20 → 40 ms RTT);--rateadds a netem rate limit.--delay-ms 0adds no delay but still routes the port through a count-onlypfifoso bandwidth is measured. Thelocalbackend never touchestc. Uses passwordlesssudo /sbin/tc; IPv4 loopback endpoints only. - netem state is read first and put back on exit, also on error, Ctrl-C and SIGTERM (
--keep-netemleaves the shaping in place). An unshapedlogets its qdisc removed; an existing setup in the same layout is rebuilt with its port, delay and rate. Any other qdisc onlomakesnet-abrefuse to run. - Locking: takes
/tmp/vykar-s3bench.lockand then/tmp/vykar-mem-ab.lock, so it queues behind (and blocks)mem-aband other benchmarks that take either lock. - Repositories:
s3usess3+http://<endpoint>/<--s3-bucket>/net-ab/<run-id>/<run>(endpoint as inconfig.resolve_repo_url); the bucket (defaultvykar-net-ab) is created if missing and removed at the end ifnet-abcreated it and it is empty; cleanup deletes the objects under the run's prefix.rest: vykar-server serves one repository, so the server must be empty —net-abrefuses otherwise, or with--rest-stash-existingdownloads a small pack-less repository into the out dir, and re-creates it (layout + objects) at the end; cleanup isvykar deleteplus deleting whatever the run left.sftpuses$SFTP_BASE_DIR/net-ab-sftp/<run-id>/<run>; on loopback the run directory is removed locally (avykar deleteover a 40 ms SFTP link takes minutes), otherwise withvykar delete.localrepos and every run's cache live in--work-dir(default/mnt/repos/net-ab/<run-id>), removed at the end. - Measurements (per run, in
--out, default$RUNTIME_ROOT/net-ab/<stamp>): wall, user/sys CPU andru_maxrssfromwait4; peak RssAnon and threads from a 100 ms/procpoller; the shaped band's byte counter (both directions, that port only) sampled every 100 ms intor<N>.<variant>.timeline.tsvand ~250 ms MiB/s buckets in.bw.tsv, summarised as mean / p10 / p50 / p90 / max / cv / idle fraction over the active span, plusavg_mibs= bytes / wall.results.jsonholds all runs,summary.txtthe table. Binaries that honour$VYKAR_HTTP_TRACE(a measurement-only patch, not in the tree) get a per-request summary inresults.json; an empty or missing trace (always for SFTP) is ignored.
Socket buffer limits. At 40 ms RTT a TCP connection can move at most window / RTT. MinIO pins its buffers with SO_RCVBUF, which the kernel caps at net.core.rmem_max; with the Debian default (212992) every S3 measurement is capped at ~21 MiB/s until net.core.rmem_max (and wmem_max) are raised to 4194304. net-ab warns, without changing anything, when net.core.rmem_max, net.core.wmem_max or the tcp_rmem/tcp_wmem maxima are below 4 MiB while latency is on. To raise them for a session: sudo sysctl -w net.core.rmem_max=4194304 net.core.wmem_max=4194304. SFTP is additionally bounded by the SSH channel window the server advertises (OpenSSH: 2 MiB) per connection.
uv run --project scripts/testbench --with pytest pytest scripts/testbench/tests/