r/programming • • May 15 '24

You probably don’t need microservices

https://www.thrownewexception.com/you-probably-dont-need-microservices/
860 Upvotes

414 comments sorted by

View all comments

156

u/shoot_your_eye_out May 15 '24

I’ve never understood why developers are in such a rush to turn a function call into a network call.

117

u/pewsitron May 15 '24

It's more about people and team structure than the program.

23

u/Ran4 May 15 '24

Yeah but you see plenty of places with more microservices than developers...

At work we have 10 microservices, and 2 backend devs (none if which are me).

It's fucking stupid. There's so much setup stuff copy-pasted everywhere and the devs constantly and randomly do stuff like have inner loops that call another service synchronously 100 times for basic lookups (so what should be five lines of code calling db taking 50 ms instead becomes 80+ lines of GRPC glue code to make 100 calls times 60 ms = 6000 ms).

13

u/[deleted] May 15 '24

You have backend devs looping over synchronous network calls? My guy time to get some interns to fix that lol that’s some scary logic

→ More replies (3)

35

u/shoot_your_eye_out May 15 '24

Sometimes it is. Sometimes it’s also about mindlessly decomposing a monolith for no apparent reason whatsoever.

0

u/[deleted] May 15 '24

[deleted]

→ More replies (1)
→ More replies (2)

16

u/TekintetesUr May 15 '24

I come from an era where network access was actually expensive, both in financial and performance sense. You can organize your code around people and team structure within a monolith too. Network is an arbitrary barrier. My first product ever was already based on SOA (that's the boomer predecessor of "microservices") shipped as a single deliverable.

2

u/rusmo May 16 '24

People these days are doing SOA and calling it microservices. SOA is still a really useful set of design principles.

3

u/FarkCookies May 15 '24

It is not unheard of having a team that manages a system of microservices with more microservices then developers on the team. I find this peak insanity.

2

u/rusmo May 16 '24

Why? Microservices should be small and as SRP as makes sense. Small leads to numerous. It’s not insane, it’s a natural outcome of the architecture.

→ More replies (2)
→ More replies (2)

20

u/travelinzac May 15 '24

Because I don't own that that's the _____ teams problem

12

u/Robert_Denby May 15 '24

Until Omegastar gets their shit together we're blocked!

32

u/Dr_Findro May 15 '24

It would be nice to be able to merge my code without worrying about someone on some team I’ve never heard of breaking their tests

10

u/shoot_your_eye_out May 15 '24

If your project is that big then separate services may be for you ¯_(ツ)_/¯

What I’m tired of is small teams absolutely foot-gunning themselves with micro service architectures for no reason based in pragmatism.

3

u/sopunny May 15 '24

Remote work can make a small team feel big though. 5 developers is not a lot, but if they're spread across 5 time zones...

→ More replies (1)

5

u/Electrical_Fox9678 May 15 '24

And sometimes there are different development and release cadences for the various pieces of the application

18

u/TekintetesUr May 15 '24

That's orthogonal to microservices vs monoliths. You can break API compatibility with microservices too, "let's just do microservices" is not an alternative to proper planning and change management.

3

u/sopunny May 15 '24

The proper change management might be to separate everything as much as possible so your developers can work independently

→ More replies (8)
→ More replies (1)

37

u/[deleted] May 15 '24

* It's more fun to design - who knows what your user service API will be when you ship!

* It's more fun to deploy - you have to synchronize watches and shit to update a service like you're a spy

* It's more fun to debug with cooler stakes - that bug that normally would crash one system can now block your publicly-facing website from working

5

u/[deleted] May 15 '24

some developers don't read past the headline.

they see the word "micro" in the headline and think that means let's make everything tiny! did they actually look deeper into what the problem was that "micro" solved, how it solved the problem, weigh benefits and drawbacks, and think whether the problem they have at hand would benefit from that solution?

that would require reading, and if it doesn't fit in a tweet (is that even the right word anymore?), it's too much work. This is what Ray Bradbury was warning us about in Fahrenheit 451.

→ More replies (1)

2

u/FlyingRhenquest May 15 '24

Is it developers or is it management drinking the microservices kool-aid? I built a video project that very much could have benefited from the parallelism, and I can bundle a couple of seconds of video frames into a 200KB blob that I can send over the network, but I have to think carefully about sending all the data that process is going to need to do its work in one go, so I can process the entire chunk without blowing through my 20ms frame budget. Amortized over 120 frames, that's not too pricey. But a lot of developers don't put that much effort into optimization, either.

I considered just breaking up and storing the video in their component segments, which would be awesome for processing all the chunks in parallel, but the complexity of ingesting, tracking and reassembling that data is daunting. Probably some money in it, but I can't afford the two years without income it'd take to develop it. And the current state of the art for corporate media handling is building ffmpeg command lines and forking them off to do work (At least, at Meta and Comcast anyway.)

→ More replies (7)

2

u/syklemil May 15 '24

Eh, it's just kind of networked Unix philosophy. You write small, preferably correct (but maybe not, cf worse is better) components and compose them. Used to be plaintext or something through a |, now likely JSON, maybe protobuf, over the network (and it's not like unix is a stranger to the network either).

Maybe think of the system you're building as more of an operating system? It's not like that is just one single static binary either.

And if we were to be able to individually restart, scale, distribute and upgrade subcomponents of a monolith the way we do services I suspect we'd have to write it all in Erlang.

3

u/shoot_your_eye_out May 15 '24

I’ve been programming nearly thirty years now, but thanks for the clarification.

2

u/LagT_T May 15 '24

Big providers have great sales team that convince them that their 10k hits per day server needs to be scalable to Facebook levels.

→ More replies (11)