Slow backup with Borg Backup to remote host / How to debug? Possible causes?

  • Hi everyone,


    hopefully, the collective expertise of the forum can help me to settle the issue, because I don't know what else to do.


    I have a virtual Netcup root server RS 4000 G9.5 in Nuremberg, some hosted storage space located in Helsinki from a different provider and I use Borg Backup to backup my data from the virtual root server. My problem: The backup is slow as hell. However, I am not able to find the root cause. I don't know whether the problem is I/O (disk) bound, CPU bound or network bound. No matter at what monitor statistics I look, each tells me that neither of the limits is the problem, but still the backup is slow.


    Command to create Borg archive:

    Note: I use no compression on purpose as most data (in /var/www) is highly compressed data (e.g. JPEGs) anyway. (It is mostly a Nextcloud installation.)


    While the backup is running

    • htop shows 4.6% CPU utilization on one core for python-3.11/borg
    • iotop sporadically shows 3.5MB/s disk utilization on /dev/vda3 for python-3.11/borg
    • wireshark shows me 9.8MBit/s network utilization on enp0s3ad

    Neither of these numbers is near the theoretically maximum.


    To find out the maximum disk I/O, I ran

    This tells me that the theoretical read performance of the disk is 151MiB/s. Yes, I know that traversing many files in a directory tree is slower than writing a single huge in large chunks, but 3.5MB/s is very far below 151MiB/s.


    To find out the maximum network throughput between my server and the remote storage, I created a file with randomness, copied it over with scp and analyzed the result with Wireshark.


    On one console I did

    Code
    admin@server ~ $ tcpdump -i enp0s3 -s 86 -w /dev/shm/scp-to-backup.pcap "ip6 host 2a01:4f9:3b:5682::2 and tcp port 23"
    tcpdump: listening on enp0s3, link-type EN10MB (Ethernet), snapshot length 86 bytes
    442415 packets captured
    442415 packets received by filter
    0 packets dropped by kernel

    Notes: I only dumped the first 86 bytes of each packet which is the size of the combined Ethernet, IPv6 and TCP header to avoid capturing the entire payload. The IP address 2a01:4f9:3b:5682::2 belongs to backup.mhnnet.de


    On another console I did

    Code
    backup@server ~ $ openssl rand -out /dev/shm/sample.txt -base64 $(( 2*2**30 * 3/4 ))
    backup@server ~ $ scp -P 23 /dev/shm/sample.txt u377394@backup.mhnnet.de:/home/sample.txt
    sample.txt   100%   2080MB   45.7MB/s   00:45

    Here, we see 45.7MB/s and not 9.8MBit/s which I get when Borg Backup is running. The latter is 37 times slower! (Note bytes vs. bits). Also Wireshark shows me a nice 400 (4x10^8) MBit/s which is actually the theoretical maximum between Netcup and the other data center in Finland.


    Screenshot_20231217_172721.png


    So what makes Borg Backup so incredibly slow? Has anybody any clever ideas what to investigate next?

    Edited 3 times, last by nagmat84: More grammar and missing words ().

  • Try to create a zip file on the machine, and just backup the zip.

    Problem could be that the server creates a new connection for every little file und the maximum number of simultaneous connection is limited in Helsinki.