How Facebook Overcame the Challenges of Migrating to MySQL 8.0
Facebook’s engineering team detailed a multi‑year, complex migration from MySQL 5.6 to 8.0, highlighting custom‑feature porting, replication compatibility, query changes, performance regressions, and documentation gaps, and explaining how they finally achieved a successful upgrade.
Facebook shared in a blog post its difficult large‑scale migration from MySQL 5.6 to MySQL 8.0, describing why the upgrade was necessary and the extensive effort involved.
MySQL, developed by Oracle, powers many of Facebook’s most critical workloads. Each major MySQL release requires substantial time and resources to migrate these workloads, and the Facebook team identified several key challenges:
Porting custom features to the new version
Ensuring replication compatibility across major versions
Minimizing changes required by existing application queries
Fixing performance regressions that prevented the servers from supporting their workloads
The previous upgrade to MySQL 5.6 took more than a year, and the move to 8.0 spanned several years. While MySQL 5.7 was released, Facebook continued developing the LSM‑Tree storage engine MyRocks on 5.6 because upgrading to 5.7 would have slowed MyRocks progress. Once MyRocks was complete, MySQL 8.0 was released, and Facebook chose to upgrade to improve the storage engine.
The migration to 8.0 proved far more difficult than the earlier upgrade to 5.6. Facebook had to port roughly 1,700 code patches from its customized MySQL 5.6 branch to 8.0, a task complicated by continuous new features and fixes added to the 5.6 codebase.
Because the upgrade skipped version 5.7, many APIs active in 5.6 were either deprecated or removed, requiring application updates. Some Facebook‑specific functionalities also lacked forward compatibility with 8.0, necessitating deprecation and migration.
Documentation quality varied across the custom code. While most custom code was well‑commented, other parts lacked sufficient documentation, forcing Facebook engineers to dig through old files, posts, and code comments to understand historical decisions.
In the end, Facebook evaluated over 2,300 patches and successfully ported about 1,500 of them to MySQL 8.0. Most InnoDB replica sets have been converted to run entirely on 8.0, and the remaining workloads are at various stages of migration. The team now finds it relatively easy to keep up with Oracle’s minor releases.
“Despite the obstacles we faced during the migration, we have already seen the benefits of running on 8.0. Overall, the new version greatly expands what we can achieve with MySQL at Facebook,” the engineers concluded.
For more details, see the official Facebook engineering blog: https://engineering.fb.com/2021/07/22/data-infrastructure/mysql/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
