Navigation

Blog|Product

How PlanetScale prevents MySQL downtime

By Sam Lambert |

The cost of downtime can range from loss of business to severe reputation damage. Database downtime feels inevitable but is often preventable.

The causes of database issues that lead to downtime can be categorized in the following ways:

  • Human error
  • System immaturity
  • Application issues

In this post, we will explore how PlanetScale can mitigate all three.

Downtime due to human error

We’ve all done it, dropped the wrong table or index and caused queries to dramatically slow or fail. This can lead to entire site outages, as well as cascading failure that impacts other systems. With standard MySQL, if you drop a table that you later find out was still in use, you are in a situation where you now have to restore from backup. Selecting the right backup, restoring, and bringing your site back online can take hours, which of course leads to high levels of stress for you and your team.

To help prevent this type of outage, PlanetScale warns you if the table to be dropped was recently queried. This will help you avoid the mistake of dropping a table that is in use.

Deploy request warning

If you do happen to deploy a schema that has issues, such as a sub-optimal index that causes query performance degradation or a dropped column that cause errors, we also let you roll back the schema deployment without any loss of data.

Downtime due to system immaturity

Building a highly available database is hard. It takes decades for databases to come to maturity. People often bet on solutions that have traded scalability for approachability. On the surface, this feels like the right trade off when you are just starting a project, but can very quickly backfire when user demand for your services increases.

We have built PlanetScale on top of Vitess, the database clustering system for horizontal scaling of MySQL, which was built by the database team at YouTube to power YouTube.com. Since Vitess was open sourced, it has been adopted by GitHub, Slack, Etsy, Roblox, and many more. PlanetScale are also the maintainers of Vitess.

Being used and contributed to by some of the largest sites on the internet means that Vitess has been pressure tested at scale.

The reason we chose to build PlanetScale on top of Vitess starts with our fundamental belief in the importance of developer experience. Developer experience starts with approachability but is only maintained with reliability and scalability. Building on a database platform that supports billions of users ensures that our users will not be forced to trust an immature system. We know Vitess scales and will work for the people that trust us with one of the most critical pieces of their application.

Downtime due to application issues

Bugs happen. You can’t deploy perfect software all the time. A common reason for database outages is bad application deploys causing spikes of excessive database load. This can be caused by poorly performing (slow) queries or too many queries at once.

PlanetScale Insights is a next generation monitoring solution that helps you discover bad queries in real time. When we receive a query from your application, we send it through a data pipeline that logs the query and its performance metrics. This allows you to gain an aggregated view of the queries your application sends. Finally, you can use query comments to tag and identify the source of queries.

PlanetScale Insights database activity graph

PlanetScale Insights queries over 24 hours

Try it out

At PlanetScale, we’re committed to delivering a high-performance scalable database that doesn’t require you to give up developer experience. Vitess allows us to build on a proven mature solution. And we will continue to ship new in-dashboard tools and alerts to help you identify issues caused by application code or human error before they make it to production.

You can sign up for an account or contact us today to get started.