3
Transportability of logical ZRM backup images makes ZRM a convenient tool for migration. For
example, you can move your MySQL data:
- From MySQL on Solaris to MySQL on Linux
- From one storage engine to another
- From a 32-bit server to a 64-bit server
- From one managed hosting provider to your datacenter or another provider with a
different MySQL configuration.
Of course, there is price to pay for such flexible recovery. Restoring data from the logical
backups takes a long time since you have to read and replay back all MySQL statements. For the
MyISAM engine the observed transfer rate for backup was close to 5 MB/s, but the restore time
was only 2 MB/s. For the InnoDB engine the transfer rate for backup was 8 MB/s and the restore
rate was 2 MB/s.
ZRM for MySQL provides a wealth of information about the state of the MySQL server during
backup. Fr example, ZRM reports to you how long did it take to flush memory buffers, or how
long was the READLOCK. During logical backup, for both engines the READLOCK time was
95% of the total backup time. This is a crucial measure of the impact that backup has on your
application. The shorter the READLOCK time the better for an application and users.
Another downside of logical backups is that it could be difficult to predict the size of the
backup file. Depending on the type of data and your database schema, the size of the logical
backup could be larger than the database itself. In our testing, for the MyISAM engine the
backup file was 30% larger than the database file. One remedy is that since logical backup is
basically a text file you can usually get a decent compression. Interestingly, the logical backup
file (uncompressed) for InnoDB engine was 40% smaller than the database file.
Our next step was to measure raw backup and recovery performance by instructing the ZRM to
use mysqlhotcopy available only for MyISAM and ARCHIVE engines. Raw backup provides a
consistent copy of a database with your backup being a binary file. The advantages of raw
backups over logical backups are:
- Backup and especially recovers are much faster. In our testing the backup transfer rate
was 26 MB/s, or more than 5 times faster than the logical backup. The recovery transfer
rate was 40 MB/s, or more than 20 times faster than logical recovery.
- You will always know the size of your backup since it is just a copy of a database.
- READLOCK time was only 60% of the total backup time.
Both logical (via mysqldump) and raw (via mysqlhotcopy) backups provide so-called ‘’warm
backup’’, meaning you don’t have to shut down the MySQL server for backup, but all tables are
locked during backup and users can’t enter their data. If your MySQL server runs on Linux with
Logical Volume Manager (LVM), you can perform another type of raw backup by taking
advantage of LVM2 snapshot functionality managed by ZRM. Backup via snapshots works well
for all storage engines, but it works best for transactional engines such as the InnoDB and the
upcoming Falcon storage engine. For transactional engines it provides true ‘’hot backup’’,
meaning that during backup the READLOCK time is practically zero. The performance data for