Forum archive
TKLBAM occasionally instigates an out of memory error on a running JVM.
I have TKLBAM installed on a server that runs an application on the Java Virtual Machine (through a Java servlet).
The generated log file when this occurs is attached to this post.
The server is a 2GB 2 core processor machine (full details in the log file) and normally, when the backup runs (in the morning when there is no other load on the machine) I can see the CPU spike up to around 40%. (This does seem a lot.)
But when it crashes the JVM, I can see it spikes up to ~115%.
I do not have a real time monitor on the memory load at present, but you should be able to get information on this from the attached log.
I have another machine with 4GB running a similar set up (although I have it so that only the database backs up, whereas on this machine, everything backs up, as per default settings.). I do not experience this problem on that machine.
How can I avoid this? What causes the CPU and memory load? Can I reduce it say by only backing up the database?
Or could it be some type of memory leak? It only happens every month or two. It happened this time on an incremental backup.
Just to clarify, the backup completes successfully.
Thanks.
TKLBAM uses RAM when collecting all the files to backup; particularly when dumping databases (as the DB is dumped, it is stored in memory before it is written to disk). It also uses memory when creating the archive files which are to be uploaded.
TKLBAM mainly uses CPU when creating the archive of backup files. AFAIK TKLBAM uses gzip for compression. By default the archive process (gzip) runs as a single thread so will soak up as much CPU as it can - but only on one core. On a system with a single core, it is expected behaviour to see CPU spikes up to (and often over) 100%. However, I can't explain why you are seeing that on a system with 2 cores.
So you have a few options. You may find one of these resolves the issue for you, or perhaps using a combo of them may be your best approach? Here's the ones that come to mind:
This may not be that practical or desirable in your instance, but it's certainly the best way to avoid this issue if you have the ability to increase RAM. You'll possibly notice improved performance of your Java app too.
It seems that you don't have swap enabled. TBH there's nothing wrong with that (it's generally my preference so long as I have enough RAM). But it does mean that when your system runs out of RAM, it has nowhere to turn. Whether this is a good and/or cost effective idea depends lots on your individual scenario. On a hosted platform such as AWS, enabling swap can often be false economy as you pay for storage and disk I/O. So if your server is using swap lots, simply using a larger server (with more RAM) will often give you improved performance at a comparable cost. OTOH if your system rarely uses swap, then a small swap file/partition may be a reasonable solution.
If you have windows where your server is only ever under low load, then simply timing your TKLBAM backup to run at that time may be sufficient to make it more reliable? TKLBAM backups are triggered by cron.
It is possible to have multiple backup sets for the one server. So you could have one backup job which backs up your DB, and another that just backs up the files. Or you could have one job which just collects all the files (inc DB) and dumps them somewhere (on the local filesystem), then another that collects those files and uploads them. The downside of the first method is that when the different parts are backed up separately, they may be at different points, so a restore may cause unexpected results. The second method may make your restores significantly more mucking around. If you choose either of these possibilities, I urge you to spend some time testing restores (probably to a clean install) to ensure that it will work if/when you need it!
TBH I've never used TKLBAM hooks for this sort of purpose, but I can't think of a reason why it wouldn't work. There are also other apps that you could use to monitor the JVM and restart it if it crashes.
Some relevant links to docs and info:
Hope that helps.