Live data from Hacker News

Don't start with microservices – monoliths are your friend

arnoldgalovics.com

21–30 of 468 posts

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

#21
post #10

Microservices aren't implemented to solve technical problems, rather they are used to solve organizational problems. Having 10 developers working on a single monolith? Probably fine. 100? Good luck managing that. Yes they add technical complexity. But they reduce organizational complexity.

Wasn't git invented for that? In what way do Microservices even help? It seems to me you still have to synchronize to be sure that the Microservice from team B does exactly the things that are specified in the new version? Is it not easier to have a pull request that says "this will do thing x", you merge it into your monolith, and then you can see in the git log that this version will indeed to x? How do Microservic…

Well, not git, but modularity was invented for that.

You can have a modular monolith that works just as well with 100 people as something service-oriented would. The difference lies in the level of discipline needed. It's much easier to "just go in and make that field public because it makes my implementation easier" when you have a modular monolith. With microservices, you are more explicitly changing an external API by doing that.

Yes, it's the same thing. But somehow, psychologically, people feel worse about changing a networked API than making an identifier public instead of private.

Edit: I forgot, there's one more thing: with service orientation, you can deploy in finer grains. You shouldn't have heavily stateful services, but if you do (and you always do!), it can be cumbersome to redeploy them. At that point, it's nice to be able to deploy only the parts that changed, and avoid touching the stateful stuff.

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

#22
Maybe I'm too old, but I don't even want to have to worry about all that. I think in terms of functions and I don't care if they are being called remotely or local.

That was the promise back in the day of J2EE, and it seems to me Microservices are just a rehash of that same promise.

Which never really worked out with J2EE - it was mostly invented to sell big servers and expensive consultants, which is how Sun made money?

These days I sometimes don't even bother to make extra interface classes for everything. If I need it, I can still insert that, but no need to do it up front.

And "DevOps" is just a ploy to make developers do more work, that was formerly done by admins.

Writing every Microservice in a new language also seems like a huge headache. The only bonus is that you can attract developers by being able to promise them that they can work with some shiny new technology. Maybe that is actually the main reason for doing that?

Otherwise, again, perhaps it is my age, but I prefer to minimize the dependencies. Do I really want to have to learn a whole new programming language just so that I can fix a bug in some Microservice. I personally don't want to.

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

#23
post #10

Microservices aren't implemented to solve technical problems, rather they are used to solve organizational problems. Having 10 developers working on a single monolith? Probably fine. 100? Good luck managing that. Yes they add technical complexity. But they reduce organizational complexity.

I feel like microservices are a solution for magpie developers. It's hard to keep a hundred engineers excited about working in an aging Java stack when there's all these shiny new tools out there. But maybe that's just my perspective, coming from a consultancy firm whose devs wanted to stay on the cutting edge.

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

#24
post #9

There is a lot of talk about monoliths vs microservices lately.. I just want to throw into the ring that you can do both at the same time. easily. And noone is going to kill you for it either. maybe we are getting caught up in sematics because its christmas, but "monorepo/monolith/microservices/etc" is -just- the way you organize your code. Developing a montolith for years but now you have written a 15 line golang ht…

>monorepo/monolith/microservices/etc" is -just- the way you organize your code.

It’s also about how you deploy your code. If you have 1000 micro services do you have 1000 deployment pipelines? If so how do you manage those pipelines? If not, you sacrifice independent deployment of each micro service.

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

#26
Unless you have a strong technical or organizational reason to use microservices, using microservices is just more work to achieve the same results.

Organizational reason would be multiple people/teams who don't want or can't talk much to each other, so they develop pieces of a larger system as relatively independent projects, with clear API and responsibility boundaries. Frontend/backend style web development is an example of such approach, even though we don't typically call these parts "microservices".

A technical reason I can see is some component of a system actually having to be written in a different stack, or to be run in a separate location for business reasons (separate physical computer, separate VMs or containers don't count). Like a firmware running on an IoT system. Or most of the system uses python, but there's a really good library in java for solving some very specific problem, so let's use it.

If neither of these reasons stands, you don't have a microservice architecture, you have a distributed monolith. You just replaced some function calls with RPC. RPC call which takes a much a longer time than a local one, and can randomly fail. Most of your microservices are written in a single stack, so you refactor common parts into a library, but then different services are stuck to use different versions of this library. You end up with a much slower and a much more fragile system which is harder to work on for no good reason.

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

#27
What has worked well for us, something that IMO combines the best out of both worlds:

* break down the problem into sensible components. for a reporting system I'm working on atm. we're using one component per type of source data (postgres, XLSX files, XML), one component for transformations (based on pandas) and one component for the document exporter.

* let those components talk through http requests with each other, including an OpenAPI specification that we use to generate a simple swagger GUI for each endpoint as well as to validate and test result schemas.

* deploy as AWS lambda - let amazon worry about scaling this instead of having our own Kubernetes etc.

* BUT we have a very thin shim in front that locally emulates API gateway and runs all the lambda code in a single process.

   - (big) advantage: we can easily debug & test business code changes locally. 
     only once that is correct we start worrying about deployment, which is all done as IaC and doesn't give us trouble that often.
   - (minor) disadvantage: the various dependencies of lambdas can conflict with each other locally, so gotta be careful with library versions etc.
doing so the scaling works quite well, there is no up-front infrastructure cost and code tends to stay nice and clean because devs CANNOT just import something from another component - common functionality needs to first be refactored into a commons module that we add in each lambda, which puts a nice point for sanity checking what goes in there.

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

#28
post #9

There is a lot of talk about monoliths vs microservices lately.. I just want to throw into the ring that you can do both at the same time. easily. And noone is going to kill you for it either. maybe we are getting caught up in sematics because its christmas, but "monorepo/monolith/microservices/etc" is -just- the way you organize your code. Developing a montolith for years but now you have written a 15 line golang ht…

Maybe it is just me, but I always understood that properly designed microservices have their own specific datastore, which is not shared with other microservices even if these all collaborate to the same process.

If this is actually (still) true, that means that "the way you organize your code" is a bit simplistic. Your example of an "http api that converts pdfs to ..." is surely a valid example of a microservice, but most business products have to handle much more "state" than those, and this will create further complications which go far beyond "how to organize your code" (and make monoliths more appealing).

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

#29

Maybe I'm too old, but I don't even want to have to worry about all that. I think in terms of functions and I don't care if they are being called remotely or local. That was the promise back in the day of J2EE, and it seems to me Microservices are just a rehash of that same promise. Which never really worked out with J2EE - it was mostly invented to sell big servers and expensive consultants, which is how Sun made mo…

I wholeheartedly agree on most parts, with DevOps being the exception.

Devs only focusing on developing/writing source code is certainly not the way to produce sustainable, high quality software- at least in my opinion...

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

#30
I keep trying to do K8S at home but each time hit a wall of complexity and conclude this is ridiculous.

I’m sure has its place for bigger applications though

I do like a modular approach though (think docker rather than k8s) which I suppose is partial micro services

Post reply on HN