Setting: A Raspberry Pi 1B+ (Rev 1.2) is operated as restic backup server over a tailnet connection.
The device is configured as nearly read-only to reduce wear on the SD card, i.e. /tmp
, /var/tmp
and /var/tmp
are mounted as tmpfs
and swap is deactivated.
File transfers of a few megabytes have always succeeded.
Problem: For file transfers with several gigabytes, the memory usage of the tailscaled
process (on the server side) slowly increases; eventually the tailnet connection freezes and the file transfer terminates with IO errors on the restic client side.
The server side Raspberry remains inaccessible even after the restic backup task has stopped.
A quick solution leverages Go environment variables on the server side,
$ cat /etc/os-release | grep PRETTY_NAME
PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)"
$ uname -a
Linux 3d6532b 6.6.51+rpt-rpi-v6 #1 Raspbian 1:6.6.51-1+rpt3 (2024-10-08) armv6l GNU/Linux
$ tailscale version
1.76.6
tailscale commit: 1edcf9d466ceafedd2816db1a24d5ba4b0b18a5b
other commit: d0a6cd8b27eb46f6dec31425499159f7949be7f9
go version: go1.23.1
$ cat /etc/default/tailscaled
...
GOMAXPROCS=1
GOMEMLIMIT=128MiB
which increases aggressiveness of the Go garbage collector and prevents the above issue. See especially also: https://docs.syncthing.net/users/tuning.html#tuning-for-low-resources
Useful network debugging commands,
$ sudo tcptrack -i tailscale0 -p
$ iperf3 -p 5000 -f m -s # retrieve (server: Raspberry Pi 1B+)
$ iperf3 -p 5000 -f m -c <tailnet "server" IP> -t 300 -P 1 # push (client: Raspberry Pi 3B+)
- https://tailscale.com/blog/go-linker
- https://tailscale.com/kb/1207/small-tailscale
- https://weaviate.io/blog/gomemlimit-a-game-changer-for-high-memory-applications
- https://docs.syncthing.net/users/tuning.html#tuning-for-low-resources
- https://tip.golang.org/doc/gc-guide
- https://restic.readthedocs.io/en/stable/047_tuning_backup_parameters.html#backend-connections
- https://restic.readthedocs.io/en/latest/047_tuning_backup_parameters.html#cpu-usage
- https://www.procustodibus.com/blog/2022/12/wireguard-performance-tuning/
- https://www.thomas-krenn.com/de/wiki/OPNsense_WireGuard_Performance_Tests
- https://wireguard.how/network/speed-test/