News for hackers. Stuff that matters.
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).