Facebook outlines lessons learned from MySQL 8.0 migration

Facebook had custom features with the open-source database, had to ensure replication was compatible and had to minimize changes while bolstering performance.

Facebook outlined its migration to MySQL 8.0, a bevy of headaches and a timeline that highlights those upgrades can be a pain even for a company known for its engineering prowess and scale.

In a blog post, Facebook's engineering team outlined a MySQL upgrade from 5.6 to 8.0. MySQL serves as the basis for Facebook's storage engine, replication and workloads. Facebook had custom features with the open-source database, had to ensure replication was compatible and had to minimize changes while bolstering performance.

The upgrade is worth a read since it highlights how enterprises can customize open-source software and end up with all the complications of a proprietary system. Here are a few takeaways from the MySQL 8.0 upgrade dissection from Facebook.

  • The project took a couple of years to complete.
  • Facebook's last major version upgrade to MySQL 5.6 took more than a year to roll out. Facebook decided to skip an upgrade to 5.7 as it developed its MyRocks storage engine.
  • MySQL 8.0 was announced when MyRocks was completed so Facebook opted to upgrade to add improvements to its storage engine.
  • Facebook had 1,700 code patches to port from its customized MySQL 5.6 branch to 8.0. The effort was complicated by new Facebook MySQL features and fixes continually added to the 5.6 codebase.
  • The upgrade from 5.6 to 8.0 skipped 5.7 entirely and some APIs were either deprecated or removed completely. Any application using the old APIs needed an update.
  • Custom code documentation was spotty. Facebook said most of its custom code had good comments and documentation. Other code wasn't documented as well, and Facebook required digging through old documents, posts and code comments to understand the history.
  • The most complex features required significant changes to MySQL 8.0 and there were compatibility issues to resolve.
  • In the end, Facebook evaluated more than 2,300 patches and ported 1,500 of them to MySQL 8.0.

Was the upgrade worth it? Facebook argued that the MySQL 8.0 upgrade greatly enhances what the company can do. However, Facebook may want to start thinking through future upgrades already.