Hacker News new | past | comments | ask | show | jobs | submit login

Yes, you need it. Imagine having to make a change to the DB for one service. You'll have to coordinate between all microservices using that DB.



Agree and disagree - it really depends on why you are going to micro services. Is it because you have too many people trying to work on the same thing and you’re architecture is just a reflection of your organisation. Or is it to decouple some services that need to scale in different ways but still need to sit on top of the same data. Or is it some other reason?

I think the dogmatic “you always need a separate database for each micro service” ignores a lot of subtleties - and cost…


> Or is it to decouple some services that need to scale in different ways

This is really over sold. You could allocate another instance to a specific service to provide more CPU to it, or you can allocate another instance to your whole monolith to provide more CPU.

Maybe if the services use disproportionately different types of resources - such as GPU vs CPU vs memory vs disk. But if your resources are fungible across services, it generally doesn't matter if you can independently scale them.

Compute for most projects is the easiest thing to scale out. The database is the hard part.


> Compute for most projects is the easiest thing to scale out. The database is the hard part.

If you did things the "right" way to begin with. You have to keep in mind that many people in the industry need to solve problems of their own making, and this then doesn't translate or make sense to other people.

Scaling is a great example.

It's common to see web applications written in horrendously inefficient front-end languages. Developers often forget to turn "debug" builds off, or spend 90% of the CPU cycles logging to text files. Single-threaded web servers were actually fairly common until recently.

Then of course the web tier will have performance issues, which developers can paper over by scaling out to rack after rack of hardware. Single threaded web server? No worries! Just spin up 500 tiny virtual machines behind a load balancer.

Meanwhile, the database engine itself is probably some CotS product. It was probably written in C++, is likely well-optimised, scalable, etc...

So in that scenario, the database is the "easy" part that developers can just ignore, and scaling the web servers is the "hard" part.

Meanwhile, if you write your front-end properly, then its CPU usage relative to the database engine will be roughly one-to-one. Then, scaling means scaling both the front-end and database tiers.


This is particularly painful experience if you've got business logic at the database layer.

For example stored procedures that due to not splitting the db get "shared" between micro-services.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: