News for hackers. Stuff that matters.
Re:You Want Modules, Not Microservices by barrkel on Tuesday January 03, 2023 @08:28AM (#34231020)
Microservices, while often sold as solving a technical problem, usually actually solve for a human problem in scaling up an organization.

There's two technical problems that microservices purport to solve: modularization (separation of concerns, hiding implementation, document interface and all that good stuff) and scalability (being able to increase the amount of compute, memory and IO to the specific modules that need it).

The first problem, modules, can be solved at the language level. Modules can do that job, and that's the point of this blog post.

The second problem, scalability, is harder to solve at the language level in most languages outside those designed to be run in a distributed environment. But most people need it a lot less than they think. Normally the database is your bottleneck and if you keep your application server stateless, you can just run lots of them; the database can eventually be a bottleneck, but you can scale up databases a lot.

The real reason that microservices may make sense is because they keep people honest around module boundaries. They make it much harder to retain access to persistent in-memory state, harder to navigate object graphs to take dependencies on things they shouldn't, harder to create PRs with complex changes on either side of a module boundary without a conversation about designing for change and future proofing. Code ownership by teams is something you need as an organization scales, if only to reduce the amount of context switching that developers need to do if treated as fully fungible; owning a service is more defensible than owning a module, since the team will own release schedules and quality gating.

I'm not so positive on every microservice maintaining its own copy of state, potentially with its own separate data store. I think that usually adds more ongoing complexity in synchronization than it saves by isolating schemas. A better rule is for one service to own writes for a table, and other services can only read that table, and maybe even then not all columns or all non-owned tables. Problems with state synchronization are one of the most common failure modes in distributed applications, where queues get backed up, retries of "bad" events cause blockages and so on.

Re:You Want Modules, Not Microservices by mpweiher on Tuesday January 03, 2023 @08:37AM (#34231113)
> Microservices [..] actually solve for a human problem in scaling up an organization.

So does modularity.

"The benefits expected of modular programming are: (1) managerial_development time should be shortened because separate groups would work on each module with little need for communication..."

On the Criteria To Be Used in Decomposing Systems into Modules, D.L. Parnas 1972.

http://sunnyday.mit.edu/16.355/parnas-criteria.html

Re:You Want Modules, Not Microservices by regularfry on Tuesday January 03, 2023 @08:57AM (#34231327)
Parnas was writing under an assumption of BDUF, big-bang releases, and expensive hardware instances. As soon as you want to decouple module deployments and accommodate changing requirements over time you need something else. That "something else" might be "making sure your modular monolith has a good enough test suite that any team can deploy it with only their changes" or it might be "microservices for all", but Parnas' assumption that independently verified modules will need to be built once by independent teams then function correctly when assembled has been comprehensively squashed in the last 50 years.

He's right as far as Conway's Law goes, though.

Re:You Want Modules, Not Microservices by unwind on Tuesday January 03, 2023 @09:17AM (#34231576)
Here I guess BDUF = big design up front.

Edit: failed to spell "I" correctly. Ouch.

Re:You Want Modules, Not Microservices by treis on Tuesday January 03, 2023 @09:25AM (#34231678)
Can you explain why you can deploy microservices independently but not modules?
Re:You Want Modules, Not Microservices by regularfry on Tuesday January 03, 2023 @09:54AM (#34232094)
You can deploy modules independently, but the technical and organisational measures you need in place to do it safely are an extra step you need to take whereas with microservices they're built in. Modules live in the same execution context, so you need a good shared ownership model for that context itself.

The point is that Parnas never conceived of doing it because he was writing about a world where the interfaces between modules were known ahead of time and were static.

Re:You Want Modules, Not Microservices by treis on Tuesday January 03, 2023 @10:23AM (#34232504)
You need to do additional steps in both cases:

With modules you need some sort of wrapper application to bring it all together.

With microservices you need some sort of network layer so that the microservices can talk to each other.

Re:You Want Modules, Not Microservices by regularfry on Tuesday January 03, 2023 @10:26AM (#34232568)
And also with modules you need the business processes to coordinate deployments across teams, because they all live in the same wrapper application. That's what stops them being independent.

You don't restart the network every time you deploy a microservice.

Re:You Want Modules, Not Microservices by treis on Tuesday January 03, 2023 @10:42AM (#34232847)
>And also with modules you need the business processes to coordinate deployments across teams, because they all live in the same wrapper application. That's what stops them being independent.

If we're being technical some languages support hot swapping modules so no restart would be needed. Setting that aside, restarting an application isn't anything that needs coordination today. You wouldn't even restart the application. You'd deploy a new version, swap over, and shut down the old version.

>You don't restart the network every time you deploy a microservice.

No, but something changes in the network configuration so that the other microservices are aware of the deployment.

Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @10:03AM (#34232220)
Same thing with microservices, unless you do a blue green deployment, have a planned shutdown, load balancer in between releases,...
Re:You Want Modules, Not Microservices by regularfry on Tuesday January 03, 2023 @10:24AM (#34232521)
The key word is "independently".
Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @10:29AM (#34232607)
There is no independently in distributed systems.
Re:You Want Modules, Not Microservices by regularfry on Tuesday January 03, 2023 @10:37AM (#34232764)
You can't solve the halting problem either, and yet somehow useful work gets done.
Re:You Want Modules, Not Microservices by jacobr1 on Tuesday January 03, 2023 @11:01AM (#34233138)
But there are rules of blame.

With microservices, as long as you maintain the contract with caller services, you can deploy whenever you want. If you have some kind of issue, your team is solely responsible. If the caller services do weird things, they are responsible for fixing them.

If you are pushing changes to a module as part of a more monolithic, or wrapper service - if you do a deploy and break the whole big service, you are now responsible for the entirety of any issue, which is now more likely due to integration risk and unrelated changes from others, especially because now there need to be coordination across many teams integrating - hopefully via tests and observability. But this requires a high-degree of maturity for automated quality assurance and site reliability. If you don't have that, the operational risks are very high. So that alternative is having some ops-like function, or other integration team responsible. Or doing more top-down waterfall coordination.

Given the service maturity needed is rare, microservices distributes that operational ownership in a way where there is more accountability.

Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @11:30AM (#34233618)
Unless there is infrastructure in place good luck replicating those dropped requests as services are replaced.

Infrastructure that someone has to take care of.

Re:You Want Modules, Not Microservices by Pet_Ant on Wednesday January 04, 2023 @12:05PM (#34248216)
Every organisation I've worked at that had microservices has had all of them released every other Thursday at the same time by the same pipeline because they are tied to the organisation scrum schedule. Also, most changes are part of epics that span multiple microservices. If you are gonna argue that properly done microservices don't have that problem you are free to practice your perfect microservices alongside perfect scrum, oop, and communism.
Re:You Want Modules, Not Microservices by jacobr1 on Wednesday January 04, 2023 @02:22PM (#34250116)
I was arguing the opposite, coordinated deployments already presumes more maturity than I was considering. I've only been at one company with same-day deployments. All the other places have been free-for-alls where each group determines their own release schedule, with their own pipelines. Managing deployments between dependent services thus requires significant coordination overhead (or none, because you are stuck with what you get until the other teams deliver your needs on their own timeline).

In chaotic environments like that, microservices help with defining clear ownership of operational responsibility, though at the cost of clear responsibility for the overall distributed system. This comes at the cost of making it hard to develop, let alone ship, changes that impact multiple microservices (outside the scope of a single team, or closely related sibling teams).

The main point I was making was that, with a more monolithic system, managing that kind to organization disfunction, necessitates top-down, waterfall like control. So moving to microservices enables non-coordinated agility removing one layer of coordination problem (a the cost of other problems).

Re:You Want Modules, Not Microservices by dkarl on Tuesday January 03, 2023 @11:05AM (#34233198)
> the technical and organisational measures you need in place to do it safely are an extra step you need to take whereas with microservices they're built in

They aren't built in, it's just that the need for them is impossible to ignore. Developers (and management) can't help but recognize and respect modularity in microservices because the separation of services and the APIs between them make the modularity obvious. When the separation between modules only exists in code, and even then only when seen through the eyes of someone who understands the modular architecture of the codebase, it is easily ignored, inevitably forgotten, and might as well not exist at all.

Re:You Want Modules, Not Microservices by esailija on Wednesday January 04, 2023 @04:53AM (#34243837)
Module is not just code in a separate file. Litmus test: if you cannot have two modules be written in separate languages - you don't have modules. M

If all modules have to be deployed using the same build even though different build of the modules would have been API compatible - you don't have modules.

Re:You Want Modules, Not Microservices by int_19h on Thursday January 05, 2023 @05:03PM (#34267499)
That sounds way too strict to me. A C++ app might use the C++ ABI to communicate with its modules, which would preclude writing them in any other language without jumping through too many hoops. But that's an ABI constraint and says nothing about the actual modularity of the application.

IMO a module is defined as something that has a self-contained API, and versioning rules for that API if the module is evolving.

Re:You Want Modules, Not Microservices by dkarl on Tuesday January 03, 2023 @10:59AM (#34233097)
For code modularity to serve the same purpose, I think there needs to be explicit language-level support, because on a medium-sized or larger project, when the modularity exists only in the minds of developers, it might as well not exist at all. You need virtually all of your developers to understand the design and respect the seriousness of violating it, and beyond a certain project size, that isn't possible.

Developers do a much better job with microservices. I think it's easy for them to respect the seriousness of designing and changing the API of a microservice. In contrast, they often don't respect or even realize the seriousness of making a change that affects the modular design of code.

Language-level support for defining and enforcing module interfaces might help developers invest the same level of care for module boundaries in a modular monolith as they do in a microservices architecture, but I've yet to work in a language that achieves this.

Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @07:13PM (#34240024)
You would hope so... but it's not necessarily the case.

Often people are too lazy to issue API version change on a "bugfix", and take down multiple applications.

Funny thing, a modularized monolith may have identified some of those issues.

Re:You Want Modules, Not Microservices by LAC-Tech on Tuesday January 03, 2023 @05:50PM (#34239282)
Off topic, but 70s computing papers are just the best aren't they?
Re:You Want Modules, Not Microservices by daitangio on Tuesday January 03, 2023 @08:39AM (#34231126)
Totally agree. Also microservices shines IF you need different release schedule for two services. If they are managed in the same project/team, the effort you pay is high, the advantage could not pay your bill, so be careful in such scenario.
Re:You Want Modules, Not Microservices by zeroxfe on Tuesday January 03, 2023 @08:47AM (#34231222)
Both Modularization and Microservices solve scaling problems.

Modularization allows development to scale.

Microservices allow operations to scale.

Re:You Want Modules, Not Microservices by leidenfrost on Tuesday January 03, 2023 @08:52AM (#34231271)
I think most criticisms around microservices are about good practices and skills beating microservices in theory.

And the virtue of microservices is that they create hard boundaries no matter your skill and seniority level. Any unsupervised junior will probably dissolve the module boundaries. But they can't simply dissolve the hard boundary of having a service in another location.

Re:You Want Modules, Not Microservices by BackBlast on Tuesday January 03, 2023 @09:04AM (#34231394)
Those boundaries also increase the cost of development. If you are institutionally incapable of enforcing coding standards such that you can't prevent juniors from coupling your modules, perhaps it's worth it. But there are more efficient ways to build and run an engineering organization.

The best place for such boundaries is at the team/division/org level, not team-internal or single dev-internal like microservices implies with its name. Embrace Conway's law in your architecture, and don't subdivide within a service.

Re:You Want Modules, Not Microservices by guywhocodes on Tuesday January 03, 2023 @09:13AM (#34231519)
Are organizations ever capable of enforcing coding standards even remotely close to that of what microservices _should_ provide? Because I have not seen it.

However this is muddied by the fact that I almost never see microservices, I see a lot of distributed monoliths tho.

Re:You Want Modules, Not Microservices by BackBlast on Tuesday January 03, 2023 @09:40AM (#34231874)
I guess the birth of the term distributed monolith gives lie to the idea that the service boundaries can't be breached by devs. :)
Re:You Want Modules, Not Microservices by BackBlast on Tuesday January 03, 2023 @09:45AM (#34231953)
For an org capable of adhering to standards. I've seen success in small teams. I've never seen it in a large org through, it's always a dumpster fire. Especially anything that grows really fast, culture is out the window to randomness, and it's a hodgepodge of understanding and methods that are all over the map.
Re:You Want Modules, Not Microservices by dalbasal on Tuesday January 03, 2023 @09:46AM (#34231962)
"If you are institutionally incapable of..."

This is the road to bullshit. Of course no manager or CEO will admit that their team/company is that. Admitting technical non-excellence is nearly impossible. Organisation inadequacy... impossible.

So the best course of action is to pretend your organisational methods are really just software architecture... and back to square one.

Re:You Want Modules, Not Microservices by guywhocodes on Tuesday January 03, 2023 @09:57AM (#34232129)
This is something I'm painfully familiar with and I'm starting to seem to me that "definition creep" that I thought was the result of marketing. Such as we see with terms like "AI" and "ML", actually mostly comes from this.

If you are a dumpster-fire S&P500 company CTO and there is a new shiny thing that would actually improve things, you are probably more capable of redefining that new term into the horse-shit you are currently doing; than actually do it.

Re:You Want Modules, Not Microservices by BackBlast on Tuesday January 03, 2023 @09:55AM (#34232102)
If you can't admit the problem. Can't stare it down. Can't comprehend it. Then I don't know how you can ever solve it. I try to avoid these places, not easy though.
Re:You Want Modules, Not Microservices by jacobr1 on Tuesday January 03, 2023 @10:48AM (#34232939)
Are there any examples of large organizations that don't have this problem? I can imagine places with small teams that are basically isolated that can operate efficiently, but once you scale to point where dozens to hundreds of teams needing to cooperate, it seems like all you have is tradeoffs and fundamental coordination and scaling issues. I've never heard of a big org that didn't have some flavor of disfunction resulting from that kind of complexity. Some places seem to be "less-bad" but that doesn't mean good or efficient.
Re:You Want Modules, Not Microservices by locutous on Tuesday January 03, 2023 @02:12PM (#34236446)
Jim Keller mentioned this problem in the hardware space. Basically when people breach the interface design and couple things and how that coupling limits your ability to grow the design.

When he helped set the tone for the Zen architecture he took AMDs existing people, set them on a more aggressive path and one of the cardinal tenants was you could not cheat on the interfaces. This is one of the nuggets you can pull from his interviews.

It's possible. It happens. And the end results can be industry changing.

Re:You Want Modules, Not Microservices by JamesBarney on Tuesday January 03, 2023 @12:53PM (#34235011)
Any way you slice it, it's hard to manage/align/coordinate a 100 devs.

If done right microservices is a way to transform part of your organization challenge into a technical one, which for many organizations is the right move.

The biggest issue is if you aren't large enough to have challenging organizational issues it's much easier to just solve the very solvable organizational issues than implement and use microservices.

Re:You Want Modules, Not Microservices by locutous on Tuesday January 03, 2023 @01:56PM (#34236123)
> If done right microservices is a way to transform part of your organization challenge into a technical one, which for many organizations is the right move.

Famous last words, if done right... Or you just multiply your organizational issue with a technical one.

Re:You Want Modules, Not Microservices by JamesBarney on Tuesday January 03, 2023 @02:19PM (#34236555)
Sure poorly implemented solutions rarely solve problems well.

But implementing microservices is not an unsolvable problem. It's a problem that 1000s of organizations have solved.

Re:You Want Modules, Not Microservices by locutous on Tuesday January 03, 2023 @05:08PM (#34238806)
I haven't seen one that has done it well personally. Missing in this is so much of how it might be done right. There are so many dragons. Vendor lock in, logging, debugging, development (can I run the application on my laptop?), versioning. How far will out of the box tooling get me vs what I have to build. Etc etc etc.

When the "new shiny" effect wears off you usually find a turd that smells worse than what came before. Which is why we see this thread ever month or two and will until the tooling catches up and companies stop creating the distributed turds or the method falls out of grace because people finally realize you can scale simple systems pretty far vertically.

Re:You Want Modules, Not Microservices by marcosdumay on Tuesday January 03, 2023 @09:25AM (#34231686)
> But they can't simply dissolve the hard boundary of having a service in another location.

I've seen people doing that a few times already. They start changing due to some uninformed kind of "convenience", and then you look at the services API and it makes no sense at all.

Re:You Want Modules, Not Microservices by jeltz on Tuesday January 03, 2023 @11:25AM (#34233535)
Yeah, I feel that happens all the time.
Re:You Want Modules, Not Microservices by esailija on Tuesday January 03, 2023 @09:48AM (#34231991)
Huh? They can, and will, just add the things they want to the rest api of the microservice A and then call them from B. That doesn't change with microservices.

Look up a thing called "distributed monolith".

Re:You Want Modules, Not Microservices by jacobr1 on Tuesday January 03, 2023 @10:51AM (#34232979)
That is harder when each service and team has their own repo and review process. Doesn't mean they won't just get merged, but there is increased friction and less-trust about random PRs from engineers that aren't actively working on the same team, so those PRs might get more scrutiny.
Re:You Want Modules, Not Microservices by esailija on Tuesday January 03, 2023 @11:27AM (#34233557)
Then why cannot you have separate repos and review processes for modules? This has nothing to do with microservices vs modules.
Re:You Want Modules, Not Microservices by jacobr1 on Tuesday January 03, 2023 @11:54AM (#34234036)
Agreed - ther is no reason for that not to be the case. It just is that in practice (and not as some essentialism of how organizations needs to structure things) that miroservices tend proliferate git-repos and modules tend to be part of monorepos. But, sure, there is no need for that to be the case. So given a world like that, the repo seperation is what enforces the friction for junior devs to submit changes across repos. With monorepos it is easier.
Re:You Want Modules, Not Microservices by papito on Tuesday January 03, 2023 @09:56AM (#34232122)
I have never seen a "hard boundary" in a small to medium sized company. Everyone still ends up communicating, and there are simply not enough resources to maintain truly separate services.

The rigor of maintaining resilient, backward-compatible, versioned internal APIs is too resource and time consuming to do well. All I see is hack and slash, and tons of technical debt.

It seems like in the last couple of years it started sinking in, that distributed systems are hard.

Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @10:02AM (#34232197)
If the modules are distributed in binary form, for the languages that support them, the junior will have no way around it unless they feel like learning about hacking binaries.
Re:You Want Modules, Not Microservices by mattmanser on Tuesday January 03, 2023 @12:33PM (#34234696)
I always love that circular logic.

"Hey our developers can't make modules correctly! Let's make the API boundaries using HTTP calls instead, then they'll suddenly know what to do!"

And that unsupervised junior? At one place I joined, that unsupervised junior just started passing data he "needed" via query string params in ginormous arrays from microservice to microservice.

And it wasn't a quick fix because instead of using the lovely type system that TELLS you where the stupid method has been used, you've got to go hunting for http calls scattered over multiple projects.

All you've done is make everything even more complicated, if you can't supervise your juniors, your code's going to go sideways whatever.

Microservices don't solve that at all and it's pure circular logic to claim otherwise. If your team can't make good classes, they can't make good APIs either. And worse still, suddenly everything's locked in because changing APIs is much harder than changing classes.

Re:You Want Modules, Not Microservices by chasd00 on Tuesday January 03, 2023 @09:09AM (#34231466)
yeah i've always thought that microservices shine when the org chart defines them. I've been on teams where we were responsible for multiple microservices and it was so annoying to have to bounce back and forth between code bases and deployments and then it was super easy to intertwine different microservices when you were in the them so often. I feel like if you don't have a team dedicated full time per microservice then you probably shouldn't be using that architecture.
Re:You Want Modules, Not Microservices by strictfp on Tuesday January 03, 2023 @09:14AM (#34231532)
This has been my major criticism of them; you cement the design of the app by creating an organizational structure around your software components.

What happens if you need to redesign the architecture to meet new needs? That's right; it's not going to happen, because people will fight it tooth and nail.

You also cannot produce any meaningful end-user value without involving several teams.

Microservices is just "backend, frontend, and database team" reincarnated.

My take: do Microservices all you want, but don't organize teams around the services!

Re:You Want Modules, Not Microservices by mattgreenrocks on Tuesday January 03, 2023 @09:38AM (#34231851)
Implicit to this discussion is the belief that growth inevitably means more people, and that the collateral damage of more people is worth the cost of spending so much time to corral said people. So industry clings to frameworks with a single blessed path, languages that provide only one way to do things, caps expressiveness (just mention macros and people start frothing from the mouth).

This isn't easily fixable, but I'd like technologists to at least be able to perceive the extent to which the surrounding business culture has permeated into technical culture. I'm probably considered old AF by a lot of you (41) but I'm becoming increasingly interested in tools/methodologies that enable fewer devs to do a lot more, even if it means that there are sharp edges.

Re:You Want Modules, Not Microservices by klodolph on Tuesday January 03, 2023 @09:59AM (#34232161)
It seems natural and correct to me that the business concerns and technical concerns would be mixed together. Engineers should understand the business needs of the organization and account for them, just as leadership should understand technical needs.

As projects get larger, the problems become more organizational in nature.

Re:You Want Modules, Not Microservices by hinkley on Tuesday January 03, 2023 @10:59AM (#34233096)
Fewer devs doing a lot more has always been my goal, and in hardware we would call this a vertical scaling versus horizontal scaling problem.

Horizontal scaling always incurs communication overheads faster, and as we know, developers have high communication overhead to begin with.

Human scaling is its own problem set and companies like to ramp projects up and then down again. Most of those people only think about how to get more people on board, not how to run the ship once attrition starts to condense responsibilities and reduce redundancy, especially for unpleasant tasks.

I’ve been trying to beat the idea of ergonomics into a smart but mule-headed developer (too old not to know better) for years now and it wasn’t until a combination of team shrink and having to work with code written by a couple of people who emulate his development style that all of a sudden he’s repeating things I said four years ago (of course with no self awareness of where those ideas came from). It remains to be seen if it affects how he writes code, or whether he starts practicing Do As I Say, Not As I Do, but I’m a short-timer now so it’s mostly an anthropological study at this point.

Re:You Want Modules, Not Microservices by bfeynman on Tuesday January 03, 2023 @09:39AM (#34231863)
Organizing teams around microservices makes ... a lot of sense?

Also - talking of redesign should be a major lift for any product/service that has real paying clients. The risk of breaking is huge, and the fact that during that time you won't be delivering incremental value is also going to look bad.

Re:You Want Modules, Not Microservices by dboreham on Tuesday January 03, 2023 @09:37AM (#34231840)
> but don't organize teams around the services

This is actually the whole point (see: Reverse Conway).

Re:You Want Modules, Not Microservices by ClumsyPilot on Tuesday January 03, 2023 @10:52AM (#34233015)
indeed, you might as well build a distrubuted monolith if your priority is absolute flexebility and ability to re-design on the fly
Re:You Want Modules, Not Microservices by jonhohle on Tuesday January 03, 2023 @09:27AM (#34231703)
One of the principal engineers at Amazon called that “Org-atecture”.
Re:You Want Modules, Not Microservices by lightbendover on Tuesday January 03, 2023 @10:28AM (#34232592)
Amazon is a good example of a huge organization absolutely crippled by micro-service fiefdoms driven by sr.mgr whims and not strong technical guidance from such PEs.
Re:You Want Modules, Not Microservices by beastcoast on Tuesday January 03, 2023 @11:19AM (#34233430)
Depends entirely on the org. My org actually broke SOA (thousands of services and some intense technical debt) and is now in a years long process of moving toward a centralized service orchestration model. This couldn’t have happened without PE, Sr PE and DE involvement.
Re:You Want Modules, Not Microservices by stephenhuey on Tuesday January 03, 2023 @12:23PM (#34234495)
Now that sounds interesting. I assume you're not counting each API endpoint as a service, so can you shed any more light on this? The scale sounds mind-boggling. Thousands of separate services being pulled (more) together. Can you give an idea of the size or scope of these services?
Re:You Want Modules, Not Microservices by beastcoast on Tuesday January 03, 2023 @04:22PM (#34238259)
>1000 services, each with many APIs :)

Amazon's warehouses have incredible domain complexity which drives the complexity of the software architecture. It's also one of the oldest parts of the company with a direct lineage going back 20+ years. (for example, our inventory databases still have the same schema and are still using a RDBMS, albeit RDS Postgres instead of Oracle).

About five years ago we started rearchitecting to a centralized orchestration service which is being used to abstract this complexity from process teams. This is to avoid projects where 20+ service teams must be engaged just to launch a new solution.

Re:You Want Modules, Not Microservices by lmm on Tuesday January 03, 2023 @10:18PM (#34241593)
And look how much damage it's done to their business.
Re:You Want Modules, Not Microservices by dasil003 on Tuesday January 03, 2023 @09:30AM (#34231736)
How do you organize teams if not around services? As the GP points out, the whole point of SOA is to scale people. Yes, this makes rearchitecture hard, but that is always the case at scale. The problem of territoriality and resistance to change needs other solutions (tldr; clueful management and mature leadership level ICs who cut across many teams to align architecture vision and resolve disputes between local staff engineers)
Re:You Want Modules, Not Microservices by wpietri on Tuesday January 03, 2023 @10:36AM (#34232760)
Exactly my question. The teams are going to be organized around something. Even if not intentionally, it'll be true in practice, as people are going to end up knowing things. And if you fight that, it only gets worse.

Long ago I consulted for one company that reconstituted teams for every new project, so people got swapped around every few months, usually ending up in a new chunk of the code. Whatever the theoretical benefits, it meant that nobody felt a sense of ownership for any of the code. Combine that with aggressively short project deadlines and an absolute refusal to ever adjust them and the code rapidly dropped in quality. After all, you'd be on something else soon, so any mess wasn't your long-term problem. And why should you bother given that the code you started with wasn't pristine?

As far as I can tell, the best it gets is organizing around the most durable features of the business environment. E.g., audiences and their real-world needs. Next, long-lived solutions to those needs. And then you find the common and/or large needs of those teams and spin up service teams around them. And in the background, some strong culture around what the priorities really are, so that service teams don't get so self-important that they become the tail wagging the dog.

But I love all the war stories here and would love to hear more, as I think there are no perfect global solutions to organizational problems. I think it's mostly in the details of circumstance, history, and the people involved.

Re:You Want Modules, Not Microservices by jcampbell1 on Tuesday January 03, 2023 @11:02AM (#34233151)
Organize around delivering value to the customer. This is the obvious split for different products, and it is natural for something like AWS where each service is a relatively small team. Sometimes the customer is internal and they need an API, and internal customer decides when they are satisfied, not the API passing tests. SOA will arise, but services need to be big rather than micro, have defined internal customers and their own team. Better to have teams with frontend, backend, designer, etc. who collectively complete features, rather than hoping a bunch of services integrate into a solution for the customer at the end. It is much easier to get the architecture right when people talk first and often about what the customer needs more than implementation details. I think once you have decided how data is going to be persisted and what the customer needs to accomplish, the architecture falls into place. The application code should be stateless so it is never a scaling issue. When the code is isolated by customer feature, the blast radius for future changes is much smaller.

Microsoft, Apple, Amazon I think do a good job at preaching the customer first model and organizing around that.

Re:You Want Modules, Not Microservices by slowmovintarget on Tuesday January 03, 2023 @12:35PM (#34234731)
Organize teams around products. The point is to increase value delivered to the customer through the product, not to produce left-pad-as-a-service.
Re:You Want Modules, Not Microservices by satellites on Tuesday January 03, 2023 @05:57PM (#34239356)
Agreed. I've worked at a scarce few companies who organized this way, but it seemed to work better than "frontend team, backend team, devops team." When each piece of the stack is a different team, it creates unnecessary hostility and miscommunication. Aligning engineers around products, such that your iOS dev and your backend dev are on the same team, seems to run more smoothly. YMMV.
Re:You Want Modules, Not Microservices by adolph on Tuesday January 03, 2023 @09:20AM (#34231621)
Conway's law is an adage that states organizations design systems that mirror their own communication structure. It is named after the computer programmer Melvin Conway, who introduced the idea in 1967. His original wording was:

  Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.

  — Melvin E. Conway
https://en.wikipedia.org/wiki/Conway's_law
Re:You Want Modules, Not Microservices by je42 on Tuesday January 03, 2023 @09:46AM (#34231968)
Conways law: Tech follows communication patterns (.i.e org setup)

hence, if you want a certain architecture, you likely need to execute a "reverse conway law" org first. To get the org into the target config, the software will follow.

Re:You Want Modules, Not Microservices by hinkley on Tuesday January 03, 2023 @11:03AM (#34233162)
It’s okay for one team to have several logical units of code. In fact from a Conway First model, it’s helpful because it allows horse trading when it turns out the team competencies don’t match responsibilities very well. I’m not dismantling my team, I’m just transferring module ownership to another team.

What does not work is splitting ownership of many tings for a long time. It’s too many plates to spin. But some things can be shared by a few people without tipping over into anarchy.

Re:You Want Modules, Not Microservices by jerf on Tuesday January 03, 2023 @09:54AM (#34232096)
"This has been my major criticism of them; you cement the design of the app by creating an organizational structure around your software components."

Conway's Law is basically "You don't have a choice." You will cement the design of your app around your organizational design. (At least, beyond a certain org size. If you have only 4 engineers you don't really have the sort of structure in question here at all.) je42 narrowly beats me to the point that if this is a problem you can try to match your organization to your problem, but that takes a fairly agile organization.

"What happens if you need to redesign the architecture to meet new needs? That's right; it's not going to happen, because people will fight it tooth and nail."

Unfortunately, in the real world, this is not so much "a disadvantage to the microservice approach" as simply "an engineering constraint you will have to work around and take account in your design".

Despite what you may think after I've said that, I'm not a microservice maximalist. Microservices are a valuable tool in such a world but far from the only tool. As with everything, the benefits and the costs must be accounted for. While I've not successfully rearchitected an entire organization from my position as engineer, I have had some modest, but very real success in moving little bits and pieces around to the correct team so that we don't have to build stupid microservices just to deal with internal organizational issues. I don't mean this to be interpreted as a defeatist "you're doomed, get ready for microservices everywhere and just deal with it"; there are other options. Or at least, there are other options in relatively healthy organizations.

But you will have code that matches the structure of your organization. You might as well harness that as much as you can for the benefits it can provide because you're stuck with it whether you like it or not. By that I mean, as long as you are going to have teams structured around your services whether you like it or not, go in with eyes open about this fact, and make plans around it to minimize the inevitable costs while maximizing the benefits. Belief that there is another option will inevitably lead to suboptimal outcomes.

You can't engineer at an organizational level while thinking that you have an option of breaking the responsibility and authority over a codebase apart and somehow handing them out to separate teams. That never works long term. A lot of institutional malfunctioning that people correctly complain about on HN is at its core people who made this very mistake and the responsibility & authority for something are mismatched. Far from all of it, there are other major pathologies in organizations, of course. But making sure responsibility & authority are more-or-less in sync is one of the major checklist items in doing organization-level engineering.

Re:You Want Modules, Not Microservices by lightbendover on Tuesday January 03, 2023 @10:24AM (#34232524)
Part of the issue is that not everyone understands the trade-offs or perhaps believes the trade-offs so you get teams/leaders haphazardly ignoring expert guidance and crafting careless micro-services around team boundaries that do not line up with value.
Re:You Want Modules, Not Microservices by jerf on Tuesday January 03, 2023 @02:43PM (#34236897)
I find the responsibility & authority angle is very helpful in these conversations. It doesn't take a lot of convincing (in a reasonably healthy organization) to say that these should be broadly aligned, and that if you can show people a place where they are either currently grossly out of sync, or are going to be out of sync if we move forward with some particular iteration of the plan, they start thinking more about how to bring them in sync.

The good news is, pretty much everyone has been on at least one side of that balance being broken (that is, having responsibility without authority, or being subject to someone else's authority without responsibility), and a lot of people have been on both, and once you bring it to their attention that they're creating another one there is a certain amount of motivation to avoid it, even if it is a bit more work for a them. You can actually use people's experiences with bad organization to convince them to not create another one, if you are careful and thoughtful.

Re:You Want Modules, Not Microservices by hinkley on Tuesday January 03, 2023 @11:15AM (#34233370)
You never want code with shared ownership to tolerate feature creep. That’s impossible to keep on the rails. If you’re going to use SOLID anywhere, it’s in shared code.

If your org doesn’t suffer feature creep willingly, I believe that means you can have a lot more flexibility with respect to Conway’s Law. A low-churn project can maintain a common understanding. Not all of them will of course, but it’s at least possible. Feature factories absolutely cannot, and you shouldn’t even try.

What really kills a lot of projects though is an inverted dependency tree. And by inverted I mean that the most volatile code is at the bottom of the call graph, not the top. In this case every build, every deploy, or in the microservices scenario every request, can have different behavior from the previous one because some tertiary dependency changed under you. Now you need all sorts of triggers in your CI/CD pipeline to guarantee that integration tests are rerun constantly to figure out where the regressions are being introduced. Your build pipeline starts to look like one of those server rooms with loose wires everywhere and a bucket under the AC unit. Nothing is stable and everything is on the verge of being on fire at a moment’s notice.

Re:You Want Modules, Not Microservices by zbobet2012 on Tuesday January 03, 2023 @01:25PM (#34235541)
I mentioned this elsewhere, but I think it's a good idea to read the actual text of conways law:

> Any organization that designs a system (defined broadly) will produce _a design whose structure is a copy of the organization's communication structure_.

Organization is the primary method by which we organize communication (indeed, that's its only point). That's why architecture follows organization. It is possible to "break" that boundary by organizing other forms of communication, for example the feature teams of SAFE (not a proponent of safe, just an example).

Re:You Want Modules, Not Microservices by jerf on Tuesday January 03, 2023 @02:37PM (#34236824)
This is the "reverse Conway's law" that some others are referring to, and I alluded to. I've had success doing it in small places here and there. I'm yet to convince a management organization to do a really large-scale reorg because of some major pathology, though. Though I haven't tried often, either. Really just once. The costs are automatically so high for such a proposal that it is difficult for mere engineering needs to get to net-positive because it's hard to prove the benefits.
Re:You Want Modules, Not Microservices by hbrn on Tuesday January 03, 2023 @10:31AM (#34232651)
> What happens if you need to redesign the architecture to meet new needs?

How often does major reorganization happen? For most companies the answer is never.

The "what if" argument is what leads to all sorts of premature optimizations.

Re:You Want Modules, Not Microservices by arsenico on Tuesday January 03, 2023 @10:45AM (#34232899)
> How often does major reorganization happen? For most companies the answer is never.

For most companies – regularly.

Re:You Want Modules, Not Microservices by indymike on Tuesday January 03, 2023 @10:56AM (#34233076)
The kind of reorg we're talking about here is not the typical musical chairs, but a full realignment. This happens a lot less frequently in my experience.
Re:You Want Modules, Not Microservices by bfeynman on Tuesday January 03, 2023 @12:23PM (#34234511)
reorgs usually happen higher up the tree in larger companies, been through a bunch and its never affected any part of our work.
Re:You Want Modules, Not Microservices by BurningFrog on Tuesday January 03, 2023 @10:47AM (#34232923)
Reorgs rarely happen.

But the need for them does :)

Re:You Want Modules, Not Microservices by zeroonetwothree on Tuesday January 03, 2023 @11:42AM (#34233836)
I've had three reorgs in the past six months. Each one changed our projects and priorities.

Yeah, didn't get a lot done...

Re:You Want Modules, Not Microservices by JamesBarney on Tuesday January 03, 2023 @12:41PM (#34234831)
Without the organizational benefits of a microservice you are just just making intermodular calls really slow, and fail intermittently.
Re:You Want Modules, Not Microservices by catlifeonmars on Tuesday January 03, 2023 @01:06PM (#34235204)
> My take: do Microservices all you want, but don't organize teams around the services!

Exactly. In order to reap the benefits of modular/Microservices architecture, you need teams to be organized around product/feature verticals.

IMO it’s not about the internals of a product/service architecture, but about encapsulating, isolating, and formalizing inter-organizational dependencies.

Re:You Want Modules, Not Microservices by twblalock on Tuesday January 03, 2023 @02:49PM (#34236990)
> This has been my major criticism of them; you cement the design of the app by creating an organizational structure around your software components.

That will always happen, and I've seen it happen in a monolith too (expressed as module ownership/ownership over part of the codebase).

It's inevitable in almost all organizations.

Re:You Want Modules, Not Microservices by ramblerman on Tuesday January 03, 2023 @09:22AM (#34231638)
You shoot yourself in the foot pretty hard regarding point 2 (scalability) if you have your microservices share a DB.
Re:You Want Modules, Not Microservices by jollyllama on Tuesday January 03, 2023 @10:19AM (#34232439)
Or hardware. I worked on an HPC product which used "microservices" of a kind but many of them were tied to specific hardware nodes. So much of what we think of as "microservices" relies on a fairly narrow set of assumptions, and mostly makes sense in specific contexts, i.e. cloud, APIs, etc.
Re:You Want Modules, Not Microservices by barrkel on Tuesday January 03, 2023 @10:30AM (#34232644)
FWIW, most of Google's Ads services share a database - the catch is it's F1 on top of Spanner. Latency is highish, but throughput is good.

In the outside world, for an application that may truly need to scale, I'd go MySQL -> Vitess before I'd choose separate data stores for each service with state. But I'd also question if the need to scale that much really exists; you can go a long way even with data heavy applications with a combination of sharding and multitenancy.

Re:You Want Modules, Not Microservices by henryfjordan on Tuesday January 03, 2023 @12:43PM (#34234857)
Microservices, by definition, do not share a DB. If they do then you just have multiple processes in the same larger service.
Re:You Want Modules, Not Microservices by osigurdson on Tuesday January 03, 2023 @09:24AM (#34231660)
>> because they keep people honest around module boundaries

Imagine a world where every pip/nuget/cargo package was a k8s service called out-of-process and needed to be independently maintained. We would have potentially hundreds of these things running, independently secured via mTLS, observability and metrics for each, and all calls run out of process. This is the abysmally slow hellscape that some are naively advocating for without realizing it.

It is relatively obvious what should be a library (json, numpy, NLog, etc), and what should be a service (Postgres, Kafka, Redis, NATS, etc.) when dealing with 3rd party components. It is also obvious that team scaling is not determined by whether code exists in a library or service from this example since all 3rd party code is maintained by others.

However, once we are all in the same organization, we lose the ability to correctly make this determination. We create a service when a library would do in order to more strictly enforce ownership. I think an alternate solution to this problem is needed.

Re:You Want Modules, Not Microservices by closeparen on Tuesday January 03, 2023 @12:11PM (#34234290)
But of course team scaling is determined this way. Merely releasing a library version has zero business impact. To have impact, library teams must go around to every consumer team and beg them to accept a version bump. This is a) shitty work for which it is impossible to retain people, and b) intractable without an enormous labor force once the number of consumers is big enough.

Services can be continuously deployed by small owning teams.

Re:You Want Modules, Not Microservices by osigurdson on Tuesday January 03, 2023 @01:59PM (#34236192)
If library teams could force consumers of the library to upgrade the problem is seemingly solved.

Is this correct or are there other aspects that you are considering?

Re:You Want Modules, Not Microservices by zffr on Tuesday January 03, 2023 @09:30AM (#34231733)
Twitter seems to have adopted Microservices in 2014, and in 2013 they had ~200M MAU (presumably using a monolith architecture).

Even if Microservices are better for scale, most companies will never experience the level of scale of 2013 Twitter.

Are Microservices beneficial at much smaller levels of scale? Ex: 1M MAU

Re:You Want Modules, Not Microservices by AlchemistCamp on Tuesday January 03, 2023 @10:44AM (#34232878)
Github got absolutely enormous as a Rails monolith, plus some C extensions in a few hot paths.
Re:You Want Modules, Not Microservices by zffr on Tuesday January 03, 2023 @12:46PM (#34234905)
From what I can tell, Github transitioned over to micro-services ~2020 (https://www.infoq.com/presentations/github-rails-monolith-mi...). By this point it had already grew to a scale that very few companies will ever reach.

I'm not sure at what point the monolith codebase became absolutely enormous, but I would bet that GitHub grew to 1M active users with a monolith just fine.

Micro-services might be necessary for the companies like Github, Twitter, Google that grow to be huge, but monoliths seem to work just fine for the vast majority of other companies.

Re:You Want Modules, Not Microservices by codethief on Tuesday January 03, 2023 @04:06PM (#34238052)
> most companies will never experience the level of scale of 2013 Twitter

I fully agree with your argument. Then again, as mentioned elsewhere in this discussion, microservices are often not introduced to solve a scalability problem but an organizational one and there are many organizations that have more engineers than Twitter (had).

Personally, I still don't buy that argument because by solving one organizational problem one risks creating a different one, as this blog post[0] illustrates:

> […] Uber has grown to around 2,200 critical microservices

Unsurprisingly, that same post notes that

> […] in recent years people have begun to decry microservices for their tendency to greatly increase complexity, sometimes making even trivial features difficult to build. […] we experienced these tradeoffs first hand

I'm getting very strong Wingman/Galactus[1] vibes here.

[0]: https://web.archive.org/web/20221105153616/https://www.uber....

[1]: https://www.youtube.com/watch?v=y8OnoxKotPQ

Re:You Want Modules, Not Microservices by dalbasal on Tuesday January 03, 2023 @09:38AM (#34231847)
I'm glad you made this point.

This happens a lot. Organisational problems conflated for technical ones. Technical solutions to organisational politics. Etc. It's often easier to admit technical challenges than organisational ones. Also, different people get to declare technical and organisational challenges, and different people that get to design the solutions.

There's also a dynamic where concepts are created by the technical 1% doing vanguard or challenging tasks. The guys responsible for scaling youtube or whatnot. Their methods and ideas become famous and are then applied to less technically demanding tasks, then in less technical organisations entirely.

I think if we can be honest at the actual problem at hand, 80/20 fixes will emerge. IE, the "real" value is not the architecture per se, but the way it lets you divide the responsibilities in the organisation.

Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @10:00AM (#34232184)
Strong typed languages with support for binary modules are just as good keeping people honest.

Each team gets to distribute libraries over repos (COM, JAR, DLL, whatever), no way around that unless they feel like hacking binaries.

Re:You Want Modules, Not Microservices by barrkel on Tuesday January 03, 2023 @10:19AM (#34232442)
Services generally have a stateless request/response architecture, inherited from the success of HTTP, and contra the experiences of CORBA and COM, the latter being much better suited to Office Object Linking and Embedding and VB visual controls - local, assumed reliable, not across a network boundary.

Creating an object-oriented API for a shared library which encapsulates a module to the degree a service boundary would is not trivial and it's very rarely done, never mind done well. Most OO libraries expose an entire universe of objects and methods to support deep integration scenarios. Maintaining that richness of API over time in the face of many consumers is not easy, and it (versioning) is a dying art in the eternal present of online services. The 90s aren't coming back any time soon.

If you own a library which is used internally, and you add a feature which needs a lot more memory or compute, how do you communicate the need to increase resource allocation to the teams who use the library? How do you even ensure that they upgrade? How do you gather metrics on how your library is used in practice? How do you discover and collect metrics around failure modes at the module boundary level? How do you gather logs emitted by your library, in all the places it's used? What if you add dependencies on other services, which need configuring (network addresses, credentials, whatever) - do you offload the configuration effort on to each of the library users, who need to do it separately, and end up with configuration drift over time?

I don't think binary drops work well unless the logic they encapsulate is architecturally self-contained and predictable; no network access, no database access, no unexpected changes in CPU or memory requirements from version to version.

There's plenty of code like this, but it's not usually the level of module that we consider putting inside a service.

For example, an Excel spreadsheet parser might be a library. But the module which takes Excel files uploaded by the user and streams a subset of the contents into the database is probably better off as a service than a library, so that it can be isolated (security risks), can crash safely without taking everything down, can retry, can create nice logs about hard to parse files, can have resource metrics measured and growth estimated over time, and so on.

Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @10:32AM (#34232675)
So much for the theory, most services I see in the wild are stateful.

As for scalability, most orgs aren't Facebook nor Google scale, regardless of how much they want it to be true.

All of those issues can be tackled, when proper architecture design is done, instead of coding on the go and then will see attitude.

Re:You Want Modules, Not Microservices by dilyevsky on Tuesday January 03, 2023 @11:07AM (#34233233)
People keep regurgitating this “you aint going to be google” mantra but I worked there and in reality generic microservice stack is in a totally different league of complexity and sophistication of what google and co have. This argument is basically reductio ad absurdum
Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @11:32AM (#34233646)
We keep regurgitating this, because most microservices are the 2nd coming of big data that fits into a USB stick.
Re:You Want Modules, Not Microservices by ergo14 on Wednesday January 04, 2023 @06:51AM (#34244505)
So all your microservices implement sagas or other synchronisation patterns that ensure 100% data consistency?
Re:You Want Modules, Not Microservices by dilyevsky on Wednesday January 04, 2023 @05:28PM (#34252830)
If you distribute the state over ALL your services and need 100% data consistency you’re holding it wrong
Re:You Want Modules, Not Microservices by ergo14 on Friday January 13, 2023 @08:50AM (#34367625)
Ok, how big percentage of them implement data consistency in your company? :)
Re:You Want Modules, Not Microservices by int_19h on Thursday January 05, 2023 @05:33PM (#34267860)
The argument is simply the empirical observation that the vast majority of microservices deployments don't operate anywhere near the scale that actually requires microservices and is not going to operate at that scale in the foreseeable future. When scalability is the primary argument in favor of microservices, how is that absurd?
Re:You Want Modules, Not Microservices by KptMarchewa on Tuesday January 03, 2023 @10:34AM (#34232714)
And then each DLL creates its own thread pool... well, usually multiple.
Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @11:33AM (#34233675)
Which is irrelevant, as many microservices do the same inside of them, and the libraries that they consume.
Re:You Want Modules, Not Microservices by int_19h on Thursday January 05, 2023 @05:34PM (#34267876)
If it's .NET or Java, that's very unlikely.
Re:You Want Modules, Not Microservices by zbobet2012 on Tuesday January 03, 2023 @01:59PM (#34236200)
You'll need to support loading two versions of each DLL into memory and invoking both on some percentage of servers to be able to replicate a microservice though.

The important part of microservices isn't just API boundaries, it's lifecycle management. This CAN be done with a DLL or JAR, but it's MUCH harder today.

Re:You Want Modules, Not Microservices by pjmlp on Tuesday January 03, 2023 @02:07PM (#34236355)
Not at all.

Sure if one likes to make things harder than they are supposed to be, there are lots of paths down that road.

Re:You Want Modules, Not Microservices by JAlexoid on Wednesday January 04, 2023 @12:47PM (#34248842)
I don't know about you, but I could deploy multiple versions of my Java webapp to Apache Tomcat over 15 years ago... and gracefully sunset the old version.
Re:You Want Modules, Not Microservices by emodendroket on Tuesday January 03, 2023 @10:01AM (#34232191)
Working at a huge company I feel like every service owning its own data store (or at least only accessing/manipulating another’s through its API, not directly in the underlying store) is the only sensible way to do it, because you can never really envision what clients you will have ahead of time or what they will want to do, and that’s an easy recipe for headaches. But the smaller the company gets the further I’d go along the spectrum from full isolation to isolated services with shared stores to monolith.
Re:You Want Modules, Not Microservices by est on Tuesday January 03, 2023 @10:18AM (#34232423)
> usually actually solve for a human problem in scaling up an organization.

It's invented by a software outsourcing firm to milk billable hours from contracts.

Re:You Want Modules, Not Microservices by lightbendover on Tuesday January 03, 2023 @10:19AM (#34232449)
> A better rule is for one service to own writes for a table

This breaks down when the database is essentially a generic graph. The worst solution I've seen to this is to have another service responsible for generic write operations and any service that wants to write data goes through that service -- you're essentially re-introducing the problem you're purporting to solve at a new layer with an added hop and most likely high network usage. The best solution I've seen is to obviously have the monolith. The enterprise solution I've seen, while not good by any means but nearly essential for promoting team breakdown and ownership, is to just let disparate services write as they see fit, supported by abstraction libraries and SOPs to help reinforce care from engineers.

Re:You Want Modules, Not Microservices by KptMarchewa on Tuesday January 03, 2023 @10:32AM (#34232677)
Added network call is often better than disjointed view on database schema.
Re:You Want Modules, Not Microservices by lightbendover on Tuesday January 03, 2023 @09:43PM (#34241316)
That's a difficult claim to make without knowing the workload.
Re:You Want Modules, Not Microservices by philwelch on Tuesday January 03, 2023 @10:21AM (#34232472)
> I'm not so positive on every microservice maintaining its own copy of state, potentially with its own separate data store. I think that usually adds more ongoing complexity in synchronization than it saves by isolating schemas. A better rule is for one service to own writes for a table, and other services can only read that table, and maybe even then not all columns or all non-owned tables.

I’ll go one step further and say that you should treat your data stores as services in and of themselves, with their own well-considered interfaces, and perhaps something like PostgREST as an adapter to the frontend if you don’t really need sophisticated service layers. The read/write pattern you recommend is a great fit for this and can be scaled horizontally with read replicas.

Re:You Want Modules, Not Microservices by TimPC on Tuesday January 03, 2023 @10:31AM (#34232656)
Modules aren't an alternative to microservices in a reasonable way though. And for all modules solve the modularization problem at the code level, they don't really solve modularization at the service level. The main alternative to microservices is monoliths and for many applications I far prefer microservices to monoliths. I want modularization in how I scale my app, I don't want to spin up a whole bunch of servers that can serve almost any possible function in production. I'd prefer more delineated responsibilities. I don't think modularization solves this if after the modules you just throw all your modules in one big bucket and serve that up.
Re:You Want Modules, Not Microservices by ebiester on Tuesday January 03, 2023 @11:09AM (#34233266)
I think what is missing here is that it doesn't have to be an either-or at the organizational level.

If you have a particular piece of the system that needs to be scaled, you can take that module out when it becomes necessary. You can alter your system such that you deploy the entire codebase but certain APIs are routed to certain boxes, and you can use batch processing patterns with a set of code outside the codebase.

You can have an admin application and a user application, and both of them are monoliths. They may or may not communication using the database or events or APIs.

However, you don't make this on the single bounded context guideline.

Re:You Want Modules, Not Microservices by michaelsalim on Tuesday January 03, 2023 @11:52AM (#34233987)
That's exactly what the comment you're replying is saying though. You're talking about scalability which they say modules doesn't exactly solve.

And I do agree that most people need less of those than they think.

Re:You Want Modules, Not Microservices by esailija on Tuesday January 03, 2023 @12:25PM (#34234537)
Just because the monolith image contains all code doesnt mean each deployment needs to run all that code. Or even same version of the code. A deployment can run only a small portion of the code determined by deployment args. It can even run an older version than other deployments
Re:You Want Modules, Not Microservices by zbobet2012 on Tuesday January 03, 2023 @01:57PM (#34236158)
That's just a microservice enabled by configuration.
Re:You Want Modules, Not Microservices by MuffinFlavored on Tuesday January 03, 2023 @10:40AM (#34232817)
> But most people need it a lot less than they think. Normally the database is your bottleneck and if you keep your application server stateless, you can just run lots of them

At my last job, there were quite a few times where being able to scale some small "microservice instance" up from 2 -> 4 instances or 4 -> 8 or 8 -> 12 was a lot easier/quicker than investigating the actual issue. It'd stop production outages/hiccups. It was basically encouraged.

Not sure how that can be done with a "it's all modules in a giant monolith".

Re:You Want Modules, Not Microservices by jacobr1 on Tuesday January 03, 2023 @10:44AM (#34232874)
A few ways, the easiest being to scale up the whole monolith with more instance. Another way is run multiple "services" using the same codebase, so you have workload segmentation, either via synchronous network calls, or async worker systems.
Re:You Want Modules, Not Microservices by MuffinFlavored on Tuesday January 03, 2023 @10:52AM (#34233016)
devil's advocate:

> A few ways, the easiest being to scale up the whole monolith with more instance

as far as I know, there's no way to granularly scale up a monolith. if the monolith has 20 or 50 or 100 modules and you need 1 or 2 of them scaled, you have to scale up the entire thing which is huge, expensive, etc.

> Another way is run multiple "services" using the same codebase, so you have workload segmentation, either via synchronous network calls, or async worker systems.

this is interesting. a monolith with some form of IPC? why not do microservices at that point? that sounds like microservices-ish?

Re:You Want Modules, Not Microservices by jacobr1 on Tuesday January 03, 2023 @11:40AM (#34233788)
> you have to scale up the entire thing which is huge, expensive, etc.

Yes, yet people still do it that way. This is tradeoff against the costs of microservices. I'm not saying it is worth it, but yes, sometimes you can just inefficiently throw hardware resources at scaling problems.

> this is interesting. a monolith with some form of IPC? why not do microservices at that point? that sounds like microservices-ish?

Because you are incrementally changing an existing monolith, but still getting some of the benefits of scaling distinct workloads independently. If you do this right, it does lend it self to reworking the new "service" to be become its own microservice. Or you can just keep going with the shared codebase.

Re:You Want Modules, Not Microservices by MuffinFlavored on Tuesday January 03, 2023 @11:55AM (#34234043)
is this a common nomenclature/design? how does a monolith that makes IPC/RPC calls to submodules not basically microservices?
Re:You Want Modules, Not Microservices by __jem on Tuesday January 03, 2023 @12:04PM (#34234192)
yes, it's very common design. sometimes called a "distirbuted monolith." it's not microservices because the number of additional services is usually small, and the codebase is still tightly coupled to itself (even if well factored in terms of modules). i.e., everything is still tested together, and there's still a single monolithic build and deployment process, and no team can go off and decide to write a service in a different language.
Re:You Want Modules, Not Microservices by MuffinFlavored on Tuesday January 03, 2023 @12:13PM (#34234323)
so for example in the context of Java, you have one main App/main() entry, probably bounding to a port (let's say 80 serving HTTP requests) acting as a router

it brokerages them to subclasses/handlers for CRUD/RPC/plumbing to database/other services

then in a separate process App/main() you have a cron job or a queue of some sort

you bundle these together as a monolith into one main()?

Re:You Want Modules, Not Microservices by __jem on Tuesday January 03, 2023 @12:35PM (#34234728)
In the case of Java, imagine we have a big Maven project that has a bunch of different well factored modules that form the "libraries" of our application. At first, in our Maven project we also have a single module which is the deployable for "the monolith" -- it consumes all the other "lib" modules and gets packaged into a fat jar.

We deploy a few instances of the monolith fronted by a load balancer. There's not much scaling logic here -- when we see p75 request latency reach a certain threshold, we add another monolith instance.

A while later, we realize that the /foo route is getting a ton of spikey traffic, which makes it hard to scale. So, in the load balancer, we set up a new pool that just targets /foo, and in our Maven project we create a new module that will be the deployable for this pool. Now, /foo still requires most of our libs, so the jar we're bundling is still "the monolith" in essence, but maybe it doesn't require a few dependencies, and so is a little slimmer. We deploy that and everything is scaling great!

Then, we discover that in our main monolith, the background threads we were using to send emails are getting really clogged up, which is adversely effecting performance. We decide we want to move this work to an external persistent queue, like Kafka. Now, for our consumer, we create one more Maven module for a new jar. This time, we're lucky. Emails only need 2 of our libraries and so this is actually a pretty small deployable, but it's still being built from the same core set of libraries as the monolith.

Re:You Want Modules, Not Microservices by MuffinFlavored on Tuesday January 03, 2023 @12:58PM (#34235075)
so you end up with a monolith that might have a config flag or something to determine its purpose when it comes online, and then it can go down a few different code paths. pretty cool. is this something that is done on the fly and then later you don't let that code pattern stay alive (aka, is it not a smell/bandaid)?

my concern would be if you accidentally create bugs by basically creating new mini-monolith flavors as the modules were never expected (in the beginning of their creation) to run in a "partial" context

Re:You Want Modules, Not Microservices by sally_glance on Wednesday January 04, 2023 @05:21PM (#34252742)
I was part of a project that did exactly this - same monolithic code base with config flags that transformed it into web server, worker or scheduler. It allows scaling all parts separately, but I can confirm it's easy to introduce bugs if you're not careful. Since you're sharing the same DB, migrations also need to be backwards-compatible.

A cool side-effect is that you can usually run the whole thing in one app for development by just enabling all profiles - as opposed to some microservice architectures where you need dozens of containers and DBs for replicating inter-service bugs.

Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @07:26PM (#34240144)
>I'm not saying it is worth it, but yes, sometimes you can just inefficiently throw hardware resources at scaling problems

Microservice scaling is also an inefficient hardware scaling option.

Re:You Want Modules, Not Microservices by zeroonetwothree on Tuesday January 03, 2023 @11:48AM (#34233912)
The way it usually works, if 1 of your 100 modules needs to be scaled, it probably means the overall monolith only needs a small amount of extra resources, since that module is only using 1% of the total. So it's not like you need to double the instances of the whole thing.

The benefit though is you get a bit of 'free' scaling. Most of the modules don't even have to consider scaling at all, as long as they are growing ~average or slower. So this saves a lot of operational burden for many teams. Conversely with microservices every team has to consider scaling, no matter how simple their service is.

(If you do have 1 module out of 100 that takes up 40% of the resources, then it may be appropriate to split it up. Monolith doesn't literally mean "exactly one service", after all, just a small number of big ones.)

Re:You Want Modules, Not Microservices by MuffinFlavored on Tuesday January 03, 2023 @11:54AM (#34234027)
> The way it usually works, if 1 of your 100 modules needs to be scaled, it probably means the overall monolith only needs a small amount of extra resources, since that module is only using 1% of the total. So it's not like you need to double the instances of the whole thing.

I could be wrong but doesn't monolith usually refer to one really heavy app? As soon as you go from needing 1 instance to 2 (because 1 of the 100 inner "modules" needs to be scaled), I would guess most of the time there's a high expense (lots of memory) in duplicating the entire monolith? Unless you can scale threads or something instead of the entire process... Or if the entire process doesn't initiate 100 modules as soon as it is started (although I imagine it would in most cases)

Re:You Want Modules, Not Microservices by treis on Tuesday January 03, 2023 @12:24PM (#34234527)
You do lose some memory to holding unnecessary code and whatever data caching that a module does. But it's not generally very much and large data caching can be pushed to Redis. If you're not buying your servers by the rack or data center it's ultimately negligible compared to development cost.
Re:You Want Modules, Not Microservices by highspeedbus on Tuesday January 03, 2023 @02:44PM (#34236913)
>doesn't monolith usually refer to one really heavy app?

No. Backend Server clusters are around almost as long as the internet exists.

>I would guess most of the time there's a high expense (lots of memory) in duplicating the entire monolith?

That's right, but there's a gotcha. Everytime you split your monolith into parts, that doesn't mean that each part will consume 1/n of original monolith startup resource. There will be a floor of memory usage. Consider 1 monolith that eats up 1GB to startup vs 4 microservices that uses 512MB each. Right from start you doubled the wasted memory from 1GB to 2GB. That only gets worse the more services are created. Another problem is that microservice/cloud folks loves to create anemic machines. Usually setting up 512MB RAM and half a core cpu to a service that needs 380mb minimum :) Thats 75% overhead and 25% of working memory. It's bonkers.

Re:You Want Modules, Not Microservices by __jem on Tuesday January 03, 2023 @11:48AM (#34233917)
> as far as I know, there's no way to granularly scale up a monolith. if the monolith has 20 or 50 or 100 modules and you need 1 or 2 of them scaled, you have to scale up the entire thing which is huge, expensive, etc.

not necessarily. yes, you do pay for executable bloat and some memory overhead from loading code into memory, but the argument here is that you can still deploy a "Service B" from the same deployable that only services certain kinds of requests in order to scale parts of the application horizontally.

> this is interesting. a monolith with some form of IPC? why not do microservices at that point? that sounds like microservices-ish?

no, because again, you're still deploying the same single codebase, it's just the instance on the other end of the queue is configured just to consume and process messages.

Re:You Want Modules, Not Microservices by lifeisstillgood on Tuesday January 03, 2023 @10:49AM (#34232952)
I think it runs a bit deeper than that. Microservices are how the business views its self.

Look, once upon a time managers designed the system that workers implemented. The factory assembly line, or the policy manual.

But now the workers are CPUs and servers. The managers designing the system the workers follow are coders. I say coders are the new managers.

Now this leaves two problems. The first is that there are a lot of "managers" who are now doing the wrong job. (and explains perfectly why Steve Jobs gets involved in emails about hiring coders.) But that's a different post.

For me the second problem is microservices represent the atomic parts of a business. They should not be seen as a technical solution to anything, and because the first problem (managers arent managing workers anymore) there is no need to have the microservices built along Conways Law.

And so if you want to build a microservice it is not enough to consider the technical needs, it is not enough to automate what was there, you need to design an atomic building block of any / your company. They become the way you talk about the company, the way you think about the processes in a company.

An mostly the company becomes programmable. It is also highly likely the company becomes built mostly of interchangable parts.

Re:You Want Modules, Not Microservices by zbobet2012 on Tuesday January 03, 2023 @11:02AM (#34233153)
> there is no need to have the microservices built along Conways Law

This is a misunderstanding of Conway's Law. Your code _will_ reflect the structure of your organization. If you use microservices so will their architecture. If you use modules, so will the modules.

If you want a specific architecture, have your organization reflect the modules/microservices defined in that architecture.

Re:You Want Modules, Not Microservices by zeroonetwothree on Tuesday January 03, 2023 @11:41AM (#34233806)
Exactly. Conway's Law is descriptive not prescriptive!
Re:You Want Modules, Not Microservices by bradwood on Tuesday January 03, 2023 @02:17PM (#34236511)
Quite. And many people still seem to confuse this. The way to exploit Conway's law is not to do anything _technical_ but rather to do something _organisational_. The "Reverse Conway Manoeuvre" is the term, IIRC, for this. Rather than trying to "build something along the lines of Conway's law" (which doesn't really make sense) -- one should determine a desired architecture and then set up the _organisation_ and teams to mirror that.
Re:You Want Modules, Not Microservices by lifeisstillgood on Tuesday January 03, 2023 @11:55AM (#34234052)
But, I am trying to feel my way towards the idea that that was true when managers arranged systems for workers to follow, and then we came along to automate the current process. But if we have a system where the workers are the CPUs, then the people doing the managing are the coders.

The point ebing is that if workers are CPUs and coders are managers, then why worry about how the managers of the coders are arranged. Get rid of that management layer. Conway is not implying the financiers of the organisation affect the architecture.

This basically means that the microservices a company is built out of should more readily align to the realities of the business model. And instead of shuffling organisations around it would behove executives to look at the microservices.

One can more easily measure orders transferred, etc, if the boundaries are clearer.

Plus conway is just a ... neat idea, not a bound fate.

There is a caveat with the architecture reflecting the organisation of the software teams, but that usually follows the other to-be-automated structure as well.

Re:You Want Modules, Not Microservices by zbobet2012 on Tuesday January 03, 2023 @12:50PM (#34234977)
Managers arranging work is _not_ why Conway's law is true though. I think it behooves one to look at the actual text of the "law":

> Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.

It doesn't matter WHO defines or does the work (the coders themselves in a team or the manager). It matters how communication is arranged. And communication naturally aligns itself along organizational and team boundaries.

When a group/person/whatever writes an API they are MOSTLY writing a document for other human beings. That is an act of communication. If you meet with someone everyday in a stand-up you're likely to put a less structured API between yourselves than if you meet with someone once a month, or once a year. You're also going to create a finer grained subdivision of the API for them as you're likely working on closely related posts of the problem.

Organization creates communication, and communication creates architecture. Therefore organization creates architecture.

> Plus conway is just a ... neat idea, not a bound fate

It is in fact bound fate. Code is written to communicate with others.

People come together, they decide to solve a problem. They divide up that problem and create functions (an API), objects (an API), modules (an API), and services/microservices (an API). At each later they've written something that communicates with others. The structure of that code reflects the necessary communication to the other parties for their part of the problem. This the code is structured following the lines of communication in the organization.

Organization is how we structure communication (that's it's primary point) and thus organization = architecture + some wiggle room for communication paths defined outside that (say a SAFE feature team).

Re:You Want Modules, Not Microservices by marcosdumay on Tuesday January 03, 2023 @03:28PM (#34237514)
> It matters how communication is arranged.

Just to add it here, how evaluations and goals are set matter too. Those tend to be even more constrained by the formal organization than communication.

Re:You Want Modules, Not Microservices by 8note on Tuesday January 03, 2023 @01:22PM (#34235494)
The systems are not only organized on the programmers managers, but their managers too, all the way up the chain.
Re:You Want Modules, Not Microservices by rented_mule on Tuesday January 03, 2023 @03:05PM (#34237221)
Very good point. Tying that back into the Conway's law angle on all of this...

I've been a couple levels up the chain at times in my career. When I've seen technical decisions at this level done well is when those people realize that their organizational decisions are inevitably technical decisions because of Conway's law. When the impact of Conway's law is not explicitly considered, things will often look random at the IC level. Too often, organizational leaders don't realize they are dictating technical outcomes with decisions that appear to just be about reporting structure.

An example is when a major new product feature comes along that is big enough to need multiple teams to build/own it for the long term. Where are those teams placed in the organization? Conway's law helps us see that a huge part of the future architecture is being determined by answering that question. Placing those new teams in an existing org mainly responsible for UX will result in a very different architecture than putting the new teams in an org mainly responsible for monetization. Can the teams be split across those orgs? Well, can you envision a reasonable architecture with an enforced divide along those lines? Without recognition of Conway's law, that last question might not be considered and the decision to split or not will be based on other factors.

Unfortunately that requires multidisciplinary thinking (technical architecture, resource allocation, communication structure, people development, ...). Such broad thinking is not always easy. When leadership starts neglecting one or more of these disciplines, more and more of the people doing the work on affected teams start perceiving the decisions as arbitrary and counter productive. Organizational churn (e.g., teams repeatedly changing location within the org over the course of a year or two) is often leadership looking at a different subset of these dimensions over time, yielding different "correct" answers.

Re:You Want Modules, Not Microservices by lifeisstillgood on Tuesday January 03, 2023 @06:31PM (#34239678)
I think microservices turn this around - the idea is that if we ignore them as technical units and treat them as organisational units we can invert conway's law - it's much easier to change how microservices talk to each other than it is to chnage how people do.

But if you chnage the dataflow in a few microservices so that the accounts team no longer deals / works directly with the sales team you have chnaged the organisation.

plus it's way easier to monitor activity etc

Re:You Want Modules, Not Microservices by NicoJuicy on Tuesday January 03, 2023 @12:01PM (#34234146)
Re:You Want Modules, Not Microservices by eklitzke on Tuesday January 03, 2023 @12:39PM (#34234790)
I just want to point out that for the second problem (scalability of CPU/memory/io), microservices almost always make things worse. Making an RPC necessarily implies serialization and deserialization of data, and nearly always also means sending data over a socket. Plus the fact that most services have some constant overhead of the footprint to run the RPC code and other things (healthchecking, stats collection, etc.) that is typically bundled into each service. And even if the extra CPU/memory isn't a big deal for you, doing RPCs is going to add latency, and if you get too many microservices the latency numbers can start really adding up and be very difficult to fix later.

Running code in a single process is MUCH lower overhead because you don't need to transit a network layer and you're generally just passing pointers to data around rather than serializing/deserializing it.

There are definitely some cases where using microservices does make things more CPU/memory efficient, but it's much rarer than people think. An example where you'd actually get efficiency would be something like a geofence service (imagine Uber, Doordash, etc.) where the geofence definitions are probably large and have to be stored in memory. Depending on how often geofence queries happen, it might be more efficient to have a small number of geofence service instances with the geofence definitions loaded in memory rather than having this logic as a module that many workers need to have loaded. But again, cases like this are much less common than the cases where services just lead to massive bloat.

I was working at Uber when they started transitioning from monolith to microservices, and pretty much universally splitting logic into microservices required provisioning many more servers and were disastrous for end-to-end latency times.

Re:You Want Modules, Not Microservices by dahfizz on Tuesday January 03, 2023 @12:46PM (#34234904)
Microservices are less efficient, but are still more scalable.

Servers can only get so big. If your monolith needs more resources than a single server can provide, then you can chop it up into microservices and each microservice can get its own beefy server. Then you can put a load balancer in front of a microservice and run it on N beefy servers.

But this only matters at Facebook scale. I think most devs would be shocked at how much a single beefy server running efficient code can do.

Re:You Want Modules, Not Microservices by cogman10 on Tuesday January 03, 2023 @12:58PM (#34235087)
You know, I don't really think microservices are fundamentally more scalable. Rather, they expose scaling issues more readily.

When you have a giant monolith with the "load the world" endpoint, it can be tricky to pinpoint the the "load the world" endpoint (or, as is often the case, endpoint*s*) is what's causing issues. Instead, everyone just tends to think of it as "the x app having problems."

When you bust the monolith into the x/y/z, and x and z got the "load the world" endpoints, that starts the fires of "x is constantly killing things and it's only doing this one thing. How do we do that better?"

That allows you to better prioritize fixing those scaling problems.

Re:You Want Modules, Not Microservices by BeefySwain on Tuesday January 03, 2023 @01:38PM (#34235806)
This is a great example of the kinds of organizational problems that microservices solve, as noted by the first section of the first comment in this thread.
Re:You Want Modules, Not Microservices by jacobsimon on Tuesday January 03, 2023 @01:47PM (#34235959)
That’s a really interesting point - something that could probably be addressed by module-level logging and metrics. That said, even as a pro-monolith advocate, I can see why it’s preferable to not allow any one module/service to consume all the resources for your service in the first place. The service boundaries in microservice architectures can help enforce resource limits that otherwise go unchecked in a larger application.
Re:You Want Modules, Not Microservices by cogman10 on Tuesday January 03, 2023 @01:54PM (#34236073)
It's one I've ran into a few times in my company (which has a large number of these types of endpoints).

The silly thing is that something like the JVM (which we use) really wants to host monoliths. It's really the most efficient way to use resources if you can swing it. The problem is when you give the JVM 512GB of ram, it hides the fact that you have a module needlessly loading up 64gb of ram for a few seconds. Something that only comes to a head when that module is ran concurrently.

Re:You Want Modules, Not Microservices by zbobet2012 on Tuesday January 03, 2023 @01:54PM (#34236075)
Microservices enable independent scale _domains_. This means they can be more scaleable and dense, but it's not necessarily true.
Re:You Want Modules, Not Microservices by jayd16 on Tuesday January 03, 2023 @02:06PM (#34236336)
Another way to look at this is microservices reduce the blast radius of problems.
Re:You Want Modules, Not Microservices by gadflyinyoureye on Tuesday January 03, 2023 @05:48PM (#34239265)
Sometimes. If the services are all interrelated, you’re as dead on the water with Microservices was you would be in a monolith.
Re:You Want Modules, Not Microservices by threeseed on Tuesday January 03, 2023 @06:35PM (#34239713)
You design your microservices so that they gracefully degrade.

So if a database service is not available you simply return stale, cached data until the service is back up.

Re:You Want Modules, Not Microservices by mixermachine on Tuesday January 03, 2023 @06:13PM (#34239510)
Sure depends on the architecture. When the auth service is down, everything else should be down. But when the "optional feature" service is down, a core component should be unaffected by that.

Split up services where it makes sense and don't over do it. That's how I design my projects.

Re:You Want Modules, Not Microservices by varsketiz on Tuesday January 03, 2023 @07:04PM (#34239953)
For many websites, there is considerable amount of content that should be available if auth is down. Think eshops, news portals, etc.
Re:You Want Modules, Not Microservices by vinay_ys on Wednesday January 04, 2023 @08:42AM (#34245396)
When the auth service is down, only new authentications should fail. Existing auth sessions should continue to function just fine. This exact failure mode occured at Google in early 2021 which caused a fairly big outage but not as big as it could have been because of this design choice.
Re:You Want Modules, Not Microservices by noogle on Tuesday January 03, 2023 @07:35PM (#34240223)
How so? If functionality A is critical to functionality B, how will wrapping it in an HTTP call (microservices) reduce the damage from breaking functionality A?

I can see an advantage regarding resource hogging, but the flip side is the extra point of failure of network calls in microservices.

Not saying which is better, but deployment is orthogonal to logical dependence and correctness.

Re:You Want Modules, Not Microservices by danielheath on Tuesday January 03, 2023 @09:11PM (#34241063)
Most features in a modern app are not critical functionality, though.

For instance, in a shopping site, why should a crash in the recommendations engine result in a non-functional webpage (rather than a working purchase page with no recommendations)?

Personally I think microservices start to make sense when you have several hundred developers (an environment I'm currently keen to never enter again - $work has 5 devs and might one day have 6).

Re:You Want Modules, Not Microservices by noogle on Tuesday January 03, 2023 @11:42PM (#34242108)
That makes sense. I am still trying to understand why does it differ between a monolith and microservices. The app in the monolith can make the call to non-critical functionalities time-limited and fault-tolerant, just like a network call has a time-out and can return nothing (in a simplified manner, it can wrap that call with a timer and an exception handler).

I agree that microservices are suitable for large organization, where the organization practically has multiple products (which could be purchased from a vendor or sold to another company).

Re:You Want Modules, Not Microservices by Karrot_Kream on Wednesday January 04, 2023 @02:54AM (#34243180)
If your monolithic service OOMs, hits a large GC pause causing dependent requests to time out, locks a shared file descriptor, or a bunch of other things then the monolithic service as a whole can hit a fault or stall even if other threads/tasks are still executing. While classes of errors like OOMs go away when multiple processes are executing.
Re:You Want Modules, Not Microservices by TickleSteve on Wednesday January 04, 2023 @07:24AM (#34244731)
"Classes of errors such as OOMs go away when multiple processes are executing"

You're going to have to explain what you mean by that a bit more... You surely cant mean it as it is written.

Re:You Want Modules, Not Microservices by danielheath on Wednesday January 04, 2023 @07:41AM (#34244839)
I don't think it was well expressed, but to reuse my last example: OOM-killer ending the recommendations process mid-request is less of a big deal if the main store server can keep running and serving traffic.

If the recommendations team write code that causes the OOM-killer to end their process, making them run it on separate infrastructure insulates your "main store team" from the bugs they write.

Re:You Want Modules, Not Microservices by Karrot_Kream on Wednesday January 04, 2023 @11:32PM (#34255990)
It was about the OOM killer as the sibling comment says, yeah.
Re:You Want Modules, Not Microservices by oblio on Thursday January 05, 2023 @07:14AM (#34258675)
His point was that the comment was unclear if you'd also read it hastily :-)

I imagine his logic was something like: "How can OOMs happen less often if you run more processes (possibly on the same machine)?", while your comment actually wants to say: "if a specific service is affected by an OOM, with microservices only that specific microservice goes down, since it's probably running on its own hardware".

Re:You Want Modules, Not Microservices by thrwawai39f3 on Wednesday January 04, 2023 @11:26AM (#34247592)
A monolith can also scale vertically with mechanisms to redeploy on fatal errors. If all starts failing, you may have a problem. But you can get the same problems with a microservices that is in the critical path

Networks could have unexpected delays, routing errors and other glitches. At least with a monolith you can often find a stacktrace for debugging. I have seen startups that have limited traceability and logging when using micro services.

When a small startup has to manage "scalable" K8s infrastructure in the cloud, distributed tracing and monitoring is often not prioritized when you are a team of 5 developers trying to find a product market fit.

I am not against microservices (I work with them daily) but you just trade one type of stability problem with another

Re:You Want Modules, Not Microservices by Karrot_Kream on Wednesday January 04, 2023 @11:59PM (#34256170)
Right I'm not advocating for one over the other, I was just explaining issues solved by microservices. Now instead of the OOM Killer taking your service down, you have a flaky NIC on another microservice box and now you need to figure out how to gracefully degrade.

I love working with microservices at the scale of $WORK, but we're Big Tech. I can't imagine why a 5 person startup would want k8s and microservices. You don't need that scale until you have more than 2 teams, and you're pushing at the very least 15 engineers at that point and usually the sales and marketing staff to make that investment worth it.

Re:You Want Modules, Not Microservices by jayd16 on Wednesday January 04, 2023 @03:57AM (#34243495)
Resource hogging is a huge class of errors, though. Everything from a bad client update DDoSing a feature, file handles, memory leaks, log storage (a little outdated now perhaps), and so many more...
Re:You Want Modules, Not Microservices by mirekrusin on Tuesday January 03, 2023 @02:44PM (#34236899)
It sounds like creating problem, then spending time=money on fixing it and calling it a win?

There is a point when it all starts to make sense. But that point is when you go into billions worth business, hundreds of devs etc. And going there has large cost, especially for small/medium systems. And that cost is not one off - it's a day-to-day cost of introducing changes. It's orders of magnitude chaper and faster (head cound wise) to do changes in ie. single versioned monorepo where everything is deployed at once, as single working, tested, migrated version than doing progressive releases for each piece keeping it all backward compatible at micro level. Again - it does make sense at scale (hundreds of devs kind of scale), but saying your 5 devs team moves faster because they can work on 120 micoservices independently is complete nonsense.

In other words micoservices make sense when you don't really have other options, you have to do it, it's not good start-with default at all; and frankly Sam Newman says it in "Building Microservices" and so do people who know what they're talking about. For some reason juniors want to start there and look at anything non-microservice as legacy.

Re:You Want Modules, Not Microservices by cogman10 on Tuesday January 03, 2023 @04:05PM (#34238046)
> It sounds like creating problem, then spending time=money on fixing it and calling it a win?

It sort of is.

It's not a perfect world. One issue with monoliths is that, organizations like to take a "if it ain't broke, don't fix it" attitude towards things. Unfortunately, that leads to spotty service and sometimes expensive deployments. Those aren't always seen as being "broken" but just temporary problems that if you pull enough all nighters you can get through regularly.

It takes a skilled dev to be able to really sell a business on improving monoliths with rework/rewrites of old apis. Even if it saves money, time, all nighters. It's simply hard for a manager to see those improvements as being worth it over the status quo. Especially if the fact of running the monolith on big iron masks the resource usage/outages caused by those APIs.

Re:You Want Modules, Not Microservices by hutzlibu on Wednesday January 04, 2023 @09:18AM (#34245725)
"It's simply hard for a manager to see those improvements as being worth it over the status quo"

That often is, because new solitions tend to come with their own problems.

Re:You Want Modules, Not Microservices by thayne on Tuesday January 03, 2023 @03:09PM (#34237287)
> I don't really think microservices are fundamentally more scalable

It depends on what you are scaling. I think microservices are fundamentally more scalable for deployment, since changes can be rolled out only to the services that changed, rather than everywhere. Unless your language and runtime support hot-loading individual modules at runtime.

Re:You Want Modules, Not Microservices by nthj on Tuesday January 03, 2023 @05:43PM (#34239209)
Git and/or feature flags exist for this reason. Adding a network layer isn't the fundamental insight here, but it can cause additional consequences.
Re:You Want Modules, Not Microservices by thayne on Tuesday January 03, 2023 @07:00PM (#34239920)
I'm talking about the scalability of actually delivering new code to servers (or "serverless" runtimes). Feature flags don't help with that.

Admittedly, it isn't a scalability problem you will run into right away.

But when you need to roll out an emergency fix, there is a big difference between deploying to thousands of servers that all have everything, and ten servers running a single service.

Re:You Want Modules, Not Microservices by kubota on Tuesday January 03, 2023 @05:43PM (#34239214)
I disagree, in my opinion micro-services hinder scalability of deployment, and development - at least the way I see most businesses use them. Typically they break out their code into disparate repositories, so now instead of one deployment you have to run 70 different ci/cds pipelines to get 70 microservices deployed, and repo A has no idea that repo B made breaking changes to their API. Or lib B pulled in lib D that now pollutes the class-path of lib A, who has a dependency on lib B. Often you need to mass deploy all of your microservices to resolve a critical vulnerability (think log4shell)

The solution to this is to use the right tool, a build system that supports monorepos like Bazel. Bazel solves this problem wonderfully. It only builds / tests / containerizes / deploys (rules_k8s, rules_docker) what needs to be rebuilt, retested, recontainerized, and redeployed. Builds are much faster, developers have God like visibility to all of an organizations' code, and can easily grep the entire code base and be assured their changes do not break other modules if Bazel test //... passes. It is language agnostic so you can implement your services in whatever language best suits it. It allows you to more easily manage transitive dependencies, manage versions globally across your org's codebase.

Of course Bazel has a steep learning curve so it will be years before it is adopted as widely as Maven, Gradle etc. But in the banks I've worked at it would've saved them tens of millions of dollars.

Also git would need to catch up to large codebases. I think Meta released a new source control tool recently that is similar to git but could handle large monorepos.

Re:You Want Modules, Not Microservices by mixermachine on Tuesday January 03, 2023 @06:28PM (#34239648)
Breaking APIs do not happen often at least in my projects. We mostly add new Endpoints for new features (non breaking change).

We keep object definitions in a separate repo to not duplicate them and generate a maven dependence from that. Pretty simple actually. We mainly run on Java thought. Would be more complicated when there are multiple languages.

Protobuf or Json schema could come to the rescue if needed.

Re:You Want Modules, Not Microservices by codethief on Tuesday January 03, 2023 @08:00PM (#34240449)
Man, I wish my colleagues would read your comment (and at least question their believes for one brief moment)…

> I disagree, in my opinion micro-services hinder scalability of deployment

…and of anything related to testing:

- Want to fire up the application in your pipeline to run E2E tests? Congratulations, you must now spin up the entire landscape of microservices in k8s. First, however, you need to figure out which versions of all those microservices you want to test against in the first place, since every service is living in a separate repository and thus getting versioned separately.

- Want to provide test data to your application before running your tests? Well, you're looking at 100 stateful services – good luck with getting the state right everywhere.

Re:You Want Modules, Not Microservices by lowbloodsugar on Tuesday January 03, 2023 @10:35PM (#34241705)
> and repo A has no idea that repo B made breaking changes to their API

I mean, I guess if your problem is "I need to write software using fucking idiots instead of professional engineers" ? But then the damage these fucking idiots could do in a monolith is far far worse.

"You" don't have to run 70 services. That'd be 35 to 70 teams.

What I'm taking from your writing is that you have an issue with control. When you think about an organization running 70 services, you talk about "You have to run", like you want to be in control of it all. You talk about "God like visibility". You talk about "visibility into all of an organizations code". Why do you need that visibility?

It sounds like you are a control freak who operates in dysfunctional organizations. It could be that you've developed a control-freak mentality because you are in dysfunctional organizations and can only rely on yourself. Consider moving. Or it could be that you are in a dysfunctional organization because you are a control freak. Consider therapy.

Re:You Want Modules, Not Microservices by jbergens on Wednesday January 04, 2023 @07:30AM (#34244775)
If you have many app servers and they all run copies of the same app you can roll out new versions to a few servers at a time. You just have to handle the db update first but you need to do that with microservices anyway (they might use smaller databases and therefore making it somewhat easier).
Re:You Want Modules, Not Microservices by locutous on Tuesday January 03, 2023 @01:30PM (#34235624)
> Servers can only get so big. If your monolith needs more resources than a single server can provide, then you can chop it up into microservices

200 threads, 12TB of RAM, with a pipe upwards of 200GB/s. This isn't even as big as you can go, this is a reasonable off the shelf item. If your service doesn't need more than this, maybe don't break it up. :)

I believe that this level of service can no longer accurately be described as "micro".

Re:You Want Modules, Not Microservices by Xeoncross on Tuesday January 03, 2023 @01:41PM (#34235854)
Helps to have a language that natively uses more CPU cores and/or training for the devs.

Ruby, Python, PHP and Node.js startups have to figure out how to use the cores while C++, Rust, Erlang and Go have no issues running a single process that maxes out all 64 CPU cores.

Re:You Want Modules, Not Microservices by grogenaut on Tuesday January 03, 2023 @02:11PM (#34236427)
we have all sorts of problems maxing out all the cores on a c6.24xl if youre memory or network conatrained. Even if CPU constrained it can be hard.
Re:You Want Modules, Not Microservices by NorwegianDude on Tuesday January 03, 2023 @02:41PM (#34236870)
Doesn't really matter that much if a language is using all cores from one process or if there is multiple processes.
Re:You Want Modules, Not Microservices by FpUser on Tuesday January 03, 2023 @04:31PM (#34238370)
This is exactly what I do. When it comes to your regular backend business server I write stateful multithreaded monolith in C++ sitting on the same computer as the database hosted on some multicore server with gobbles of RAM (those are cheap now). Performance is insane and is enough to serve any normal business for years or decades to come.

So it does not work for FAANG companies but what do I care. I have the rest of the world to play with ;)

Re:You Want Modules, Not Microservices by noobermin on Tuesday January 03, 2023 @07:12PM (#34240012)
>So it does not work for FAANG companies but what do I care. I have the rest of the world to play with ;)

As long as hype chasers in middle management don't get in the way after convincing themselves they too must be like FAANG with a few orders of magnitude less of a consumer base.

Re:You Want Modules, Not Microservices by FpUser on Tuesday January 03, 2023 @10:58PM (#34241839)
When I do work for my clients I usually bypass that level.
Re:You Want Modules, Not Microservices by miscaccount on Wednesday January 04, 2023 @12:26AM (#34242346)
the middle management especially half cooked engineers who drank the cool aid and became managers are hard to reason with.

They want to be both the architect and the manager and anything you say would be over ruled and since they are the boss its hard to ignore them.

This service is a monolith because it has 10K code and it needs to be broken up.The product is at MVP and its rock solid on Java Spring and it hardly crashes. We are never going to lose data based on the design choices we made. None of that matters.

We need zero down time upgrade, when we had zero customers.

Re:You Want Modules, Not Microservices by vinay_ys on Wednesday January 04, 2023 @08:51AM (#34245475)
Even for non-FAANG, less-than-a-million-user business applications, there are two problems: 1. Your feature/function scope is not all fully defined at the start and is not static till the end of life. Software has to evolve with business. In this case, it is easier to build a loosely coupled shared nothing architecture that can scale easily than to build a shared-everything-all-in-one-binary monolith architecture. 2. Your customer base isn't one size fits all. You usually different growing businesses that need solution at different scale points but still with very high unit economics. This means you need a incremental scaling solution – this is where old-school big-chassis systems build blade scalable server architectures. But because of custom/proprietary backplane design they become unmanageably complex and buggy.

Instead, if you build an architecture that can scale the number of corporate users by adding cheap $2k pizza box 1u servers as the company grows, that's much more attractive. Also, you can keep your systems design flexible enough to recompile and take advantage of advancements in hardware tech every 18 months – this gives you better operating margins as your own business starts to grow.

Re:You Want Modules, Not Microservices by FpUser on Wednesday January 04, 2023 @01:37PM (#34249547)
Sorry but sounds like your typical FUD with absolutely no no basis. Almost like it was written by bullshit generator or bot.
Re:You Want Modules, Not Microservices by 10000truths on Tuesday January 03, 2023 @02:22PM (#34236609)
This cannot be emphasized enough. The top of the line configuration you can get today is a dual EPYC 9654. That nets you 384 logical cores, up to 12 TB of RAM, and enough PCIe lanes to install ~40 NVMe drives, which yields 320 TB of storage if we assume 8 TB per drive. All for a price that is comparable to a FAANG engineer's salary.
Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @06:36PM (#34239728)
And you're missing one little thing - if you get all of your processing on two of those, you save way more than 4 engineers salaries in development/maintenance costs.

Let alone - AWS Lets you get that machine for less than a junior engineer salary ($7.5 per hour, roughly equivalent to $32 of hourly wage = $67k)

Re:You Want Modules, Not Microservices by Existenceblinks on Tuesday January 03, 2023 @04:05PM (#34238037)
How about 2 erlang OTP nodes (homogenous)? I don't have a real world use case of that load but I often imagine I would have 1:2 RAM ratio to be able to vertical scale each time. For example, start with 1TB(A):2TB(B), if that's not enough, scale A to 4TB. When load climbs start to exceeds, scale B to 8TB .. so on alternately.
Re:You Want Modules, Not Microservices by spion on Tuesday January 03, 2023 @12:53PM (#34235012)
You can run multiple instances of most stateless monoliths
Re:You Want Modules, Not Microservices by bcrosby95 on Tuesday January 03, 2023 @12:56PM (#34235059)
It's also way easier to design for. The web is an embarrassingly parallel problem once you remove the state. That's a big reason why you offload state to databases - they've done the hardest bits for you.
Re:You Want Modules, Not Microservices by catlifeonmars on Tuesday January 03, 2023 @12:55PM (#34235042)
Running a single server often can’t meet availability expectations that users have. This is orthogonal to scalability. You almost always need multiple copies.
Re:You Want Modules, Not Microservices by ElectricalUnion on Tuesday January 03, 2023 @02:00PM (#34236210)
You can run most applications on a single server - IBM S/390 big iron has very high reliability, redundancy and I/O bandwidth.
Re:You Want Modules, Not Microservices by catlifeonmars on Tuesday January 03, 2023 @02:56PM (#34237081)
Yes but it’s literally a single point of failure. You probably want at least two servers in separate physical locations. Also how do you do deployments without interruption of service on a single server?
Re:You Want Modules, Not Microservices by SgtBastard on Tuesday January 03, 2023 @05:59PM (#34239361)
Blue/green deployments and request draining like with any other deployment topology.
Re:You Want Modules, Not Microservices by ElectricalUnion on Thursday January 05, 2023 @06:58PM (#34268851)
> it’s literally a single point of failure.

Those machines are made very redundant.

All components in a Parallel Sysplex configuration can operate in redundant mode.

Redundant power. Redundant central processor complex. Redundant multichip module (what would be a chipset on microcomputer platforms). Redundant RAM Memory. Redundant Storage. Redundant internal interconnects. Redundant network adapters.

That's why corporations that require high availability to not get sued for millions/billions use them.

Re:You Want Modules, Not Microservices by catlifeonmars on Thursday January 05, 2023 @10:28PM (#34270599)
Redundant physical location. That means different power dependencies and different cities.
Re:You Want Modules, Not Microservices by ElectricalUnion on Thursday January 12, 2023 @08:58AM (#34353515)
> Redundant physical location. That means different power dependencies and different cities.

Geographically Dispersed Parallel Sysplex.

Re:You Want Modules, Not Microservices by vbezhenar on Tuesday January 03, 2023 @04:26PM (#34238299)
What if I have $500/month to spend and still need high reliability and redundancy?
Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @06:39PM (#34239753)
That's a budget for a local crafts store website hosting, not "high availability" system
Re:You Want Modules, Not Microservices by KronisLV on Wednesday January 04, 2023 @02:44AM (#34243124)
> That's a budget for a local crafts store website hosting, not "high availability" system

I'm not sure about that: you could still put something together within that budget, say, a few different VPSes across Hetzner and Contabo (or different regions within the same provider's offerings), with some circuit breaking and load balancing between those. Probably either a managed database offering, or a cluster of DBs running on similar VPSes.

Of course, this might mean that you have 1-3 instances of a service instead of 10-30, but as long as availability is the goal and not necessarily throughput, that can go pretty far.

Re:You Want Modules, Not Microservices by JAlexoid on Wednesday January 04, 2023 @12:39PM (#34248741)
If you're a amateur something, that just does it for fun - sure

Otherwise what you have is a budget that is lower than the possible implications of temporary downtime. That doesn't make sense in the real world.

Re:You Want Modules, Not Microservices by KronisLV on Wednesday January 04, 2023 @02:58PM (#34250557)
> If you're a amateur something, that just does it for fun - sure

  sed "s/amateur/comparatively poor, from a third world country, without VC money, or have cheap labor/g"
Not everyone can afford advanced tools or platforms, or even using something like AWS/Azure/GCP. Some of those can indeed be amateur use cases (e.g. side project or bootstrapped SaaS), others simply stretching your money for any number of considerations (e.g. non profit, limited budget etc.), but it's definitely possible. In some countries it probably makes more sense to just build your own solution, as long as you're not doing anything too advanced.

500 USD a month would get you approximately the following resources (taxes vary) on the aforementioned platforms:

  Contabo
  Nodes: 15 to 83 (depending on configuration)
  CPU: 150 to 332 cores
  RAM: 664 to 900 GB
  SSD: 4150 to 6000 GB
  
  Hetzner
  Nodes: 7 to 110 (depending on configuration)
  CPU: 86 to 192 cores
  RAM: 192 to 384 GB
  SSD: 2200 to 4800 GB
  
  (this includes regular VPS packages, not storage optimized ones, or dedicated hosting etc.)
I'm not sure about you, but in my experience that could be enough for some pretty decent systems, albeit some storage heavy workloads would need the storage packages instead of the regular VPS ones. It's mostly a matter of picking a suitable topology and working towards your goals.

> Otherwise what you have is a budget that is lower than the possible implications of temporary downtime. That doesn't make sense in the real world.

This (depending on the circumstances) does sound like a good point! Maybe "the real world" isn't the best wording, though, and choosing "enterprise settings" or anything along those lines would be more suitable.

Re:You Want Modules, Not Microservices by ElectricalUnion on Thursday January 05, 2023 @10:47AM (#34261363)
>> Otherwise what you have is a budget that is lower than the possible implications of temporary downtime. That doesn't make sense in the real world.

> Maybe "the real world" isn't the best wording, though, and choosing "enterprise settings" or anything along those lines would be more suitable.

This is the point - for-profit corporations, by definition, don't want to waste money, and if "high reliability" isn't required (or they don't know about it), they don't waste money. Most of the time, they don't waste the money.

However, if "being cheap" would means billions in lost income (and they know about it), they really want to have reliable, redundant infrastructure and systems around.

Re:You Want Modules, Not Microservices by JAlexoid on Thursday January 05, 2023 @03:48PM (#34266325)
I could probably design and deploy an HA system for way less. Maybe less than $200/month. It wouldn't be the most performant, but would be HA in three regions.

But it leads me back to my original statement - extreme requirements for uptime don't come out of nothing.

If you're in a location where IT related labor is extremely cheap - you're just going to have people keep one server up.

I know I used to do exactly that, because the server was more than my annual income. But that didn't last long. After the first 20 minute downtime, the budget for HA solution was allocated. But before a certain point downtime wasn't expensive.

Non-profits would probably be the only reasonable exception, where HA and low budgets could coincide. Otherwise - nah...

Re:You Want Modules, Not Microservices by KronisLV on Thursday January 05, 2023 @05:01PM (#34267458)
Those are all fair points, perhaps even more so given the trend of compute and other resources generally becoming more cheap with time (things like Wirth's law and limited IPv6 support aside), thanks for expanding on your arguments!
Re:You Want Modules, Not Microservices by catlifeonmars on Thursday January 05, 2023 @10:32PM (#34270626)
* * *
Re:You Want Modules, Not Microservices by unity1001 on Tuesday January 03, 2023 @06:47PM (#34239819)
Go to Digitalocean or a similar provider. Launch a managed HA db. (starts at ~$120/month). Launch an autoscaling HA K8 cluster (starts from ~$80) , deploy 1-2 stateless pods. There you go.
Re:You Want Modules, Not Microservices by vbezhenar on Wednesday January 04, 2023 @09:47AM (#34246076)
That's what I do. But it's not IBM.
Re:You Want Modules, Not Microservices by goodpoint on Tuesday January 03, 2023 @01:22PM (#34235493)
> Microservices are less efficient, but are still more scalable.

Not at all. You can run your monolith on multiple nodes just as you can do with microservices. If anything, it scales much better as you reduce network interactions.

Re:You Want Modules, Not Microservices by throwaway894345 on Tuesday January 03, 2023 @02:06PM (#34236339)
Yeah, it's bin packing, not straight efficiency. Also, people seem to exaggerate latency for RPC calls. I often get the feeling that people who make these latency criticisms have been burned by some nominal "microservices" architecture in which an API call is made in a hot loop or something.

Network latency is real, and some systems really do run on a tight latency budget, but most sane architectures will just do a couple of calls to a database (same performance as monolith) and maybe a transitive service call or something.

Re:You Want Modules, Not Microservices by funnymony on Wednesday January 04, 2023 @08:13AM (#34245126)
Couple of calls is normal. But if you make everything a microservice. And there are dependencies between them, then by design its destined that some hotter loop eventually will contain rpc.
Re:You Want Modules, Not Microservices by Sparkyte on Tuesday January 03, 2023 @03:01PM (#34237163)
It is about striking a balance.

Little big concept or mono-micro people like the call it is where it is at. Spending too much time making a complex environment benefits noone. Spending too much time making a complex application benefits noone.

Breaking down monoliths into purposed tasks and then creating pod groups small containers is where it is at. Managing a fleet on kubernetes is easier than managing one in some configuration management stack. Be it puppet or salt. You have too many dependencies. Only your core infrastructure kubernetes should be a product of the configuration management.

Re:You Want Modules, Not Microservices by greenhatman on Tuesday January 03, 2023 @04:25PM (#34238290)
You can have more than one server per monolith.

I don't think you actually understand what microservices are. You don't put a load balancer to load balance between different services. A load balancer balances trafic between servers of the same service or monolith.

Microservices mean the servers of different services run different code. A load balancer only works together with servers running the same code.

Re:You Want Modules, Not Microservices by SgtBastard on Tuesday January 03, 2023 @05:54PM (#34239317)
>A load balancer only works together with servers running the same code.

Uh - what?

>A load balancer balances traffic between servers

Correct.

> of the same service or mononlith

Incorrect.

Load balancers used to work solely at Layer 4, in which case you’d be correct that any 80/443 traffic would be farmed across servers that would necessarily need to run the same code base.

But modern load balancers (NGINX et al) especially in a service mesh / Kubernetes context, balance load at endpoint level. A high traffic endpoint might have dozens of pods running on dozens of K8s hosts having traffic routes to them by their ingress controller. A low traffic endpoint’s pod might only be running on few or one (potentially different) hosts.

The load balancer internally makes these decisions.

I hope this clears up your misunderstanding.

Re:You Want Modules, Not Microservices by closeparen on Tuesday January 03, 2023 @11:42PM (#34242106)
Each set of upstream hosts in nginx is a single instance of load balancing. You aren't load balancing across services, you're splitting traffic by service and then load balancing across instances of that service.

The split is inessential. You can just as easily have homogeneous backends & one big load balancing pool. Instances within that pool can even have affinity for or ownership of particular records! The ability to load balance across nodes is not, as you claimed, a particular advantage of microservices.

Re:You Want Modules, Not Microservices by SgtBastard on Thursday January 05, 2023 @04:03PM (#34266531)
> The ability to load balance across nodes is not, as you claimed, a particular advantage of microservices.

Are you replying to the right comment? I made no such claim.

Re:You Want Modules, Not Microservices by greenhatman on Thursday January 05, 2023 @12:58PM (#34263744)
I don't really think of route based "load balancing" as load balancing. That's routing, or a reverse proxy. Not load balancing. Load balancing is a very specific type of reverse proxy.

The point is, if a client makes a request to a server, the response should always be the same, no matter where the load balancer sends the request to. Which means it should run the same code.

Nginx doesn't even mention route based or endpoint based load balancing in their docs. Maybe they don't consider it load balancing either.

https://www.nginx.com/resources/glossary/load-balancing/

Re:You Want Modules, Not Microservices by SgtBastard on Thursday January 05, 2023 @04:02PM (#34266521)
https://www.nginx.com/blog/nginx-plus-ingress-controller-kub...

Describes exactly what I’m talking about.

Re:You Want Modules, Not Microservices by greenhatman on Friday January 06, 2023 @06:44AM (#34273671)
That is still routing. Not load balancing. The load balancing is only between pods of the same service.

Just because Nginx is doing it, doesn't mean it's load balancing. It's an extra function tacked onto a load balancer.

Re:You Want Modules, Not Microservices by SgtBastard on Saturday January 07, 2023 @04:59PM (#34293350)
Friend, you don’t know what you’re talking about and if linking NGINX documentation literally describing load balancing algorithms applied across Kubernetes pods hosting endpoints doesn’t clear things up for you, I don’t think anything will.
Re:You Want Modules, Not Microservices by KronisLV on Wednesday January 04, 2023 @02:36AM (#34243084)
> Servers can only get so big. If your monolith needs more resources than a single server can provide, then you can chop it up into microservices and each microservice can get its own beefy server. Then you can put a load balancer in front of a microservice and run it on N beefy servers.

I've almost never seen situations where a single request would need more resources available, than the entire server has (outside of large GPT models for text, though maybe that's because I couldn't afford beefy machines for that myself).

Instead, if your monolith needs X resources to run (overhead) and Y resources to serve your current load, then in case of increased load you can just setup another instance of your monolith in parallel with another set of X + Y resources (same configuration) and it will generally almost double your capacity.

Now, there can be some issues with this, such as needing to ensure either stateless APIs or sticky sessions, but both are generally regarded as solved problems (with a little bit of work). Monoliths themselves shouldn't be limited to running just a single instance and aren't that different from a scalability perspective than microservices.

Where microservices excel, however, is that you can observe individual services (e.g. systemd services or them running in containers) better and see when a particular service is misbehaving or scale them separately, as well as decrease that X overhead since each service has a smaller codebase when you have lots of instances running. This does come at the expense of increased operational complexity and possibly noisy network chatter, especially if you've drawn your service boundaries wrong.

However, at the same time I've seen actual monoliths that can never have more than one instance running due to problematic architecture, so therefore I propose the following wording (that I've heard elsewhere):

  SINGLETONS - a monolithic application that can ever only have a single instance running, for example, when business processes are stored in memory for a bit, or have user sessions or something like that stored locally as well; these will ONLY ever scale VERTICALLY, unless you re-architect them
  MONOLITHS - applications that contain all of your project's logic in a single codebase, although multiple instances can be launched in parallel, depending on your needs; can be scaled BOTH VERTICALLY and HORIZONTALLY; they have more overhead though and observability can be a bit challenging
  MICROSERVICES - applications that contain a part of the total project's logic, typically across multiple separate codebases, possibly with shared library code, pieces of your project can be scaled separately, BOTH VERTICALLY and HORIZONTALLY; they are operationally more complex, can involve more network chatter and while you can observe how services perform, now you need to deal with distributed tracing
Of course, there can be more nuance to it, like modular monoliths, that still have one codebase, but can have certain groups of functionality enabled or disabled. I actually wrote about that approach a while back, calling them "moduliths": https://blog.kronis.dev/articles/modulith-because-we-need-to...

I don't actually expect anyone to use these particular terms, but I dislike when someone claims that monoliths have the issues of these "singleton" applications when in fact that's just because they've primarily worked with bad architectures. Sometimes they wouldn't need to shoot themselves in the foot with microservices if they could just extract their session data into Redis and their task queues into RabbitMQ. Other times, microservices actually make sense.

Re:You Want Modules, Not Microservices by rlt on Wednesday January 04, 2023 @04:25AM (#34243670)
You can horizontally scale a monolith without going full microservices.
Re:You Want Modules, Not Microservices by lamontcg on Tuesday January 03, 2023 @01:41PM (#34235849)
I was working at Amazon when they started transitioning from monolith to microservices, and the big win there was locality of data and caching.

All of the catalog data was moved to a service which only served catalog data so its cache was optimized for catalog data and the load balancers in front of it could optimize across that cache with consistent hashing.

This was different from the front end web tier which used consistent hashing to pin customers to individual webservers.

For stuff like order history or customer data, those services sat in front of their respective databases and provided consistent hashing along with availability (providing a consistent write-through cache in front of the SQL databases used at the time).

I wouldn't call those areas where it makes things more efficient rare, but actually common, and it comes from letting your data dictate your microservices rather than letting your organiation dictate your microservices (although if teams own data, then they should line up).

Re:You Want Modules, Not Microservices by jayde2767 on Tuesday January 03, 2023 @02:16PM (#34236502)
Thank you for pointing out caching. I was going to reply, at some point, that architecture in a well-designed distributed system considers both locality of data and the ability to cache data as a means of improving both latency and throughput and often does appreciably.

But I don't have to now.

Re:You Want Modules, Not Microservices by jiggawatts on Tuesday January 03, 2023 @05:55PM (#34239319)
Most web sites I've seen in industry have just two servers, and only for active-active availability. Because of this, cache locality makes very little difference, because both nodes need to cache common data anyway.

Cache locality starts making a difference when you have over ten servers, and a significant fraction of the data is cacheable.

For "transactional" Enterprise CRUD apps, often there is very little that can be cached due to consistency concerns.

Re:You Want Modules, Not Microservices by closeparen on Tuesday January 03, 2023 @11:28PM (#34242049)
I don't see the affinity between microservices and locality. Any kind of distributed storage, including cache, is going to include a choice about how data are partitioned, ordered, and indexed. If you want certain records to be in memory on the same nodes, you should not need a separate cache cluster to accomplish that, let alone a separate cache service implementation.
Re:You Want Modules, Not Microservices by jbergens on Wednesday January 04, 2023 @07:25AM (#34244741)
I think Amazon (and Google and other FAANG entities) work at another scale than 99.9% of the rest of the world. The problems they face are different, including the impact of data locality.

I've seen many systems where there are a few hundred to a few thousand users, not hundred of millions or billions of users. There can also be teams of 5-10 developers who manages +20 microservices. I still don't think those projects have the same needs and could have done something else.

Re:You Want Modules, Not Microservices by lamontcg on Wednesday January 04, 2023 @08:19PM (#34254600)
I started at Amazon in 2001 when we had around 400 servers running the website, it was large, but it was around the scale that most Fortune 500 companies operate at.

I'll agree that a team of developers with 20 microservices sounds obviously wrong (which is really my point that the site should be divided around data and the orgs should probably reflect the needs of the data--not the other way around). And Amazon back then didn't have that problem.

Re:You Want Modules, Not Microservices by jayd16 on Tuesday January 03, 2023 @02:03PM (#34236280)
So tell me, who is making microservices for calls that could be done wholly in memory? How are you handling rollbacks and such for this in memory logic?

Aren't you still writing out to external data stores? If that's the case then its really not a comparison of in process to a RPC, it just two RPC hops now, no?

Re:You Want Modules, Not Microservices by dagss on Tuesday January 03, 2023 @04:28PM (#34238326)
When you move to microservices -- or rather, when you split your data across several DBs -- you sometimes end up basically reimplementing DB synchronization in business logic layers that could (sometimes, and depending on scalability constraints) be solved by using DB transactions.

So instead of a single DB transaction, often with a single SQL roundtrip, microservices can sometimes force through coordination of separate transactions to several DBs.

Re:You Want Modules, Not Microservices by jupp0r on Tuesday January 03, 2023 @09:28PM (#34241199)
I think all your points are correct but none of them address scalability. What do you do if your one efficient machine is too small for your problem? To be fair, not a lot of problems reach that point in practice, definitely not every problem a microservice is written for.

It might still be completely viable to rewrite something so that it's only 10% as efficient but you can scale it horizontally easily.

Re:You Want Modules, Not Microservices by spullara on Wednesday January 04, 2023 @01:55PM (#34249775)
I do think using something like Flatbuffers or CapnProto where the SerDe is removed (aside from the travel over the network) could be a huge win. Another thing I have always wanted to try is to develop a system using microservices with a RPC layer that uses immutable objects so you can later combine the services and convert RPCs to function calls.
Re:You Want Modules, Not Microservices by winternett on Friday January 06, 2023 @12:46AM (#34271446)
I really miss the old days where when an app was down it was obvious... Now apps just go unresponsive because of connectivity issues between services... We used to have frameworks that could communicate errors in one log, it was a beautiful thing. As cloud infrastructure became more powerful to better host so called "monolithic" systems, it was all scrapped to move to microservices, which were made for less powerful infrastructure. Everything was refactored to the point where it's expensive to go back... Pretty crazy how much money the industry wastes on refactoring...

On top of that, the tendency to get complacent with unstructured data in a lot of systems is really creating a very complicated lock-in when systems are developed for unique services on each cloud provider... Bowls of spaghetti.

Hire Solutions Architects for dev projects, make your apps future proof... I warn you. Too much microservice customization leads to vendor lock in and expensive operational costs... This is why a lot of apps get sunsetted early.

Re:You Want Modules, Not Microservices by gregors on Tuesday January 03, 2023 @12:41PM (#34234822)
I very much agree with you on points 1 & 2. I'll add a 3rd - drying up repeated functionality such as repeated auth logic in completely separate applications.
Re:You Want Modules, Not Microservices by brhsagain on Tuesday January 03, 2023 @01:20PM (#34235432)
I don't understand the argument around microservices purporting to fix scalability. Say your system has modules A, B and C in one app, and that A requires more resources while B and C are relatively unused. Won't B and C just run less and thereby use appropriately fewer resources from within the same system as A? Are microservices just an aesthetic separation (it feels nice to know you're "only" scaling up A)?
Re:You Want Modules, Not Microservices by linza on Tuesday January 03, 2023 @02:20PM (#34236573)
It doesn't necessarily fix it but has less resource waste or is easier to manage than the bin packing needed otherwise.
Re:You Want Modules, Not Microservices by mk89 on Tuesday January 03, 2023 @01:52PM (#34236052)
> A better rule is for one service to own writes for a table, and other services can only read that table,

Been there: how do you handle schema changes?

One of the advantages that having a separate schema per service provides is that services can communicate only via APIs, which decouples them allowing you to deploy them independently, which is at the heart of microservices (and continuous delivery).

The way I see it today: everyone complains about microservices, 12 factor apps, kubernetes, docker, etc., and I agree they are overengineering for small tools, services, etc., but if done right, they offer an agility that monoliths simply can't provide. And today it's really all about moving fast(er) than yesterday.

Re:You Want Modules, Not Microservices by jmchuster on Wednesday January 04, 2023 @03:45AM (#34243444)
For us, we started off with a world where each service communicates to each other only via RabbitMQ, so all fully async. So theoretically each service should be able to be down for however it likes with no impact to anyone else, then it comes back up and starts processing messages off its queue and no one is the wiser.

Our data is mostly append-only, or if it's being changed, there is a theoretical final "correct" version of it that we should converge to. So to "get" data, you subscribe to messages about some state of things, and then each service is responsible for managing its own copy in its own db. This worked well enough until it didn't, and we had to start doing true-ups from time to time to keep things in sync, which was annoying, but not particularly problematic, as we design to assume everything is async and convergent.

The optimization (or compromise) we decided on, was that all of our services use the same db cluster, and that if the db cluster goes down, it means everything is down. Therefore, if we can assume the db is always up, even if a service is down, we consider it an acceptable constraint to provide a readonly view into other services db. Any writes are still sent async via MQ. This eliminates our syncing drifting problem, while still allowing for performant joins, which http apis are bad at and our system uses a lot of.

So then back to your original question, the way that this contract can break is via schema changes. So for us, since we use postgres, we created database views that we expose for reading. And postgres view updates are constrained that they must always be backwards compatible from a schema perspective. So then now our migration path is:

- service A has some table of data that you like to share

- write a migration to expose a view for service A

- write an update for service B to depend upon that view

- service B now needs some more data in that view

- write a db migration for service A that adds that missing data, but keeping the view fully backwards compatible

Re:You Want Modules, Not Microservices by mk89 on Wednesday January 04, 2023 @04:38AM (#34243745)
> So then back to your original question, the way that this contract can break is via schema changes. So for us, since we use postgres, we created database views that we expose for reading. And postgres view updates are constrained that they must always be backwards compatible from a schema perspective. So then now our migration path is: > - service A has some table of data that you like to share > > - write a migration to expose a view for service A > > - write an update for service B to depend upon that view > > - service B now needs some more data in that view > > - write a db migration for service A that adds that missing data, but keeping the view fully backwards compatible

I don't think I understand. You need to update (and deploy) service B every time you perform a view update (from service A), although it's backward compatible?

Re:You Want Modules, Not Microservices by jmchuster on Thursday January 05, 2023 @10:19PM (#34270535)
if service B needs some new data from the view that isn't being provided, then you first run the migration on service A to update that view and add a column. Then you are able to update service B to utilize that column.

If you don't need the new column, then you don't need to do anything on service B, because you know that existing columns on the view won't get removed and their type won't change. You only need to make changes on service B when you want to take advantage of those additions to the view.

Re:You Want Modules, Not Microservices by mk89 on Friday January 06, 2023 @02:23PM (#34279551)
This only works if you apply backward compatible changes all the time. Sometimes you do want to make incompatible changes in your implementation. Database tables are an implementation detail, not an API which you're trying to expose as a view, etc.

But hey, every team and company has to find their strategy to do things. If this works for you, that's great!

It's just not a microservice by definition.

Re:You Want Modules, Not Microservices by jmchuster on Friday January 06, 2023 @09:55PM (#34284642)
I would never claim that our setup uses microservices. Probably just more plainly named "services".

And yes, that is correct, we agree that once we expose a view, we won't remove columns or change types of columns. Theoretically we could effectively deprecate a column by having it just return an empty value. Our use cases are such that changes to such views happen at an acceptable rate, and backwards incompatible changes also happen at an acceptable rate.

Our views are also often joins across multiple tables, or computed values, so even if it's often quite close to the underlying tables, they are intentionally to be used as an abstraction on top of them. The views are designed first from the perspective of, what form of data do others services need?

Re:You Want Modules, Not Microservices by rusebor on Wednesday January 04, 2023 @05:05AM (#34243917)
what if we put the table behind a view? would it be count as a communication via API?
Re:You Want Modules, Not Microservices by mk89 on Wednesday January 04, 2023 @02:28PM (#34250197)
No, because that's not the service API. That's just a view over a table - an internal data structure used to represent some business domain model which should be properly exposed through some implementation-agnostic API. Service B should not care how service A implements it.

And the fact you must keep backward compatibility ( see the OP answer above) at the implementation level shows how fragile this approach is - you will never be able to change a database schema as you wish just because you have consumers that rely on the internal details of your implementation - a table. If you want to change a field from char to int, you can't. How is it important for service B to know that level of detail? An API could still expose a domain model as char, if you want to, and maybe introducing new fields, new methods, whatever way. Or maybe nothing at all, maybe it's not necessary because the database field is never exposed but only used internally (!!).

On the other hand, if you expose a database agnostic API (e.g., http, rpc, ... whatever) you can even swap the underlying database and nobody will notice.

A good rule of thumb is: if I change the implementation, do I need to ask/tell another team? If the answer is yes, that is not a microservice.

Re:You Want Modules, Not Microservices by rusebor on Thursday January 05, 2023 @02:11PM (#34264913)
a view would allow you to change a field's type.

something like this

CREATE VIEW table_read_api AS SELECT TO_CHAR(now_int) as was_char FROM the_table;

not sure that the view is an internal structure because it will be exposed via API as it is.

SQL allows to swap the database at least if no specific SQL features are used.

Re:You Want Modules, Not Microservices by mk89 on Friday January 06, 2023 @01:45PM (#34279028)
> a view would allow you to change a field's type.

Which proves my point: if I change a field type ( in the table ), I will have to change the view type. I need to change 2 services because one of them changed an implementation detail.

Re:You Want Modules, Not Microservices by rusebor on Friday January 06, 2023 @02:29PM (#34279628)
before the change

CREATE TABLE the_table (was_char CHAR);

CREATE VIEW table_read_api AS SELECT was_char FROM the_table;

a client consumes data via:

select was_char from table_read_api;

after the change

alter table the_table modify was_char int;

alter table the_table rename column was_char to now_int;

CREATE VIEW table_read_api AS SELECT TO_CHAR(now_int) as was_char FROM the_table;

the client uses the same query

select was_char from table_read_api;

the type of the column has not changed

it is still a char

only "internal implementation" is changed

Re:You Want Modules, Not Microservices by JAlexoid on Wednesday January 04, 2023 @12:55PM (#34248958)
Yeah... The issue lies in cases where the decomposition is so extreme, that you end up not able to deploy independently.

And any benefit of a microservice owning it's own rDB is still, that schema changes aren't easily reversible. Specially when new, non predefined, data has been flowing in.

Stateless microservices are great, in the sense that you don't have to build multiple versions of APIs... but stateful microservices are just a PITA.

Re:You Want Modules, Not Microservices by throwaway894345 on Tuesday January 03, 2023 @02:00PM (#34236212)
> There's two technical problems that microservices purport to solve

There's a third technical problem that microservices solve, and it's my favorite: isolation. With monoliths, you provide all of your secrets to the whole monolith, and a vulnerability in one module can access any secret available to any other module. Similarly, a bug that takes down one module takes down the whole process (and probably the whole app when you consider cascading failures). In most mainstream languages, every module (even the most unimportant, leaf node on the dependency tree) needs to be scoured for potential security or reliability issues because any module can bring the whole thing down.

This isn't solved at the language level in most mainstream languages. The Erlang family of languages generally address the reliability issue, but most languages punt on it altogether.

> The real reason that microservices may make sense is because they keep people honest around module boundaries.

Agreed. Microservices, like static type systems, are "rails". Most organizations have people who will take shortcuts in the name of expedience, and systems with rails disincentivize these shortcuts (importantly, they don't preclude them).

Re:You Want Modules, Not Microservices by thayne on Tuesday January 03, 2023 @02:56PM (#34237080)
Another benefit of microservices is it allows you to have a permission boundary, which can restrict the scope of damage if a single server/service is compromised.

And for that matter it can (but not necessarily) limit how much damage a bad code release can do.

Of course you don't get those benefits for free just by using microservices, but impleminting those kind if boundaries in a monolith is a lot harder.

Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @07:32PM (#34240197)
The same techniques used to restrict intrusion, can be applied to a monolith.

Microservices aren't inherently more secure.

Re:You Want Modules, Not Microservices by thayne on Wednesday January 04, 2023 @12:35AM (#34242390)
Really? How do you make it so that different modules in the same process have different IAM credentials and can't get the credentials for a different module? How do you make sure a buffer overflow in you analytics module doesn't allow an attacker to read memory from you login module? How do you make sure an RCE in your image upload code doesn't give an attacker access to credentials for your payment processor?

Maybe it is possible with some low-level system calls, but at the very least it is a lot more difficult than using separate VMs or containers.

Re:You Want Modules, Not Microservices by JAlexoid on Wednesday January 04, 2023 @12:30PM (#34248600)
Giving me an example that is created to work explicitly at system/container level isn't the "gotcha" you think it is.(IAM profiles have their own limitations)

Separate process vaults, HSMs and other techniques of offloading security credentials - are the same for microservice architecture, as "monolith".

The implication that anything other than a microservice architecture must be exclusively an uber executable doing literally everything, is naive.

Re:You Want Modules, Not Microservices by thayne on Wednesday January 04, 2023 @01:38PM (#34249558)
> Separate process vaults, HSMs and other techniques of offloading security credentials

How do give one module access to the vault/HSM without also giving any other code in the same process access? Even in the event of a security compromise. And that still doesn't address the problem of a vulnerability anywhere in the monolith potentially exposing any sensitive data in processes memory (such as user data including password).

> The implication that anything other than a microservice architecture must be exclusively an uber executable doing literally everything, is naive.

Ok, replace "microservices" with "service oriented architecture". I'm comparing specifically against a monolith where you have an "uber executable doing literally everything".

Re:You Want Modules, Not Microservices by JAlexoid on Thursday January 05, 2023 @03:36PM (#34266165)
> I'm comparing specifically against a monolith where you have an "uber executable doing literally everything".

I doubt that anyone here is advocating for a system that it literally everything in one OS process. I bet even you would say that a process with a RDMBS connection is a monolith, even though it doesn't fit your definition.

As for modules - they can run as a separate process on the same machine, to isolate security critical elements.

Conversely, I doubt that any reasonable microservices architecture has every instance of a microservice in its own subnet with a firewall and strict network access permissions... including one off generated API keys.

Most, at best, use a static API key per microsoervice inside one large "secure" network... which leads me back to my point - they're not exactly easier to secure. Methods may differ a little bit, but the techniques are the same.

Then your example of a buffer overflow is going to be as bad for microservices, as for monolith.

Unless you're going to invest in a variety of systems, programming languages and OSes in your stack - your one buffer overflow, turns into buffer overflow on every other microservice... making your claim of "easier to isolate" a little bit delusional. (Classic example of Log4J bug, where monolith or microservices - once you're breached "game over")

Re:You Want Modules, Not Microservices by Sparkyte on Tuesday January 03, 2023 @02:56PM (#34237089)
What it is is using the wrong solution for a problem. Vice-versa the number of devs who justify monolithic apps is absurd. The justification of microservices is just as problematic.

It is about striking a balance. No reason should something be overly compounded or overly broken up.

Re:You Want Modules, Not Microservices by brunoborges on Tuesday January 03, 2023 @03:39PM (#34237677)
> scalability (being able to increase the amount of compute, memory and IO to the specific modules that need it).

I gave a talk [1] about scalability of Java systems on Kubernetes, and one of my recommendations is that Java-based systems - or any system on a runtime similar to the JVM, like CLR or even Go - should be scaled diagonally. Efficiency is the word.

While horizontal scaling can easily address most performance issues and load demand, in most cases it is the least efficient way for Java (and again, I risk saying .NET and Go), as these systems struggle with CPU throttling and garbage collectors.

In short, and exemplifying: one container with 2 CPUs and 2GB of RAM will allow the JVM to perform better, in general, than 2 containers with 1 CPU/1GB RAM each. That said, customers shouldn't be scaling horizontally to any amount more than what is adequately reasonable for resiliency, or unless the bottleneck is somewhere like disk access. For performance on the other hand, customers should be scaling vertically.

And Kubernetes VPA is already available. People just need to use it properly and smartly. If a Kubernetes admin believes a particular pod should double in number of replicas, the admin should consider: "would this microservice benefit even more from 1.5x more CPU/Memory than 2x more replicas?" and I bet to say that, in general, yes.

[1] https://www.youtube.com/watch?v=wApqCjHWF8Q

Re:You Want Modules, Not Microservices by kevincox on Tuesday January 03, 2023 @03:50PM (#34237832)
Basically any software, even something in C or C++ with manual memory management will scale more efficiently vertically than horizontally. Basically it would be better to run one twice as big as it would be to run two instances on the same machine. There is almost always some overhead or cache that will make the performance of fewer instances better. The only exception is resource contention but it is generally not too hard to fix the important cases.

My default recommendation has always been to make instances "as big as possible, but no bigger". You may need 3 instances for redundancy, fault tolerance and graceful updates but past that you should probably scale up to near the size of your machine. There are obviously lots of complications and exceptions (for example maybe using most 3 instances uses 90% of your machines so you can't bin pack other processes there so it is better to use 4 instances at 70% as the machines will be used more efficiently) but bigger by default is generally a good option.

Re:You Want Modules, Not Microservices by brunoborges on Tuesday January 03, 2023 @03:53PM (#34237876)
> make instances "as big as possible, but no bigger"

Exactly.

But I am seeing more and more of the opposite: make instances as small as possible, and scale out (not up) if/when needed.

Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @07:17PM (#34240057)
It's really not a big surprise, tbh.

Making data available to a thread on the same core has exceptionally high bandwidth. Just that alone will help with scaling.

Re:You Want Modules, Not Microservices by brundolf on Tuesday January 03, 2023 @03:43PM (#34237725)
One other thing they give you at a large organization is flexibility in your stack

If a team wants to try out a different language, or hosting model, or even just framework/tooling, those things can be really hard to do within the same codebase; much easier when your only contract is handling JSON requests. And if your whole organization is totally locked into a single stack, it's hard to keep evolving on some axes

(I'm generally against microservices, but this is one of the more compelling arguments I've heard for them, though it still wouldn't mean you need to eagerly break things up without a specific reason)

Re:You Want Modules, Not Microservices by oflor on Tuesday January 03, 2023 @04:42PM (#34238498)
Tech zoo sometimes considered to be an anti-pattern in microservices. By introducing a different language into your organization, you decrease the mobility of developers between code bases and dilute technical knowledge.
Re:You Want Modules, Not Microservices by brundolf on Tuesday January 03, 2023 @05:04PM (#34238760)
Everybody shouldn't pull in their favorite stack just for fun, but it seems valuable to have the option of trying out new things that could turn out to be a better way forward for the org
Re:You Want Modules, Not Microservices by JAlexoid on Tuesday January 03, 2023 @07:21PM (#34240091)
Not worshiping the Microservice, doesn't mean that you avoid services in different languages.

Not all engineers need to move around - DS and MLEs are generally useless on the frontend, and vice versa.

Re:You Want Modules, Not Microservices by oflor on Wednesday January 04, 2023 @07:57AM (#34244974)
Rewriting a module from one tech stack to another is not much harder when that module was a part of a monolith and not a separate service, except that you haven't paid the upfront cost of bootstrapping a new service, putting in RPC calls, etc. And in any case, starting a project as microservices is already a bad practice due to a number of reasons, the most important for me is that it's hard to change module boundaries, which you will most likely get wrong in a new project.
Re:You Want Modules, Not Microservices by mstibbard on Tuesday January 03, 2023 @04:58PM (#34238681)
Forcing consistent language, runtime, tooling etc is generally a good thing as it reduces ongoing operational burden as well as some retention & hiring dilemmas.
Re:You Want Modules, Not Microservices by GauntletWizard on Tuesday January 03, 2023 @05:45PM (#34239236)
Those human scaling problems are also security scaling problems; the Unix process model (and, in fact, the von Neumann architecture) doesn't separate modules in security capabilities, nor is it practical to do so.

Microservices allow your permissions to be clear and precise. Your database passwords are only loaded into the process that uses them. You can reason about "If there's an RCE in this service, here's what it can do". Trying to tie that to monoliths is hard and ugly.

Re:You Want Modules, Not Microservices by closeparen on Tuesday January 03, 2023 @11:13PM (#34241952)
>scalability (being able to increase the amount of compute, memory and IO to the specific modules that need it).

I would like someone to spell this out. It seems to me people are claiming that if a single binary serves some CPU-bound requests and some memory-bound requests, and you give it more memory, then the memory gets "wasted" on the CPU-bound part. Or if you give it more CPU, the CPU gets wasted on the memory-bound part. But this kind of assignment of resources to code paths seems to be a consequence of microservices. In a single computer, single binary situation resources should not get used up unless the workload actually wants to use them. A compute-heavy thread doesn't cost heap. A big heap doesn't slow down a compute-heavy thread. What am I missing?

Re:You Want Modules, Not Microservices by rlt on Wednesday January 04, 2023 @04:21AM (#34243643)
I’d love for a language / framework that allows for an application to be composed of “modules” that can either be run in a single process, or deployed as multiple independently scalable processes, with a mostly transparent RPC system requiring minimal boilerplate.

My IDE should be able to easily traverse the call graph. My development environment should be simple to setup.

I’ve worked on microservices that required an insane amount of boilerplate to do simple things. Like 7 layers of controllers, clients, services, data services, etc, just to fetch a simple piece of data. And the developer experience of running dozens of services in a Kubernetes cluster running on my dev machine was awful.

Does anything like this exist?

I only dabbled many years ago but Erlang/OTP comes to mind.

And tRPC for TypeScript calls in browser and server.

Re:You Want Modules, Not Microservices by scottmas on Wednesday January 04, 2023 @12:08PM (#34248267)
Hey, we have a system like that at my company. Microservices are self contained and responsible for exposing their interface via SDKs created with a tRPC like library. Jump to definition works across the entire monorepo like a charm. Could you take a look and give me any feedback? https://github.com/rectech-holdings/umbrella-corp-boilerplat...
Re:You Want Modules, Not Microservices by int_19h on Thursday January 05, 2023 @05:42PM (#34267981)
The industry has been trying to do "transparent remoting" for decades now. DCOM and CORBA were both basically that.

It turns out that "transparent RPC" is basically a contradiction in terms. As soon as you start doing things across process boundaries, and even more so across network boundaries, it requires a very different approach for API design - something that's very cheap locally, like passing objects by reference, becomes expensive and full of footguns.

If you reduce the feature set to the point where it can be transparently mapped to either local or RPC - which is, basically, function calls processing and returning data organized into arrays & trees (but not graphs) - there's still the issue that RPC has so many more failure points that you have to handle that would never light up in local.

This is all still doable; I have my doubts about practical the end result would be, though.

Re:You Want Modules, Not Microservices by rlt on Friday January 06, 2023 @06:13AM (#34273458)
By “mostly transparent” I was mostly thinking type safety, ergonomics, no hand written boilerplate, etc.

Totally fine to support a limited set of primitives and collections passed by value, and require developers consider the failure modes.

In my experience HTTP+JSON or gRPC are usually lacking in at least one of those respects. If you constrain all the services to be the same language it becomes easier.

Re:You Want Modules, Not Microservices by nsmith7979 on Saturday January 07, 2023 @10:43AM (#34289041)
I made a framework along those lines for work which we used for many years to mediate ~1000 namespaced commands across dozens of repos. Whether it ran distributed or bundled (I called it "mega-service" mode) was completely controlled by config. We mostly used ZMQ for inter-service messaging, but I had implemented http, redis pub/sub, grpc, etc at various times to prove the concept.

> https://github.com/NathanRSmith/lib-courier-js

Interestingly, we're pursuing a monorepo & multi-monolith setup for the next version of our platform. So lib-courier is no longer necessary to stitch it all together. It was fun while it lasted though. Once you understood the routing algo & code patterns, lots of stuff "just worked".