Live data from Hacker News

Don't start with microservices – monoliths are your friend

arnoldgalovics.com

341–350 of 468 posts

Re: Don't start with microservices – monoliths are your friend

#341
Another point of confusion among many folks is monorepos. Some consider "monorepos = monoliths", which is more like comparing apples to oranges imo.

Monorepos provide some of the benefits of monoliths in terms of 1) making it easier to refactor your entire codebase at once 2) sharing some common dependencies like framework versions etc., which makes it much easier to keep those up to date and more secure, as a result 3) sharing some common utilities like unit testing harnesses etc. 4) other things

At the same time, monorepos don't force one into a monolith architecture at all, an in fact can provide most of the same benefits of microservices in terms of separate deployments etc.

The most important lesson in my mind is, there's no "panacea" or "perfect structure" as a prescribed way to do things. Every system has its own demands (which also change over time), and the only "should" is to tailor things on a case-by-case basis, adjusting to a better structure when needed.

Re: Don't start with microservices – monoliths are your friend

#342

The only issue I have with microservices is when you're dealing with atomic things. Like in a monolith you'd probably just stick it all in a database transaction. But I can't find any good reads about how to deal with this in a distributed fashion. There's always caveats and ultimately the advice "just try not to do it" but at some point you will probably have an atomic action and you don't want to break your existin…

There are actually some patterns to deal with this, such as Saga - I'm actually working on a project (not open-source yet) related to this specific problem. You can reach me at can@hazelcast.com if you want to learn more.

Re: Don't start with microservices – monoliths are your friend

#343
I failed to launch a side project because of this. Microservices were just becoming trendy and I went in head first.

Ended up losing so much velocity worrying about how to set up the services and even going so far as to implement nano services as rock bottom lol. The project became more mental masturbation on distributed systems than solving any real human problem.

So yeah, start with a monolith. And continue using the monolith. There might be a few services you need to factor out from your main system, but do so with caution.

Re: Don't start with microservices – monoliths are your friend

#344
post #229

Earlier quoted context omitted.

Because there is no newly invented architecture called "modular monolith" - monolith was always supposed to be MODULAR from the start. Micro services were not an answer to monolith being bad. Something somewhere went really wrong with people's understanding and there is bunch of totally wrong ideas. That is also maybe because a lot of people did not knew they were supposed to make modules in their code and loads of m…

> Micro services were not an answer to monolith being bad Micro services today are mostly used for one purpose: to be able to ship your corporation's org chart.

> Micro services today are mostly used for one purpose: to be able to ship your corporation's org chart.

And, this is not necessarily a bad thing.

Re: Don't start with microservices – monoliths are your friend

#346
post #162

Earlier quoted context omitted.

Patterns and automation supporting modularization hasn't received the attention that patterns and automation around services has over the past 10 years. In practice, modularization raises uncomfortable questions about ownership which means many critical modules become somewhat abandoned and easily turn into Frankensteins. Can you really change the spec of that module without impacting the unknown use cases it support…

If a dev team cannot self-discipline itself in maintaining a module, is it wise to entrust it with the responsibility of a whole service? I'd rather work on better mentoring the single members.

Modules have higher requirements for self discipline the services. Precisely because the boundaries are so much easier to cross.

And also because it is harder to guard module from changes made by other teams. Both technically and politically, the service is more likely to be done by a single team who understands it. Module is more likely to be modified by many people from multiple teams who are just guessing what it does.

Re: Don't start with microservices – monoliths are your friend

#347
Every time I open the site and it pops up some weird "subscribe to this and that awesome content" in my face, I immediately close it. Each time I really hope that owner has some analytics set up and they will learn that having this thing is not a good thing to do to your readers.

Re: Don't start with microservices – monoliths are your friend

#348
Microservices doesn't necessarily mean K8S running on self-managed compute instances as in the example given in the article.

The main mistake of the article is that the premise is "microservices" but then the examples are about infrastructure (K8S etc), but the 2 things are not tied, you can have that same architecture cited in the article running monolith instances for example, and it would be every bit as complex as managing the micorservices example, without any of the advantages.

Fully managed serverless solutions like Lambda/Cloudflare Workers/etc, managed through SAM or Serverless Framework solves most of the problems cited in the article.

The whole infra in our case is API Gateway + Lambda + DynamoDB, this infra is not more complex to manage than our old monolith which was on ALB + EC2 + RDS.

Deployment is one "sam deploy" away (done in Github Actions), this is actually even simpler than our previous monolith.

Re: Don't start with microservices – monoliths are your friend

#349
I have worked in companies which had monolith software, but they have been large and established businesses.

I will not name names, but I can say this...

All but one had constant, repetitive and quite painful failures, not fixable, it seemed. One company was an exemption, with some failures but a clear culture of pushing issues while implementing new features.

And one company I have been with from startup days till 150 employees had a microservice infrastructure, I have never seen so little downtime, such a smooth back office, front end, database, reporting system. The cto was owner and main developer, if something went awry, he would start working on the fix within minutes, no matter the day or time. The fastest issue response time ever. 2 lifetime downtimes of a handful minutes for the full service, and a couple components which didn't work for maybe an hour or sometimes overnight. I have to say though, when one microservice broke, it took down more tangential services than one would think, but other than that, hands down the best software I ever worked with.

Re: Don't start with microservices – monoliths are your friend

#350
Here's my take on microservices: It's a form of modularization. Like all modularization it can be useful to uncouple larger parts of a system - to enforce an architecture, avoid unintended cross-dependencies, make explicit the dependencies that are intended, to allow teams to work more independently, and to allow the different parts of the system to be be developed, compiled, built, deployed (and sometimes scaled) independently.

But all this comes at a cost - you have to know where the module boundaries are, because moving these is much harder. The flexibility that you've gained within each module comes at the cost of making it harder to move the border between modules. It's very easy to put down a module border in the right spot, and you make a refactor (needed for cleanup or performance improvement) go from tricky to impossible. E.g. that piece of info needed in this module now canonically lives in the other one. Or we accidentally add a couple N's to the time complexity of an algorithm that works on data in multiple modules.

But getting the borders right on the first try is hard, unlikely even. Where those borders should be depends on a lot of things - the user domain, the performance characteristics, the development team(s) (Conway's law and all that) and the ways in which the business requirements change. For that reason, I think most successful modularizations are either done by breaking down an existing monolith (providing these insights) or by basing it on a known running system that is "close enough" in its needs and environment.

Post reply on HN