IT-Admin.tech

High-performance Backup of Large Files: Chunking, Parallelization and I/O Tuning for Backup Jobs

Architekturdiagramm einer Backup‑Pipeline: Datei‑Chunking, parallele Upload‑Streams und Objektstore‑Ziel
Technisches Diagramm: Chunking großer Dateien und parallele Upload‑Streams zu einem S3‑kompatiblen Objektstore.

In productive environments individual files can quickly grow to several dozen or hundreds of gigabytes: VM images, container layers, media files, large log archives or MySQL tablespaces. The high-performance backup of large files affects backup windows, network utilization and RESTore time. In this practical guide I show how to back up large files reliably, reproducibly and operationally safely using chunking (splitting into parts), parallelization (concurrent transfers) and I/O tuning. The focus keyword „high-performance backup of large files“ is placed at the beginning so your teams immediately recognize the objective.

Why large files are different

Large single files behave differently than many small files:

  • Transfer risks: A connection drop during monolithic copies can require a complete RESTart if no resumable mechanism exists.
  • I/O patterns: Full-format reads/writes generate sequential load on storage and can degrade response times for other workloads.
  • Network: Long TCP sessions, missing bandwidth control or MTU limits lead to retransmits and throughput loss.
  • RESTore time: RESToring a 500‑GB file takes significantly longer and is often the dominant factor for RTO (Recovery Time Objective).

These characteristics demand specific strategies: split files (chunking), transfer parts in parallel, adjust storage and kernel parameters and use consistent backup procedures for MySQL and other databases.

High-performance backup of large files: practical checklist and metrics

Before you make changes in production, define clear metrics. Baselines simplify decision‑making and rollbacks:

  • Device throughput (MB/s) – measure with iostat or sar.
  • avgqu‑sz (average queue length) – high values indicate overload.
  • await (I/O latency in ms) – HDD >50ms often critical, NVMe >5–10ms notable.
  • CPU and network utilization – prevent backup jobs from impacting other services.

Define thresholds, e.g. avgqu‑sz > 5 or await > 20ms as a warning; automated reduction of parallelism should be triggered by these thresholds. Always measure before / during / after test runs so deviations can be clearly identified.

Basic principle: Chunking, parallelization and I/O tuning

Brief definitions:

  • Chunking: Splitting a large file into multiple, usually equally sized parts. Advantage: transfers are resumable and can be parallelized.
  • Parallelization: Concurrent transfer of multiple chunks to better utilize available throughput. Important: limited by CPU, I/O bandwidth and network topology.
  • I/O‑Tuning: Adjustment of OS and storage parameters (e.g. readahead, scheduler, sysctl limits) to reduce latency and increase throughput.

These three pillars must be planned together: too many parallel streams can overload storage queues; too aggressive I/O tuning parameters cause latency for other services.

Overview of strategies

1) Chunking methods

Common patterns:

  • Fixed-size chunks: Easy to implement with split (Unix) or PowerShell cmdlets. Advantage: predictable size, simple indexing.
  • Content-defined chunking: Chunks are formed based on content boundaries (e.g. rolling checksum). Useful for deduplication, but more complex and usually part of specialized backup software.
  • Block-level snapshots: At the storage/filesystem level (ZFS send/receive, LVM snapshots) instead of file chunking. Advantage: consistent, faster incrementals and lower application impact.

2) Parallel transfer

Parallel streams maximize bandwidth, but their number must be strictly limited. Rule of thumb: test with 2–8 streams per storage LUN and measure I/O queues and CPU; for cloud uploads more connections can be sensible when the client is CPU-bound. Implement adaptive rules: increase parallelism only up to defined metric thresholds.

3) I/O tuning

Key parameters:

  • Filesystem mount options: noatime reduces metadata writes.
  • Block readahead: increases sequential throughput but worsens random I/O.
  • I/O scheduler: for NVMe often noop or mq-deadline; for HDDs possibly cfq/bfq.
  • Kernel parameters: vm.dirty_bytes / vm.dirty_background_bytes limit RAM-resident write-backs and prevent flush spikes.

Practical implementations with commands

The following section contains copyable commands for common tasks: chunking with split, parallel uploading via GNU parallel or aws s3 multipart, rsync optimizations and MySQL-specific options. Test every change in a staging environment.

Chunking with split and checksums

split is a simple Unix tool that divides large files into fixed parts. Also generate a checksum of the original file so the reassembly can be verified.

Shell
# Original checksum (full file)
sha256sum /data/largefile.img > /tmp/largefile.img.sha256
# Split into 250MB chunks
split -b 250M /data/largefile.img /tmp/largefile.part.
# Optional: checksums per chunk
sha256sum /tmp/largefile.part.* > /tmp/largefile.chunks.sha256

Why this works: fixed-size chunks allow resumable transfers and parallel copying. When it fails: with sparse files, split and later reassembly can consume unnecessary storage; in such cases use cp –sparse or specialized tools.

Reassembly and validation

When RESToring you must safely reassemble chunks and verify integrity against the original checksum. Use an atomic process for reassembly and check the size and checksum of the RESTored file.

Shell
# Reassemble
cat /tmp/largefile.part.* > /tmp/RESTored.largefile.img
# Check file size
ls -lh /data/largefile.img /tmp/RESTored.largefile.img
# Compare full-file checksum
sha256sum /tmp/RESTored.largefile.img > /tmp/RESTored.largefile.img.sha256
diff /tmp/largefile.img.sha256 /tmp/RESTored.largefile.img.sha256 || echo "Checksum mismatch!"

For sparse files use ‚cp –sparse=always‘ during reassembly or tools that preserve sparse metadata. Without correct handling you risk excessive space consumption.

Parallel copying via GNU parallel or xargs

A pattern to transfer multiple chunks simultaneously (e.g., to an NFS/SMB backup target or to cloud storage):

Shell
ls /tmp/largefile.part.* | parallel -j 6 rsync -a --progress {} backup:/mnt/backups/largefile/{/}

Note: -j sets the number of parallel jobs. Measure I/O and reduce it when queue length is high or when await values rise.

Multipart upload to S3 (resumable and performant)

The S3 API supports multipart uploads that split large files into parts and upload them in parallel. Correct handling of upload IDs and completed parts is important to avoid orphaned parts.

Shell
# Start Multipart Upload
UPLOAD_ID=$(aws s3api create-multipart-upload --bucket mybucket --key backups/largefile.img --query UploadId --output text)
PART=1
for f in /tmp/largefile.part.*; do
  aws s3api upload-part --bucket mybucket --key backups/largefile.img --part-number $PART --body "$f" --upload-id $UPLOAD_ID
  PART=$((PART+1))
done
# Build parts.json (Auszug) und complete
# ... Erstellen Sie parts.json entsprechend der returned ETags ...
aws s3api complete-multipart-upload --bucket mybucket --key backups/largefile.img --upload-id $UPLOAD_ID --multipart-upload file://parts.json

Pay attention to cleanup: incomplete uploads should be removed via lifecycle policies or periodic scripts, as they can incur costs.

rsync optimizations for large files

rsync can perform delta transfers: if only small regions have changed, rsync transfers only the differences. Important flags:

Shell
rsync -a --partial --inplace --no-whole-file /data/largefile.img backup:/mnt/backups/

Explanation: –inplace writes directly into the destination file instead of copying to a temporary file; –partial keeps incomplete transfers. Risk: –inplace can lead to inconsistent destination files on crashes; use it only when disk space is limited and you can verify via checksums.

MySQL-specific notes

In the MySQL category it’s important to describe procedures for safely backing up large MySQL files (e.g. ibdata1, large InnoDB files, binlogs). MySQL terms: InnoDB is the default storage engine, tablespaces are file containers for InnoDB. Binlogs are transaction logs.

1) Consistent backups of large databases

For InnoDB, a snapshot-based approach (LVM, ZFS) or physical backups with Percona XtraBackup is recommended. Logical backups (mysqldump) are slower for very large databases and produce higher CPU/IO.

Shell
# Beispiel: LVM Snapshot und Copy
lvcreate --size 10G --snapshot --name mysql-snap /dev/vg/mysql
mount /dev/vg/mysql-snap /mnt/mysql-snap
rsync -a --progress /mnt/mysql-snap/ /backup/mysql-snap/
umount /mnt/mysql-snap
lvremove /dev/vg/mysql-snap

Important: if necessary, stop binlog writes or record binlog positions for consistent RESTores. Snapshots provide crash consistency without long locks, but depend on snapshot capacity.

2) Percona XtraBackup for physical backups

Shell
# Vollbackup mit xtrabackup
xtrabackup --backup --target-dir=/backup/xtrabackup --datadir=/var/lib/mysql
# Vorbereitung
xtrabackup --prepare --target-dir=/backup/xtrabackup
# Optional: Chunk/Compress und Upload
tar -C /backup/xtrabackup -cf - . | split -b 500M - /tmp/mysql-backup-archive.part.

XtraBackup provides consistent physical backups without long locks and is suitable for large datasets. However, always verify integrity with xtrabackup --prepare and test a RESTore.

Post-RESTore checks for MySQL

After RESToration, perform automated checks:

  • Start MySQL in read-only mode, check error logs and InnoDB status.
  • Run mysqlcheck and consistent queries on critical tables.
  • Compare binlog position or GTID status with production values.
Shell
# Beispielprüfungen
systemctl start mysql
mysql -e "SHOW GLOBAL STATUS LIKE 'wsrep%';"
mysqlcheck -u root -p --all-databases

Only with validated RESTores can you meet RTO commitments. Automate these checks in CI-like RESTore drills.

I/O‑Tuning: Concrete measures and checks

Changes to the kernel and storage parameters must be measured. Typical parameters and test steps:

Block‑Readahead anpassen

Shell
# Aktuellen Wert prüfen
blockdev --getra /dev/sdb
# Setzen (z. B. 4096 Blocks)
blockdev --setra 4096 /dev/sdb

Readahead helps sequential readers; values that are too high burden cache and I/O for random workloads.

IO‑Scheduler und Queue‑Tiefen

Shell
# Scheduler prüfen
cat /sys/block/sdb/queue/scheduler
# Queue‑Tiefe prüfen/setzen (wenn supported)
cat /sys/block/nvme0n1/queue/nr_requests
echo 1024 > /sys/block/nvme0n1/queue/nr_requests

For NVMe the I/O scheduler is less relevant; queue depths determine the maximum number of parallel I/O requests. Increase them only after measurement.

VM‑Dirty‑Limits

Shell
# Prüfen
sysctl vm.dirty_bytes vm.dirty_background_bytes
# Beispiel setzen (nur nach Messung)
sysctl -w vm.dirty_bytes=536870912  # 512MB
sysctl -w vm.dirty_background_bytes=134217728  # 128MB

These values limit the write cache in RAM. Values that are too high can cause long flush spikes during many concurrent writes.

Traffic Shaping und Ressourcenbegrenzung

If backups interfere with the WAN or production network, network shaping is an effective measure. Use tc for simple Token Bucket Filter (TBF) rules or QoS‑marking in aggregation routers.

Shell
# Einfacher TBF (z. B. 50Mbit/s Limit auf eth0)
tc qdisc add dev eth0 root tbf rate 50mbit burst 32kbit latency 400ms
# Entfernen
tc qdisc del dev eth0 root

In parallel, use ionice for disk‑bound processes and nice for CPU:

Shell
# Beispiel: rsync mit niedriger IO‑Priorität
ionice -c2 -n7 nice -n 10 rsync -a /data/ largebackup:/mnt/backups/

For finer control use cgroups v2 to define CPU/IO/Network limits per job.

Monitoring, Alerts und automatische Reaktion

A backup orchestrator should collect metrics and run automatic cool-down strategies:

  • Collect: iostat, node_exporter metrics, logs und application health.
  • Alerts: avgqu‑sz, await, I/O‑Errors, Retransmits, abgebrochene Multipart Uploads.
  • Automation: On threshold breach reduce parallelism or enable throttling.

Implement a small fallback script that, in an alarm situation, reduces parallelism by n steps and triggers Notifications.

Automatisierung & Job‑Design

Design jobs to be idempotent: an interrupted upload or a multipart upload that was not fully deleted must not cause conflicts on the next run. Use lockfiles, state files with upload IDs and proper cleanup routines.

Shell
# Beispiel: atomic state file (vereinfachtes Pattern)
STATE=/var/run/backup_largefile.state
if ! ln -s $$ "$STATE" 2>/dev/null; then
  echo "Job already running" && exit 0
fi
# Job ausführen ...
rm -f "$STATE"

Typische Stolperfallen und Risiken

  • Checksum‑Vernachlässigung: Ohne Checksums riskieren Sie silent data corruption beim Reassemble.
  • Inkompatible Sparse‑File‑Behandlung: Tools wie split ignorieren Sparse‑Metadaten.
  • Unintended locks: MySQL without snapshotting can cause locks during long‑running backups.
  • Missing network throttling: Backups interfere with other applications if no QoS/throttling is applied.
  • Incomplete multipart uploads: In cloud storage orphaned parts accumulate and incur costs.
  • Checklist before production rollout

    1. Measure baseline: I/O, CPU, network peaks during a test backup.
    2. Integrity verification: checksums for all chunks and reassembly validation.
    3. RESTore test: perform at least one full RESTore and a boot/application check.
    4. Resource limits: define parallelism level and store it as a configuration parameter.
    5. Monitoring alarms: avgqu‑sz, await, error counters (sector errors), S3 Multipart aborts).
    6. Rollback plan: how does the team respond to massive I/O drops? Throttle or stop immediately?

    Implementation example: step‑by‑step

    A pragmatic sequence for an initial setup:

    1. Ensure snapshot or consistent locking (e.g. LVM or XtraBackup).
    2. Chunking with split into 200–500MB parts.
    3. Generate checksums per chunk and store the full‑file checksum.
    4. Parallel upload with 4–6 streams; monitor.
    5. Verify target integrity during upload and delete parts.
    6. Test RESTore and document measurement data.

    Fallback strategy

    If a new parallel backup destabilizes the system:

    • Scale back gradually: first reduce parallelism by 50%.
    • Temporary throttling: use ionice/nice and network shaping (tc, ethtool) until the root cause is found.
    • Fallback to sequential method: simple rsync-based runs with –inplace instead of parallel uploads.
    • Documentation: record causes and measurements for every rollback to avoid future incidents.

    Practical example: minimal upload workflow (compact)

    Complete example: split file, upload in parallel with rclone to an S3-compatible object store, verify integrity.

    Shell
    # Split
    split -b 250M /data/largefile.img /tmp/largefile.part.
    sha256sum /data/largefile.img > /tmp/largefile.img.sha256
    sha256sum /tmp/largefile.part.* > /tmp/largefile.chunks.sha256
    # Parallel upload via rclone (rclone takes care of multipart)
    ls /tmp/largefile.part.* | parallel -j 6 rclone copy {} s3:mybucket/backups/largefile/
    # After upload: download, reassemble and verify integrity
    # (see Reassembly section above)
    

    Operational Runbook: brief steps for failures

    Quick reference for operators:

    1. Pause new backup jobs (lock the scheduler or set a maintenance flag).
    2. Check metrics: iostat, iotop, dmesg for I/O errors.
    3. If avgqu‑sz > threshold or await increases: reduce parallelism, enable throttling.
    4. If I/O errors are present: stop, roll back to the last known good configuration and start a RESTore drill in staging.

    Conclusion

    Efficiently backing up large files is not a single-button operation but a coordinated interplay of chunking, controlled parallelism and targeted I/O tuning. Measure beforehand, test incrementally and automate integrity checks. For MySQL workloads, snapshot or physical backup methods such as LVM snapshots or Percona XtraBackup are generally more robust than pure logical dumps. Also plan for always-on monitoring and a clear fallback strategy—only then do backup windows remain predictable and RESTores reliable.

    Further internal topics (linking opportunities)

    The Journal contains in-depth articles on network architecture for backup windows, RESTore validation and backup encryption, which fit well as internal links (e.g. network QoS, test cases for RESTore validation, lifecycle for cloud backups).

    I/O tuning and backup jobs are also important for this topic. The article places these aspects in a clear context and shows what matters in day-to-day operations.