Hybrid Incremental MySQL Backups

Visit the post for more.

Nagavamsi Ponnekanti
5 min readbeginner
--
View Original

Overview

The article discusses enhancements to Facebook's database backup system, transitioning from logical backups using mysqldump to a custom physical backup model with XtraBackup. This shift significantly improves backup speed while maintaining space efficiency through hybrid incremental backups.

What You'll Learn

1

How to transition from mysqldump to XtraBackup for MySQL backups

2

Why hybrid incremental backups can optimize storage and performance

3

How to implement table-level restore using PHP scripts

Prerequisites & Requirements

  • Understanding of MySQL backup strategies
  • Familiarity with XtraBackup and PHP(optional)

Key Questions Answered

What are the drawbacks of using mysqldump for backups?
Mysqldump is slow, taking over 24 hours for larger databases, and causes random disk reads due to fragmented tables, increasing server load. These inefficiencies necessitate the transition to a more effective backup solution.
How does XtraBackup improve backup performance?
XtraBackup performs physical backups by reading database files directly, which is faster than logical backups. Enhancements like 8MB IO size and hybrid incremental backups further optimize speed and reduce IO calls.
What is a hybrid incremental backup?
A hybrid incremental backup is an optimized method that reduces IO calls while avoiding reading unmodified pages. It combines the benefits of traditional incremental backups with improved performance metrics, making it suitable for high-traffic environments.
What improvements were made to XtraBackup for Facebook's needs?
Improvements included support for fast table-level restores, enhanced full and incremental backups, and the ability to perform hybrid incremental backups, which collectively improved backup efficiency and reduced server load.

Key Statistics & Figures

Backup time reduction
40% faster full backups with 8MB IO size
This improvement was observed when XtraBackup was enhanced to read database files in larger chunks.
IO call reduction
20-30% less IO calls with hybrid incremental backups
This metric highlights the efficiency of the hybrid approach compared to traditional incremental backups.
Backup duration
Over 24 hours for mysqldump on larger databases
This statistic emphasizes the need for a more efficient backup solution, as traditional methods can be prohibitively slow.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Backup Solution
Xtrabackup
Used for performing physical backups of MySQL databases.
Programming Language
Php
Used to create scripts for table-level restores.

Key Actionable Insights

1
Transitioning to XtraBackup can dramatically reduce backup times and server load. By utilizing physical backups instead of logical ones, you can enhance the efficiency of your backup processes.
This is particularly beneficial for organizations with large databases, as it allows for faster recovery times and less impact on database performance during backup operations.
2
Implementing a hybrid incremental backup strategy can optimize your backup storage requirements. By backing up only changed data, you can significantly reduce the amount of storage needed while maintaining quick access to backups.
This approach is especially useful in environments where data changes frequently, allowing for efficient use of resources.
3
Utilizing table-level restores can save time during recovery processes. By restoring only the necessary tables rather than the entire database, you can minimize downtime and improve operational efficiency.
This method is ideal for scenarios where only specific data needs to be recovered, allowing for targeted and efficient recovery efforts.

Common Pitfalls

1
Relying solely on incremental backups can lead to complex restore chains if not managed properly.
Avoiding restore chains longer than two increments simplifies the recovery process and reduces the risk of data loss.

Related Concepts

Mysql Backup Strategies
Physical Vs Logical Backups
Incremental Backup Methodologies