-3

I have a Kubernetes instance from DigitalOcean that has 2 worker nodes and 1 load balancer. Now I want to create a MySQL managed database cluster for the app that will run on that Kubernetes.

Question is: Does DigitalOcean offer enough resources for a scalable database cluster?

The plan that I'm looking at starts at $60 for 4GB memory, 2 vCPUs running MySQL 8.

Besides this i can one-click add more read-only nodes with similar resources.

How capable is a master with those resources?

How can i do the math on resource consumption in order to find out the actual amount of resources that i need for my database cluster?

P.S: the app is going to be written in Laravel 8 running on PHP 7.4.8

2 Answers 2

0

Does DigitalOcean offer enough resources to run a scalable MySQL cluster?

It depends on how much you want to scale.

It is very likely yes if you can put time into properly configuring your master/replicat, but a simple configuration such as the one you describe will handle what could be be concidered a significant load.

How capable is a master with those resources?

It depends on how your application will be used and how much data you will store

For a simple "crud" system or website with not much visitor, this is likely good enough. If your algorithm and query get more intense, you may want to look at replacing php for a language that support Asynchronous pattern.

How can i do the math on resource consumption in order to find out the actual amount of resources that i need for my database cluster?

There is no hard science here: You need to test your configuration and be prepared to upgrade your configuration if you have sized it improperly. Have a look at terraform/ansible to be able to upgrade your infra with the minimum amount of pain. Also welcome to DevOps ;)

RAM usage is generally what kills servers nowadays, so monitore it closely with your app response time. Otherwise, you need to understand how your app query and manage your data to be able to identify potential bottleneck and issue that may arise.

6
  • "will handle what can be considered a significant load" - are ~75.000 clicks/day and around the same amount of insert/update (mostly simple 3/4 fields form submissions) queries per day considered significant? "Also welcome to DevOps" - thank you!:D I've been living this life for ~1month. It is the most stressful 'thing' i've ever done :-s but i loooove it :D
    – emma
    Commented Sep 29, 2020 at 14:52
  • 1
    I think it will handle that first load quite well, but I also think you should not trust random people on the internet >.< Give it a try, make sure you are looking at some metrics that tells you if something goes wrong, and automate as much as you can so you can upgrade things quickly if you make a mistake ^^
    – s.lg
    Commented Sep 29, 2020 at 15:08
  • I feel like, so far, in this DevOps life the answer was 5% 'this is what you should do' 5% 'here you can read the docs' and 90% 'good luck testing' ^.^ :D
    – emma
    Commented Sep 29, 2020 at 16:01
  • That's a way to frame it, yeah ^^. I like to think it's more 33% "is my framework correct", "33% are my metrics the good one" and 33% "woupy I blew up the produtction system, let me rebuild it from scratch in 5 minutes" (Last one is from experience with my current project)
    – s.lg
    Commented Sep 29, 2020 at 16:24
  • o god ok so i should get ready for an even wilder ride? :(
    – emma
    Commented Sep 29, 2020 at 17:06
0

How can I do the math on resource consumption in order to find out the actual amount of resources that I need for my database cluster?

By running simulations of "realistic"1 usages of the system for a while (for simplicity, let's say one day only) and monitoring.

The simulations2 will provide metrics of the computational resources dedicated and data in the database.

As for the computational resources, I usually look for peaks of RAM and CPU2. As for the data2, I look for the estimated growth factor by comparing the initial size of the database with the current one.

If we know the availability of the system, we can multiply the availability and the growth factor to get an estimation of the size needed for the next T time frame.3

Finally, we (should?) add a margin of error to each resource. Say 10-20% depending on how pessimistic/optimistic you feel about the simulations. This margin is for unexpected peaks (you want the fewer downtimes possible). Peaks can be either good or bad news, depending on what's causing the deviation.

Once you have the numbers, you can do the maths with DigitalOcean's calculator (if they have any) or mail'em asking for support.

My approach might seem too simplistic or naive, but it doesn't matter since maths can be improved and be as accurate as you wish. The key is in the simulations and the monitoring.

Once in production, monitoring is still key because you will be asked to estimate growth factors periodically.


1: Say realistic, say conservative.

2: 1 run is not meaningful. Run the simulation several times for the same T time frame. Get several samples and compare. Then you either get the better / worse result or do the average.

3: For simplicity, I calculate availability in the same unit I have had running the simulations. If simulations have been running for 1 day, then I calculate the availability in days too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.