GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.18k stars 801 forks source link

feat(backup): add parallel backup creation using pigz #4509

Closed MicLieg closed 4 months ago

MicLieg commented 4 months ago

Description

This pull request changes the creation of a backup to use pigz to reduce compression times by parallelizing compression. To do that pigz was added to the dependencies.

Backup times on i7-13700K bare metal server

Default Backup

Small Minecraft Server (117 MB) took ~ 5 seconds

user@hostmachine:~/minecraft$ time ./mcserver backup
[ INFO ] Backing up mcserver: Starting backup: No previous backups found
[  OK  ] Backing up mcserver: Completed: mcserver-2024-02-25-163835.tar.gz, total size 107M
core_exit.sh exiting with code: 4

real    0m5,122s

Big Minecraft Server (18 GB) took ~ 285 seconds (4 minutes 45 seconds)

user@hostmachine:~/minecraft$ time ./mcserver backup
[ INFO ] Backing up mcserver: Starting backup: No previous backups found
[  OK  ] Backing up mcserver: Completed: mcserver-2024-02-25-165601.tar.gz, total size 15G
core_exit.sh exiting with code: 4

real    4m44,821s

Parallel Backup

Small Minecraft Server (117 MB) took ~ 3 seconds

user@hostmachine:~/minecraft$ time ./mcserver backup
[ INFO ] Backing up mcserver: Starting backup: No previous backups found
[  OK  ] Backing up mcserver: Completed: mcserver-2024-02-25-164608.tar.gz, total size 107M
core_exit.sh exiting with code: 4

real    0m3,197s

Big Minecraft Server (18 GB) took ~ 23 seconds

user@hostmachine:~/minecraft$ time ./mcserver backup
[ INFO ] Backing up mcserver: Starting backup: No previous backups found
[  OK  ] Backing up mcserver: Completed: mcserver-2024-02-25-170138.tar.gz, total size 15G
core_exit.sh exiting with code: 4

real    0m23,154s

Fixes #3422

Type of change

Checklist

PR will not be merged until all steps are complete.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

MicLieg commented 4 months ago

To improve this, a new setting for the backupmode="fast" / "slow" could be added in the _default.cfg file to configure whether the slower, resource-saving or the faster backup mode should be used; which can easily cause 100% CPU utilisation on all cores.

dgibbs64 commented 4 months ago

Looks good to me.