DEV Community

Discussion on: Why monoliths are a long term bad idea

nssimeonov profile image
Templar++ • Edited on

Here are my .2c:

The best rule to judge if you need them is: Don't unless you don't have any other option (or the costs of not doing so are multiple times higher).

Here are some valid use cases:

  1. Scalability and redundancy - obviously it's easier to have multiple small EC2 instances that perform some computation. Smaller VMs are easy to start on-demand. For example a food delivery company (Grubhub, Takeaway, Ubereats, Doordash etc) has a few "rush hours" when customers order, then it gets back to near zero. Another good use case is when you have a slow operation (CPU-intensive or communicating with external APIs) it makes sense to have multiple instances of a microserice instead of spinning off the entire monolyth.

  2. Partial redo of an old system - when you have a big old system, created over a decade ago, usually it's maintenance gets harder and harder over time. It's perfectly ok to rewrite portions of it as microservices in order to decrease maintenance costs, improve performance and implement new functionality.

  3. Memory and cache - if you have some processing that requires a lot of memory or caching (although we have distributed cache like Redis) - it makes perfect sense to extract this as a separate microservice. Implementing custom cache if you need it is ok. Multiple instances using less memory is cheaper to create than a bit less instances using much more memory. Here applies the second part of the rule - it's cost.

Please note that for all of the examples the main rule applies - you don't have any other option or it will cost you much more if you keep the monolyth.

PS: I'm sure that we can come up with more good examples, this is just what came to my mine for the brief time I decided to answer.

Thread Thread
codymetzz profile image

Thanks for the detailed answer! Much appreciated!