Why DB clustering is really awesome to scale a monolith project?

Search for a command to run...

No comments yet. Be the first to comment.
In this series/category, I would share with you guys all of my exp and best practices, to build the awesome products
When it comes to image handling (from multiple things like crop, sizing,...). You won't use normal GD of PHP, it sucks. You will use a library instead, and ImageMagick is quite awesome in terms of that. From PHP, ImageMagick also offers a native ext...
Hey guys, An update after I posted the “Laravel Excel: How to append rows to an existing Excel file“ a while back. This post will give you another solution and probably a better way to export that fits every case. Problems Previously, when trying to ...

Hey guys, An easy topic for today! Make something a default (e.g., category, product, campaign, etc). Let’s go with the categories table for the examples. Let’s say we only want one category to be the default one. And find out which is the optimal wa...
Hey guys, Probably a chapter 2 of this https://sethphat.dev/why-is-wordpress-still-an-awesome-cms blog post, haha. Here was the story: I’ve been spending like 2 days figuring out which CMS I want to use for my new blog (for my new hobby lol) Let’s se...

Hey guys, Well damn, it has been a while since my last post lol, lazy & busy. But here I am, back to write useful tips for y’all 🥹 Let us do some exporting tasks for today, using Laravel Excel to export XLSX (yeah CSV is so 2010 lol). But, append mo...

Hey guys, Recently, I just bought Herd PRO (a yearly subscription). I’ve been using the basic Herd since the first release. So, my latest work required interaction with S3 storage, there are several ways to achieve that in the local env: Use Cloud (...

Hey folks,
Have you ever heard about DB Clustering (eg MySQL Clustering)? If not, I would give you a quick summary of it.
Before, I worked at a big company based in Munich, Germany (Still working in Vietnam tho haha). Oh boy, they do have a big monolith monster project, the size, code,...
Man, imagine you have to scale a project like that, millions of users (from public to internal), the DB write operations are insane.
There is no way a traditional 1 write - N replica would work. Write instance will and always be a bottleneck.
Then, here I welcome you to the DB Clustering!
Just like how you deploy your backend project and put it under a Load Balancer, then share the traffic between the instances.
DB Clustering is just as same as that:
Awesome right?
In Tech, there will be no silver bullet for everything. Same as clustering, it would have its own Cons, eg:
But the PROs here are way better to go with.

With the PROs above, for example, I have an App with MAU (monthly active users) of around 1M. Here would be my perfect setup:
If I needed a Queue Worker, then I would give it a dedicated cluster as well 🥳 Thus, it can work independently without taking all the resources from the HTTP layer.
Then I don't have to bother about the monolith structure (yes I know it is bad), but extracting a big app into multiple services aka microservices would take years without new features.
And I can sleep in peace without worrying about spiking in the database when the write operations are high as fk.
Cheers!