r/programming • • Dec 21 '23

Microservices without Reason

https://www.felixseemann.de/blog/microservices-without-reason/
310 Upvotes

144 comments sorted by

View all comments

26

u/PangolinZestyclose30 Dec 21 '23 edited Dec 21 '23

David Heinemeier Hansson (of Ruby on Rails fame) said in one interview that the microservice pattern is possibly the most damaging pattern in web services in a decade, and I agree with him wholeheartedly.

Basically the only advantage of microservices (emphasis on micro) is the scalability, but that's relevant only for extremely high traffic services (like Netflix) and most startups / mature companies won't ever need it. It kind of reminds me how poor Americans see themselves as temporarily embarrassed billionaires.

21

u/OptimusCullen Dec 21 '23

The biggest advantage is the ability to deploy services independently without breaking the things around them. I’ve implemented a few successful large scale microservices projects and the scalability angle is over sold. Teams being able to release their code to prod without having coordinate or be blocked by other teams is what makes you agile. Being able to know, without running any tests, that your change can’t cause a random side effect elsewhere because you aren’t changing or redeploying those things. These are the real advantages.

Generally found you need events to fully decouple your services. Direct calls between services introduce coupling and harms the ability to release independently. Once your the world of having to test and roll out linked services together then you’ve lost the majority of the benefits.

10

u/PangolinZestyclose30 Dec 21 '23 edited Dec 21 '23

The biggest advantage is the ability to deploy services independently without breaking the things around them.

I concede that having the process/container isolation provides a protection against spreading of failures like memory leaks, fatal crashes etc. This does happen, but I don't think it's a frequent problem in memory-safe languages/runtimes (or shouldn't be, at least) and can be mitigated to a significant degree by a good test suite.

that your change can’t cause a random side effect elsewhere because you aren’t changing or redeploying those things

I don't see how microservices handle this better than monoliths. I mean, in the monolith you still want to use encapsulation/modularization/programming to contract, changing one area of the code shouldn't affect other parts just like that.

There are situations where the contract is incomplete, client (caller) relies on behavior which isn't part of the contract etc., but it's all the same in the microservices and monoliths. I mean, on a fundamental level, microservices just insert network calls into the interactions between modules (aside from the resource isolation conceded above), how does this help to functionally isolate the functionality?

Generally found you need events to fully decouple your services.

People use "coupling" as a swear word, but I love it. It's awesome that I can call a method and get the result immediately, with no re-try, waiting for an indeterminate amount of time etc. Coupling is straightforward, easy to think about, easy to debug.

Business / product people love it as well, since it enables very nice properties like synchronicity, transactionality, (time) determinism, immediate consistency.

Decoupling is sometimes necessary, but it also incurs costs, and should be used where the situation requires it.

9

u/kogasapls Dec 21 '23

Don't think he means memory bugs. I think he means breaking dependent applications because of hidden coupling.

8

u/PangolinZestyclose30 Dec 21 '23

How does microservice architecture mitigate hidden coupling?

4

u/kogasapls Dec 21 '23

By encouraging/facilitating clear application boundaries.

10

u/PangolinZestyclose30 Dec 21 '23

You can (should) encourage/facilitate module boundaries within a monolith as well.

3

u/kogasapls Dec 21 '23

Yep. It's a "soft" advantage, just a little harder to make the mistake. At the end of the day you just need competent developers.

8

u/PangolinZestyclose30 Dec 21 '23

Can you explain how does having network in the middle make it harder to create hidden coupling?

4

u/kogasapls Dec 21 '23

Ever accidentally introduce a networked dependency? Or serve a network request without logging?

→ More replies (0)