When a dataset grows, backups that used to be smooth start to slow down. This episode teaches tuning: chunker parameters, compression levels, and the files cache, plus dedup & speed benchmarking strategies, handling TB-level datasets, and throttling with ionice/nice so backups do not disturb production.

Everything we have built so far assumes backups finish within a reasonable time. But when a dataset grows to the TB scale, even night after night, things that once felt instant start to slow down. Episode 18 turns you from a user into a tuner: understanding the three main performance levers — chunker, compression, and caching — then executing with honest benchmarks.
The chunker determines the chunk size — and this size affects the dedup vs overhead balance:
Borg's default parameters are buzhash,19,23,21,4095: an average of 2 MiB per chunk. For certain datasets you can lower the size for more aggressive dedup:
borg create --chunker-params buzhash,19,23,21,4095 --stats \
/backup/borg::"{hostname}-{now}" /homeLowering the numbers (e.g. exponent 20 → 1 MiB average) adds dedup granularity at a CPU cost. Measure first — do not change parameters without data.
From episode 6: lz4 is fast, zstd,10 is balanced. On large datasets, the compression level choice has a big impact on backup duration — and this is where the trade-off is most visible. For hosts whose backups collide with busy hours, a lower compression level makes more sense than an extreme level that slows the pipeline.
Borg keeps a files cache locally (in ~/.cache/borg) containing file metadata + chunk lists. The next backup compares metadata (mtime, size, ctime, inode) with the cache: unchanged files are skipped without being re-hashed — a huge saving on datasets that are mostly static.
Do not just use raw time — measure the components separately:
time borg create --compression zstd,10 --stats \
/backup/borg::bench /var/lib/data
# run again (all data already present) to measure dedup speed
time borg create --compression zstd,10 --stats \
/backup/borg::bench-2 /var/lib/dataThe important readings from these two runs:
--stats gives you the numbers: New files, Unchanged files, Deduplicated size. A high Unchanged files ratio shows the cache is effective.
Record each backup's duration and size in a log; a duration spike without data changes is a sign of a weakening disk or a lost exclusion (episode 12).
lz4 avoids wasted CPU.--buffer-size 1G for high throughput on slow networks or distant disks.A backup must run without killing production. Lower the I/O and CPU priority:
ionice -c 3 nice -n 10 \
borg create --stats /backup/borg::"{hostname}-{now}" /homeionice -c 3 → I/O idle class: the disk is only used when no other workload needs it.nice -n 10 → CPU priority lower than normal processes.For cgroup (systemd):
[Service]
Nice=10
IOSchedulingClass=idle
IOWeight=1ionice -c 3 and nice / IOSchedulingClass=idle protect production.In episode 19 we widen the ecosystem: BorgWeb & Tools — a GUI to manage repositories, integration with borgmatic and FUSE, connections to classic monitoring (Nagios/Zabbix) via wrappers, and metric exports to Prometheus.