[best practice] Dedicated MySQL servers or managed database?

Hi all,

We’re using DigitalOcean for a couple of years now, running about 35 droplets and very happy with the results so far.

The ‘problem’ is that one of our SAAS products is growing very quickly and the software makes heavy use of MySQL. At first (2018) we installed a dedicated 8GB/4CPU MySQL server which functioned fine, but with heavy loads we decided last year to add 2 (read-only) slaves behind a load balancer. That was a big improvement, the software now does all SELECTS from the slaves and writes to the master. But a year later, the loads on the slaves are almost always above 2.0 and when there are a lot of customers online, you can notice it becomes slow.

I’ve been testing with managed databases, but our big concern; are the managed databases powerful (and scaleable) enough to make the switch? Or should we just resize the master to more CPU’s and add more slaves?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hey @digitalocean018,

loads on the slaves are almost always above 2.0

Load isn’t always indicative of a saturated system. A load of 2 on a 4core host means (generally) that there are 2 tasks waiting for resources. If you review the output of vmstat for a period you might be able to tell whether the system is waiting on CPU or IO. Are the replicas the same spec as the master?

With more concurrent traffic on the system you might just find that system resources are being contended for and with some tuning you can continue with this hardware for some time yet.

I would advise that you start with a SQL review. In my experience, badly indexed or poorly written SQL can be a performance killer (CPU, Memory and IO). If you tune your queries, the resultsets will return faster and you’ll be able to send more requests to the host.

  • Enable slow log collection in the MySQL server (long_query_time=0.5)
  • Allow for a period of time where slow performance can accumulate and log a good sample of queryies.
  • Analyse the output with Percona’s pt-query-digest

I would comment that a managed db instance(s) would be as able to meet demand as your droplets with a well tuned schema. The benefit of managed db instances is that you will not need to manage the infrastructure (install, upgrade, etc) and backups are managed too. If there is a failure on your instance the HA should ensure continuity of service.