this post was submitted on 12 Sep 2023
116 points (96.0% liked)

Programming

17326 readers
177 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
top 21 comments
sorted by: hot top controversial new old
[–] [email protected] 24 points 1 year ago* (last edited 1 year ago) (2 children)

Microservices are great if you have enough traffic that you can get an efficiency gain by independently scaling all those services. But if you aren't deploying onto thousands of servers just to handle traffic volume, you probably don't need 'em.

Your startup that has no users yet does not need the kind of architecture that Google uses, because your startup doesn't have the scaling problems that Google has.

[–] [email protected] 10 points 1 year ago (1 children)

In defense of those startups, I'm sure most of are doing it because theyve got organizational PTSD from beeing places be too fucked to be able to update their architecture rather than just overeagerness.

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago)

Well yeah, but you don't solve that by layering more complexity on top of it. If you can't yet release your code onto five servers without breaking the world for all users, you're not yet into a place where you need fifteen microservices. Google didn't have Kubernetes or Borg when they started out either; they had servers held together with Lego blocks because that's what they happened to have.

[–] [email protected] 6 points 1 year ago (1 children)

Microservices are great if you have enough traffic that you can get an efficiency gain by independently scaling all those services. But if you aren’t deploying onto thousands of servers just to handle traffic volume, you probably don’t need 'em.

I don't think that's a valid take. Microservices have nothing to do with scaling or performance, at least for 99% of the cases out there. Microservices are a project- and team-management strategy. It's a way to peel out specific areas of responsibility from a large project, put together a team that is dedicated to that specific area of responsibility, and allow it to fully own and be accountable for the whole development life cycle, specially operations.

Being able to horizontally scale a service is far lower in the priority queue, and is only required once you exhaust the ability to scale vertically.

[–] [email protected] 2 points 1 year ago (1 children)

Microservices have nothing to do with scaling or performance,

Microservices are not just about scaling and performance but it is a core advantage. To say they have "nothing" to do with it is outright false.

Scalability isn't something you pull out of the pocket when you need it, you must incorporate scalability by design in everything you do. (Same as with security, and testability, etc.)

Microservices are about modular design and decoupling units of code from each other. Having a bunch of pieces of code run together on a monolithic group of resources that you choose to scale vertically becomes a choice not the be-all-end-all way of doing things.

Being able to horizontally scale a service is far lower in the priority queue, and is only required once you exhaust the ability to scale vertically.

The problem with this approach is that switching from vertical to horizontal is extremely hard if you didn't plan for it from the start. Thinking in monolithics is a very hard habit to break and it's good odds that any platform that is steeped in verticality will be permeated by it at all levels. You can't just come in and switch, you typically end up having to uproot and redesign a lot of things from scratch, which in most cases ends up as a non-starter from a cost perspective.

[–] [email protected] 1 points 1 year ago

Microservices are not just about scaling and performance but it is a core advantage. To say they have “nothing” to do with it is outright false.

They have nothing to do with performance. You can improve performance with vertical scaling, which nowadays has a very high ceiling.

It's not a coincidence that startups are advised against going with microservices until they grow considerably. The growth is organizational, and not traffic.

Microservices are about modular design and decoupling units of code from each other.

Yes, but you're failing to understand that the bottleneck that's fixed by peeling off microservices is the human one faced by project managers. In fact, being forced to pay the microservices tax can and often does add performance penalties.

The problem with this approach is that switching from vertical to horizontal is extremely hard if you didn’t plan for it from the start.

I think you're missing the point that more often than not ain't going to need it.

In the rare cases you do, microservices is not a magic wand that fixes problems. The system requires far more architectural changes that go well beyond getting a process to run somewhere else.

[–] [email protected] 7 points 1 year ago* (last edited 1 year ago) (1 children)

Someone in the thread mentioned that to get the benefits of micro services in a monolith, you can use a linting rule to prevent dependencies across modules

Share data, not state.

In Rust this is a pretty good use-case for channels, which can be used to send messages across threads.

[–] [email protected] 7 points 1 year ago* (last edited 1 year ago) (1 children)

Someone in the thread mentioned that to get the benefits of micro services in a monolith, you can use a linting rule to prevent dependencies across modules

I don't think that makes any sense. The main benefit of microservices is organizational, more specifically how a single team gets to own all aspects of developing, managing, and operating a service.

Lower in priority, there's enabling regional deployments and improved reliability.

How are linting rules even expected to pull that off?

[–] [email protected] 5 points 1 year ago (1 children)

Should have explained my viewpoint. Most startups should not do micro services.

Using linting to prevent coupling between modules can give you some of the benefits of micro services without going all in.

[–] [email protected] 2 points 1 year ago

Using linting to prevent coupling between modules can give you some of the benefits of micro services without going all in.

My point was that modularizing an application and decoupling components does not, by any mean, give any of the benefits of microservices.

The benefits of microservices are organizational and operational independence. Where do you see coupling between components to play a role in any of these traits?

[–] [email protected] 4 points 1 year ago

Microservices are a reflection of Conway's law. You can bend it with multiple services masquerading as a monolith. But you can't break it and when you need to decouple deployments, data releases, and development across a fairly large org: they're hard to beat. Of course OP is right, just call them services too. One per team is about as much as you want to break out, don't go micro

[–] [email protected] 2 points 1 year ago (2 children)

As a game dev updating my ancient backend knowledge I really was confused about this specific topic.

And I feel the same way about the many new languages. Why not just upgrade the existing ones.

[–] [email protected] 11 points 1 year ago (1 children)

If you've ever followed the C++ committee discussions you'll see they put a lot of time and effort into considering legacy code when introducing language changes. For better or worse existing languages are on a trajectory set from their inception that can't always be easily redirected. New languages are free of this baggage and can wildly experiment.

[–] [email protected] 3 points 1 year ago (1 children)

I wish languages were more willing to release breaking versions, like a C++ v2 or such. That's not to say languages don't already have breaking changes between versions (Python comes to mind), but it would allow people to start fresh and clean up obsolete designs and libraries.

[–] [email protected] 5 points 1 year ago (1 children)

You know the cleaning up probably won’t happen. If some dependency doesn’t work anymore because Python introduced a breaking change, then you stick with the old Python version.

[–] [email protected] 3 points 1 year ago (1 children)

Python is actually a good example of this: see the mess that the transition from 2.6 to 3 generated.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Python 3.7 is another good example. The new await and async keyword broke a lot of programs.

[–] [email protected] 4 points 1 year ago

Your last question is equivalent to : why there so many math theories? Can't we just reuse the old ones?

New language appear as a natural product from research in type theory for ex

[–] [email protected] 1 points 1 year ago

There is no standard tooling for microservices-based development - there is no common framework

DAPR gets you most of the way there.

[–] [email protected] 1 points 1 year ago (1 children)

orchestrating units is a very joyful experience though. Doesn't matter if those are actual (micro-)services on dedicated servers or just pure functions.

And if you write pure functions (stateless, no sideeffects, work only on the data you get via parameters), the step to make it scalable is super tiny.

[–] [email protected] 1 points 1 year ago

Unfortunately most people's code is not modular enough to be a good fit for microservices, and attempting to do microservices like that ends up in pain. That if you mentioned is a pretty big if.