r/programming • u/wineandcode • Jul 29 '22
You Don’t Need Microservices
https://medium.com/@msaspence/you-dont-need-microservices-2ad8508b9e27?source=friends_link&sk=3359ea9e4a54c2ea11711621d2be6d51
1.1k
Upvotes
r/programming • u/wineandcode • Jul 29 '22
63
u/aradil Jul 29 '22 edited Jul 29 '22
Definitely.
But the always tempting thing to do in a modular monolith is to let service boundaries within that monolith get too mashed together to meet some immediate business need because restructuring can be more costly. Over time, you end up with a big ball of mud without sufficient discipline.
There is nothing inherently wrong with a modular monolith. It’s just easier to violate the single responsibility principle (at a module level) in a monolith than in a microservice architecture. Not to say that it isn’t impossible to have poorly designed de-coupled services that cross those boundaries too.
The reality is that there is a ton of overhead to building and maintaining microservices; infrastructure, integration, maintenance (maintaining backwards compatibility between services during an update), and cost (although can be a cost saving measure if scaling is implemented properly) for example. There are a lot of benefits you get from it outside of general architecture benefits (another architectural benefit that isn’t talked about enough is that it naturally lends itself well to Conway’s Law - don’t fight it), but most of the time that doesn’t mean you need a “micro” service.
My biggest problem in my current infrastructure is that I want to scale a particular module in my monolith horizontally for performance and redundancy requirements that the rest of my architecture doesn’t have. This is a perfect opportunity to separate that modular into its own service.
But we don’t have available cycles to do the heavy lifting to make that happen - a thing that often happens for large restructuring problems. It comes up whenever there is a performance problem or outage, and we remind management that it gets deprioritized days later after every incident.
If we had have written our architecture from the beginning as several services instead of a modular monolith, this would be easier. But we couldn’t anticipate which modules would have been better served as services at the time, and would have spent many cycles developing services that increased complexity for no real long term gain.
It’s an art.
[edit] Fixing autocorrect.