Hello! I just recently started using Sponge for a new private server I’m hosting, and I quickly hacked together a little backup script for it using mcrcon and rsnapshot.
In what I initially assumed was an unrelated issue, my Sponge server began showing very high CPU usage (up to 100% of two cores on my VPS). However, I noticed that these ramps in CPU activity happened as distinct cliffs of about +50% in the usage graph every two hours, which is when cron is told to run the backup command for the most frequent series.
I was led to believe that this was caused by the connection and immediate disconnection of my backup script’s rcon session, as this behaviour is not caused if I input the commands manually.
I am running SpongeVanilla 1.12.2-7.1.0-BETA-59 using Ubuntu 18.04 on a 4GB Linode. The following is the script responsible for backup:
#!/usr/bin/env python3
import subprocess
import sys
import mcrcon
snap = sys.argv[1]
rcon = mcrcon.MCRcon()
rcon.connect('localhost', 25575, 'rcon')
rcon.command('save-off')
rcon.command('save-all')
subprocess.check_call(['rsnapshot', snap])
rcon.command('save-on')
rcon.disconnect()
(don’t worry about my trivial rcon password, iptables drops all non-local traffic sent to 25575)