r/mysql • • May 01 '25

question Avoiding site shutdown while doing backup

I run a site which is run on a virtual server (PHP and MySQL on the same server). I do backups twice a day via a script run by cronjob, which just does the backup and tars it. The problem is the site goes down for the few minutes it takes for the backup to run. I'd love advice on if there's a way to avoid that happening.

The tables are all MyISAM, and my understanding is switching to InnoDB should help? Otherwise, the only things I've been able to come up with is to create a primary/replica, disconnect the replica for the duration of the backup, and then reconnect it.

5 Upvotes

27 comments sorted by

View all comments

Show parent comment

1

u/feedmesomedata May 01 '25

There has been a lot of improvements but there are a lot of ways to tune the server based on workload. Generally a high enough buffer pool allowing your entire hot data in memory will be optimal.

You can have a staging db with the same set of data from your production db and run a separate app to test the performance. This way you will not have to guess how your app will behave after a migration in prod.

1

u/GamersPlane May 01 '25

I do have a staging set up, but I'm not experienced in how to replicate prod level interaction. I did testing, but a few hits by me and some volunteers obviously isn't the same as all my users. In the past at least, I haven't been able to find a guide/tutorial/course on MySQL optimization.

1

u/feedmesomedata May 01 '25

since your workload is read-heavy then try testing with pt-upgrade tool from Percona.