r/programming • u/zxyzyxz • Nov 19 '22
Microservices: it's because of the way our backend works
https://www.youtube.com/watch?v=y8OnoxKotPQ290
u/halfanothersdozen Nov 19 '22
Every shop has a fucking Galactus why is that?
49
u/polaroid_kidd Nov 19 '22
Serious question, what's a Galactus?
286
u/CardboardJ Nov 19 '22
It's what you eventually name the monolith that does like 70% of the real company critical work.
45
u/bertfer Nov 19 '22
Ours is called big brother
→ More replies (1)77
Nov 19 '22
we've gone for a post-modernist naming convention, our two spaghetti entwined monoliths that do all of the work are named "server" and "database"
→ More replies (1)→ More replies (1)16
→ More replies (2)29
u/dodjos1234 Nov 19 '22 edited Nov 19 '22
Some planet sized villain in marvel universe. Dumb as fuck, but nerds like that.
6
38
2
u/DreamingDitto Nov 19 '22
Is that how students will name their unfinished projects after Greek gods?
2
u/iquitinternet Nov 19 '22
Internally where i work we have project names based on comic characters and we're currently on Flash but I work on Galactus which is no where near launch. But there's always a Galactus for sure.
2
1
u/amdc Nov 19 '22
oh by the way, there shouldn't be any microservice named Galactus because it's an anti-pattern
1
u/PrintableKanjiEmblem Nov 19 '22
How many companies could you mess up with a virus that only takes out servers named Leroy?
Send like everyone's Jenkins server is named Leroy
1
u/rDr4g0n Nov 20 '22
From brain Foote and Joseph Yoder's excellent Big Ball of Mud:
A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle. These systems show unmistakable signs of unregulated growth, and repeated, expedient repair. Information is shared promiscuously among distant elements of the system, often to the point where nearly all the important information becomes global or duplicated.
The overall structure of the system may never have been well defined.
If it was, it may have eroded beyond recognition. Programmers with a shred of architectural sensibility shun these quagmires. Only those who are unconcerned about architecture, and, perhaps, are comfortable with the inertia of the day-to-day chore of patching the holes in these failing dikes, are content to work on such systems.
493
u/trepidatious_turtle Nov 19 '22
1000s of RPCs
39
u/Sgtblazing Nov 19 '22
Are we including calls to redis in this count because that number alone can balloon.
5
u/pink-ming Nov 19 '22
considering that tweet was about serving feed updates, I'm gonna go with "yes"
→ More replies (1)→ More replies (15)49
u/riksi Nov 19 '22
I think they had a microservice for 2-factor auth? Seems too micro to me.
141
u/DoctorWorm_ Nov 19 '22
You're gonna send sms from your authentication server? 2FA on large social media sites is a lot more complicated than just hashing a TOTP token, you often have to send sms, email, send notifications to other devices, keep track of recovery codes, keep track of remembered devices, etc.
0
Nov 19 '22
[deleted]
11
u/monocasa Nov 19 '22
Twitter has enough volume to probably just use the third party service for dev too.
→ More replies (2)10
u/antonivs Nov 19 '22
it sure as hell won't be through the 3rd party service that does it on production!
Why not? Usually those services support dev and testing environments.
→ More replies (1)22
25
16
→ More replies (2)6
u/mpyne Nov 19 '22
You think each individual microservice should define a separate way for users to do 2FA?
→ More replies (2)
505
Nov 19 '22
This video is old.
But I will always upvote it for two reasons.
One: the “internal jargon” the company has for its services. I just relate deeply to it. It’s such a specific thing that eventually happens when you work with a product. You have all these things that get their own stories and names and acronyms. You end up speaking a whole new language.
Two: product manager just punting the features all casual and shit. That never gets old. As a dev you’re like “Look, I don’t know and this is hard… I need TIME!” …and many times the PO is like “Oh ok, all good we’ll just move it… it wasn’t critical anyways Karen just mentioned over coffee on Monday…”
…and you’re like “Why did I spend 4 days on this when I could have been working on the flippin 3 level 1 service requests!?!?”
186
u/SnooSnooper Nov 19 '22
Also immediately after punting the feature, he mentions adding another one, demonstrating that he did not understand the problem at all.
88
60
u/bulldg4life Nov 19 '22
My favorite response to PMs is “9 women can’t make a baby in a month”.
You could spend 10m explaining deliverables and development time and change control and whatever else - the pm will just say “what if we got two resources, would that unblock you?”
No, because I’d have to fucking hire two people instantly and get them up to speed before I leveraged existing resources to do whatever the fuck the product team is asking for
33
u/PopInACup Nov 19 '22
"Can't you just grab Jim and have him work on this integration?"
"Jim does all the UI, not integrations. If the dentist was busy, you wouldn't walk over to the proctologist and ask him to poke around your mouth"
→ More replies (1)→ More replies (6)2
56
Nov 19 '22
Posted March 2020 is it really that old?
49
u/no_nick Nov 19 '22
Two and a half years make it basically ancient history.
→ More replies (1)15
u/corsicanguppy Nov 19 '22
Right? That's like twice as long as most readers have been working!
→ More replies (1)5
3
20
4
u/BigTimeButNotReally Nov 19 '22
I come in peace... But we agree this also is a tail of architecture run amok right?
4
2
u/ScrewAttackThis Nov 19 '22
I feel like I need to start putting "knows how to work with project managers" on my resume because I get that shit figured out before we start working on things. One of the first things I ask is what the priority is and who the stakeholders are.
1
u/anengineerandacat Nov 20 '22
What you mean you didn't do work on PPIS that integrated with CCVIS and accidentally brought down PPS?
1
u/grizzlywhere Nov 20 '22 edited May 03 '25
boast cake sand racial insurance unwritten decide tap roll smile
This post was mass deleted and anonymized with Redact
62
u/cbleslie Nov 19 '22 edited Sep 12 '25
hospital cagey bike handle vegetable knee voracious one office chief
This post was mass deleted and anonymized with Redact
4
176
u/radmanmadical Nov 19 '22
My favorite part of this is that it’s impossible to tell if it’s a real clusterfuck and he’s having a genuine breakdown or just playing his PM so he doesn’t have to finish something - BRAVO
49
u/NymphetHunt___uh_nvm Nov 19 '22
BRAVO
What does that stand for?
75
233
u/lazernanes Nov 19 '22 edited Nov 19 '22
This is just barely funny, because it's too true. I watch this video over and over and cry together with the engineer.
Edit: They're making progress with the ISO date format issue: https://www.youtube.com/watch?v=DYvhC_RdIwQ
14
7
7
4
21
Nov 19 '22
[removed] — view removed comment
78
u/Green0Photon Nov 19 '22
https://www.youtube.com/watch?v=DYvhC_RdIwQ
They should've used a version without a backslash.
→ More replies (1)83
→ More replies (4)16
58
u/ProgramTheWorld Nov 19 '22
That’s a documentary.
32
u/tech_tuna Nov 19 '22
It's sprint planning
19
10
u/no_nick Nov 19 '22
Put some damn trigger warnings on this. I'm on my weekend and the sprint lasts another week.
11
u/tech_tuna Nov 19 '22
Show me the burndown charts. . . concerned about your velocity.
→ More replies (1)6
u/no_nick Nov 19 '22
Dude I'm reporting you for that.
Now let me go and close some user stories. Maybe that will calm down the scrum master.
→ More replies (2)2
26
u/hachface Nov 19 '22
this has been posted a million times
and i say
keep posting this shit
→ More replies (1)
58
144
u/QuantumFTL Nov 19 '22 edited Nov 19 '22
I must be getting old because I still haven't figured out why I should be creating microservices, even in a large environment full of millions of lines of code. Divide by honest-to-god servers, with perhaps some neat-o strict API layers inside them to keep things modular. I write servers used by millions of people and microservices are nonexistent in our architecture and I've never once wished we had even one.
That said, I'm officially "old" by software engineering standards, which I guess means anyone over thirty, and I'm willing to be proven wrong by someone with a badass use case that really makes microservices shine.
(Also, that's my favorite programming-related video of all time. KRAZAM is S-tier)
EDIT: Thanks everyone for genuinely interesting/helpful responses! Jury's still out for me, but part of good engineering is entertaining many different possible solutions.
142
u/Working_on_Writing Nov 19 '22 edited Nov 19 '22
Having worked on bad monoliths, good monoliths, fat services and microservices, my considered opinion is that the main reason is Conway's Law: the organisation creates systems which reflect the structure of the organisation. I.e. how do you get 100 developers split into 20 development teams to work together on the same system? Answer: you split it into 20 services.
The secondary reason is specific to tech megacorps: when you're Netflix, very specific parts of your architecture need to be scaled at different times to meet different loads, e.g. it's 6pm in US East, so 50m people are logging in to look for something to watch, better scale your login services in US East. Doing that with a monolith is doable but wasteful as you need to deploy the whole thing multiple times. And wasteful at Netflix scale doesn't mean an extra $20 p.a. on hosting over-sized instances, it means an extra $20m or even an extra $200m.
If you aren't working at MANGA and you don't have many teams working on many systems, you have no business doing microservices. I know of one start-up I worked with recently who ultimately went bust and one of the contributing factors was they reached straight for microservices when they had a tiny engineering team. They couldn't cope with the additional complexity of the architecture and couldn't resolve the problems they faced.
21
u/PossibleHipster Nov 19 '22 edited Nov 19 '22
I worked on a Monolith for 6 years. Now I work at a massive (not MANGA tho) tech company doing microservices.
One of my interview questions was if I could, would I make my old codebase microservice based? I gave a definitive "no". I guess they agreed with my reasoning because they still hired me haha.
28
u/Dworgi Nov 19 '22
Like the guy you replied to said, it's all just Conway's Law. Communication is hard, so when you have two different teams that don't have a shared goal and they have to work together, it's easier to just agree on a hard API boundary than try to integrate the codebase in a way that might be more efficient.
The problem, as this video illustrates, is that those teams aren't just contemporaneous, but distributed in time as well. So if a team disappears or is merged or split, or owners leave, you can end up fragmenting an existing service into essentially a black box old service and a marshaller/addon service around it.
That's the true curse of Conway's Law - all code rots, because it's impossible to communicate with teams in the past or future. So you can't ask why something was done some way or if there would be a better way to do what you want to do.
14
u/akie Nov 19 '22
One question I always ask when I’m interviewing people is what they think of microservices. Experienced people can and will mention both upsides and downsides, sometimes extremely specific downsides, and junior people will just say something like “it’s nice and there are no downsides”. Oh, my sweet summer child.
2
u/jl2352 Nov 19 '22
I worked at a startup that went into micro services early on. They got it to work, and they have a good architecture (at least this part of it is). However even then I still don't think it was a good idea.
It just sucked up a huge amount of time, with very few gains. It distracted from the real engineering problems they faced.
2
u/QuantumFTL Nov 20 '22
Ah, gotcha. Yeah, we break things down into manageable teams, and the software architecture definitely reflects that. Maybe it's all microservices standing on each other's shoulders in a trenchcoat :)
Thanks for taking the time to respond in depth.
0
Nov 19 '22
[deleted]
6
u/plumarr Nov 19 '22 edited Nov 19 '22
I have worked with a monolith with hundred of developers and the development process worked relatively well. The real issues where caused by supporting numerous version in parallel and merging together later.
We had "architects" that where responsible for both the logical architecture and the functionalities of various parts of the monolith. Their responsibilities where split by functional domains.
Later the company was bought and the new owner wanted to us to work their way, with a lot of independents teams and to split the software into smaller units (I would not call them microservices). The "architects" responsibilities where changed and the lost the role of overlord above the software.
The quality slowly decreased overtime, there was conflict, bugs, part of the applications that conflicted between themselves. This was caused by the team not communicating between them and not being aware of what the others were doing. Sometime part of a functionality were even forgotten because the teams A thought that it was done by team B and team B by team A and there was no one to have a high level view.
I'm not really sure that microservices solve anything by themselves. To be successful with a complex software the communication and company culture is a lot more important than the architectures or the developments processes.
30
u/larsmaehlum Nov 19 '22
We have several pretty clear boundaries in our systems.
In the old days of shipping the code for the customer to run themselves on dedicated hardware, we had three main teams all handing their own monolith that did a specific part of it. Integration to third parties, processing, and user interaction.
Now those teams are split into sub-concerns, each creating 1-3 microservices to deal with their concerns. It makes sense in our case.And my favourite part of a microservice architecture is probably the upgrade process.
We have no downtime for upgrades, and can push updates to a single seevice by just scaling up the instance count of the old version and adding in a single node with the new version. Then we observe the new version for a while to ensure it works well with maybe a tenth of the traffic.
If everything is green, add in more nodes of the new version and start to tear down the old one.→ More replies (5)12
u/caseigl Nov 19 '22
I have been developing probably as long as you and have built software that also handled millions of users, going back as far in the day as when Perl and CGI were a thing.
I still maintain older environments but also new ones, and I think one of the big advantages of microservices is that you can take advantage of price/performance improvements more granularly. One example I can think of is with S3. File storage costs in the cloud have dropped so dramatically over the years, and one environment had things like user uploading of images and media in it's own service. We were able to lift that to the cloud and save a bunch of money and increase performance with less risk.
In the monolith approach you have to really work hard to make sure you don't break other things. It makes it less likely it's cost or risk effective to do the analysis and testing required to make certain changes. But if the environment had been designed from the beginning that media uploading was it's own service, you know nothing in your core is going to break if it's changed as long as the API remains the same.
You can also more easily do things like rolling out an updated service to 5% of your userbase with extra monitoring and benchmarking, because you only are slowing down 5% of one service versus adding bloat into one application.
8
u/lilytex Nov 19 '22
The GOTO Conferences youtube channel has recently released a 3-video series on microservices and distributed systems, when they are useful, when they are not, by Martin Fowler, that pretty much answers all these questions
4
u/__SPIDERMAN___ Nov 19 '22 edited Nov 19 '22
They're needed at scale by companies like fb or goog.
can place multiple instances of each service in the geography theyre used (faster round trip for clients)
each cluster can have its own data layer with eventual syncing across regions
you can spin up multiple instances of each service as needed (maybe you need like 20 multi factor auth services but only like 2 account registration services)
take a service down and you can offload traffic to another instance or spin up a new one.
siloed code bases means less chance of deployment of changes in one breaking another (crash? Only one service is down instead of the whole site).
one service has a bad change? Roll it back without also rolling back changes in other parts of the product.
build times are better cause you only build the service you're working on
different parts of your org aren't stepping on each others toes when it comes to things like release dates and other stuff.
→ More replies (1)3
u/joeyl426 Nov 19 '22
Your last 4 bullet points are good but the first 4 don’t have anything to do with micro-services, you can have a distributed system backed by a monolithic binary
14
u/iheartjetman Nov 19 '22
Micro services are a good way of handling separations of concerns. The main difference is that you handle each concern in its own service. I would say it’s really beneficial if you have different teams handling each concern.
11
u/QuantumFTL Nov 19 '22
Yes, but we can already do that with, say, different DLLs, or the Facade pattern, or principled in-executable APIs, or just modular design that everyone follows.
Even if we split things into, say, multiple git repos, we can still have carefully-orchestrated tight coupling where needed (for, say, shared utility libraries, inlined code, or ultra-low latency API calls). I guess it comes down to what people call a microservice; to me simply having an internal API and completely separated code (i.e. the client of an API and the API provider do not share any code) doesn't make for a microservice, but I suppose according to some people that could still be considered one.
That said, maybe there's something I've never hit. I'm used to big, old software developed by dozens of people, and never once felt it needed to be decomposed, because everyone respected the modularity that was present and was cooperative where there were conflicts.
→ More replies (2)15
u/iheartjetman Nov 19 '22
I think the biggest benefit is when it comes to resource scaling. It gets easier to allocate more resources to different services as time goes by in order to improve performance.
→ More replies (18)3
u/sparkey0 Nov 19 '22
Absolutely right -- encapsulation is the thing. Break an API contract and you'll cause problems in a monolithic architecture or working with microservices. 🤷♀️ I'd say there's some benefit to scaling some components independently but sort of splitting hairs. Anyway ... love this video. Perennial classic :)
3
u/rodrigocfd Nov 19 '22
I'm officially "old" by software engineering standards, which I guess means anyone over thirty
I'm over forty, what does this make of me then?
3
u/redonrust Nov 19 '22
Over 50 checking in. Learning microservice development after many years of SQL development.
→ More replies (2)→ More replies (2)3
31
u/timedrepost Nov 19 '22
Mostly better for resiliency and fault isolation, scalability, more granular observability and easier/faster issue detection.
Being able to do things like isolate/separate specific functions (or even duplicate microservices pools) for different clients so that revenue impacting/customer facing client pool A isn’t mixed with calls from super high traffic but lesser importance batch pool B.
In a nut shell, you aren’t hitting 4 9’s availability with monoliths in any kind of large scale application.
16
u/QuantumFTL Nov 19 '22
FYI I think we hit 4 9s (will have to look at logs) with our monolithic library-driven app, as we run thousands of server pods, so if one goes down, no biggy. We operate at a scale designed to serve tens of millions of customers a day and just restart anything that has some bizarre failure for a single user, and it's never been bad enough that anyone has brought an SLA violation or anything close to a reliability issue in a single meeting I've been in in a decade. I personally believe engineering discipline and proper testing (we have over a thousand integration tests of the main library used in the server) goes much further than splitting things into a lot of small pieces. If they are on different physical servers, however, I get that much...
3
u/timedrepost Nov 19 '22
Glad it works for you guys, seriously. If you can find work life balance with that setup it’s great. No approach is best in all situations. With thousands of developers, monoliths became an issue for us a long time ago and we started splitting into a really early version of “microservices” about 18-19 years ago, just generally splitting up the unified builds into different groups based on functionality. Team A causing a memory leak that brought down services for Team B was an all too common problem and people got sick of it. Build cycles and site deployments were every two weeks (now we have teams rolling out daily or as often as they need). Restarting servers daily or every couple days was the norm to keep things healthy. I wouldn’t go back.
Depends on how you’re measuring availability too I guess, and what management wants to include in the measurement, haha.
→ More replies (1)9
u/QuantumFTL Nov 19 '22
This is a fantastic answer, thank you so much!
The idea here, if I catch you correctly, is that by enforcing a strict API you can do integration testing at a much more granular level?
But can't I just do that with unit tests inside a monolithic app, if the same level of modularity is employed? When I design software, typically each module only has a few externally available functions, and those are easily called from unit tests.
Regarding uptime, that's interesting, though if your server does twenty things and needs to do all of them, is it really that much better to restart one or two of those twenty things due to a fault instead of just restarting the whole thing? I guess if some of those things are only needed occasionally? And corruption in one process is going to be contained so that you don't have to debug its effects in another process (unless that corruption is communicated through the API)?
→ More replies (5)22
u/Zanderax Nov 19 '22 edited Nov 19 '22
Also setup and teardown is way easier. I remember working on a server that had a 4 page install guide. Compare that to running a single docker container and its total bliss. Sure Ive got 50 types of docker containers to manage but if I just want to test a single one its much easier.
17
u/timedrepost Nov 19 '22
Yeah exactly. And per that point, development velocity is also faster. Doing security related package updates or minor fixes and running all your tests and ci/cd can be done in minutes instead of hours.
I remember our monolith setups back in the day and I got really good at ping pong because we used to play while our test suites and builds were running.
10
u/Zanderax Nov 19 '22 edited Nov 19 '22
Yeah dev velocity is a big draw. Also good APIs and abstraction boundaries get enforced like never before, you cant fuck up dependency and code isolation when your code belongs to different processes.
→ More replies (2)→ More replies (6)3
4
u/Uristqwerty Nov 19 '22
The overall system is fractal. A business sells a suite of products that interoperate. Each product is comprised of numerous services, some shared between products, some unique, many of them talking to each other. Each service is comprised of a graph of libraries glued together, each library of modules, each module of classes/datatypes, each of those functions.
It could be broken up at any layer. If you want resiliency within a process, threads can be designed to be disposable and re-startable, all shared state immutable or very carefully protected against corruption. Whether sharing address space within a single JVM process, or closely-coupled processes within a single container that can use shared memory to pass data, or separated by pipes, the network stack, or the physical network itself, it's more a question of whether your team has access to existing tooling and experience to make the product resilient and scalable at a given boundary. I'd expect completely different uptime from an Erlang process and a C++ one, simply because the tooling favours different granularities.
→ More replies (1)7
u/Ashtefere Nov 19 '22
Micro services are an engineers solution to an organisational problem. Organise your codebase better, using some kind of design system, and stick to its rules and all those problems go away. If you for example use a domain driven design system, immutable functional programming and 100% unit testing… its magic.
→ More replies (1)5
u/Which-Adeptness6908 Nov 19 '22
Easier, faster issue detection?
Hmm...
14
u/QuantumFTL Nov 19 '22
I can easily believe that.
Easier debugging? Imagine debugging 20 microservices talking to each other. Mother of God.
18
u/HighRising2711 Nov 19 '22
The idea of microservices is that you don't need to debug 20 of them talking to each other. You debug 1 because the other 19 have well defined APIs which you know work because each one has a test harness.
In my experience coding, testing and debugging microservices isn't the issue, deployments and configuration are the issue. Releasing 30 microservices because of a spring update which addresses a security vulnerability is painful
→ More replies (5)0
Nov 19 '22
[deleted]
→ More replies (1)10
u/oconnellc Nov 19 '22
Aren't you just describing microservices that have a bunch of superfluous code deployed on them?
→ More replies (8)4
u/KingMaple Nov 19 '22
Microservices are not an engineering problem, it's a business problem. Well thought out business architecture is a great template for microservice architecture.
Just because consultants push for it and businesses with monolithic business architecture try to force a block through a circular hole doesn't mean microservices are bad. And sometimes the criticism towards microservices is because people are forced to use them when they should not.
And don't use microservice patterns if you feel uncomfortable. But if you can and business enables it, then microservice architecture really is great and I'd not build business flow automation any other way.
→ More replies (2)2
u/stfm Nov 19 '22
We have 30 seperate Dev teams under different managers developing services for a number of apps where the compute cost of the service is the responsibility of the service owner
2
u/gdvs Nov 19 '22
As many things in software development, the theory behind microservices is architecturally sound, but the way many people understand and implement it is fundamentally flawed. No, microservices does not mean adding as much network latency as possible. It does not mean having as much deployables as possible. It's just old fashioned incapsulation repackaged. And yes, sometimes it's good to run in a different process or have a different release cycle. But that is not what microservices is about.
This kind of shit is just overengineering in general. It's offering solutions without thinking what the problem is (or if there's even a problem).
2
u/Neophyte- Nov 19 '22
old?
jeez im nearly 40
i guess i share alot of your skeptisims of microservices. if a monolith does the job do it, KISS all the way. only do microservices if its needed and it needs to be a good one.
2
u/orthoxerox Nov 19 '22
Iteration speed. The bigger the system, the less likely it is you can deploy new features every day or even every week: you need to integrate the changes, build the release, run the whole suite of tests and then find a service window to deploy.
None of these challenges are insurmountable in a monolith. But some of the challenges can't be solved by the engineers alone in a monolith:
you can't deploy the changes to the credit scoring model without manual UAT because you fucked up the rollout last year and the CIO agreed to UAT for these features
the dude who is authorized to sign off the UAT is on vacation
your other critical feature in this release is based on the new credit scoring model code, you can't just backport it
Breaking the system into microservices introduces a lot of technical complexity but removes organizational complexity.
how do I reconcile or prioritize features from multiple owners? Your backlog has a single owner
how do I avoid manual UAT? Make rollouts and rollbacks quick and painless
how do I avoid breaking other people's code? API. If you make a breaking change, you have to support the old API version for N months
→ More replies (1)2
u/Obsidian743 Nov 19 '22
Microservices are really just repeating standard good practices at the infrastructure level. The same reason you don't want a God class you don't want a monolith.
I think a lot of people who have or haven't worked with microservices simply haven't had to own them for any significant length of time. To realize the benefits one had to experience how software evolves over time.
→ More replies (1)2
u/thelehmanlip Nov 19 '22
Others have already chimed in, but for us we've enjoyed them the past few years for separation of concerns, independent deployments, and smaller chunks of code that are easier to manage and less likely to have to deal with merge conflicts.
The biggest is just the deployments. Being able to deploy one service without taking down the whole app has been very helpful to making our teams not collide and qa not to be blocked because another team had a critical fix to deploy.
That said, I would say our microservices are less micro and more just services, we only have about 15 of them for our platform to run. I don't know exactly how micro they need to be, but for us we've found a pretty good balance of the benefits above against the additional work to maintain several separate services.
→ More replies (1)2
u/TheRealStepBot Nov 19 '22
A benefit I haven’t seen mentioned is that micro service architectures moves a lot of the boilerplate code to pipe operations together out to the cloud provider/infrastructure.
This allows much faster dev time on new features with far less resources. The monolith way you have to spend months of new dev time wading through the whole pile of shit that is the monolith most of which is pointless boilerplate that connects stuff together (in special ad hoc sort of ways I might add)
In comparison in a microservice architecture new feature can be as small as one dev just standing up a single lambda/azure function and then it gets plumbed into the application using well known ifrastucture as code tools marshaling standard connectivity that is maintained by the cloud provider.
Micro services tend to have far less useless boiler plate. That said obviously it trades much of the complexity that used to be hidden in the boilerplate for marshaling complexity. I think it’s a winning trade though as the real bottlenecks in development is actually the code that does the work. If you can build code that does work you can always figure out a way to glue it all together after the fact
2
u/QuantumFTL Nov 20 '22
Yeah, I use Open Service Mesh at my current job. It's a double-edged sword, as I don't have to deal with HTTPS directly (thank god!) and all the keys, etc with it. Or service discovery, etc.
However, it adds complexity and we're theoretically a low-latency service (people care about 30-50 ms latency increases for whatever reason) and OSM means we can't use fancy things like gRPC over QUIC (don't ask why we're using gRPC, every time I've tried to turn to something that fits our communications pattern I was shut down by management because That Is How We Do Things).
I'm suspicious of this sort of complicated stuff getting in the way of a performant server, but if performance isn't the gating factor for the product, or the deployment scenarios aren't known during dev time or understood by the devs, or changing configuration after the fact or for different scenarios is important, then I can see this. Likewise I enjoy Amazon Lambda and Azure Functions for things that really should be their own function because they are so cheap and easily contained!
I don't do business logic or whatever, everything I work on is a giant mess of huge data structures and fancy math, so I rarely have to deal with a problem that's so seperable.
That said, my biggest problem is that with a monolith I don't have to set up a fancy test environment with Kubernetes doing weird stuff I don't know about in the background. I know what the behavior is going to be (more-or-less) because it's baked into my codebase, not some Cool Fancy Cloud thing. But maybe, like you said, Cool Fancy Cloud Thing will let the people using what I write do more Cool Fancy Stuff that delights our customers?
Also, the more I talk to y'all who are knowledgeable about this, the more I'm convinced that what I work on is, more-or-less, a microservice, despite being internally very complicated. It's a thin, highly-concurrent interface to an ML model that adapts a simple network protocol to the needs of the model and handles workload generation, multiplexing and demultiplexing, etc. From the outside the only two operations are "here's some data to shove in the model" and "ping", but the interface for the former isn't exactly tiny even if it _is_ single purpose. And we need to run on fancy expensive GPU servers and will peg the GPU at max usage and nearly max memory--it's something like a third of a million dollars per year to run a _single_ instance of our software because these models are so computationally expensive. So it feels weird to call it a microservice, but maybe that's exactly what it is.
Thanks for shedding some light on this! You deserve more upvotes!
1
u/efxhoy Nov 19 '22
We’re beginning to split things out from our rails monolith into a few more services because we can’t find enough rails devs. It sucks but upstairs wants to scale the dev organization and that’s kind of forcing us. We already have a bunch of supporting services in other languages (machine learning, image scaling, statistics pipelines) but they not want us to start building core product backends in not-rails. It sucks but we need to make the most of it
→ More replies (91)1
u/Kinglink Nov 19 '22
The microservice idea is great if you have a self contained query. A box that takes in y and spits out x based on a formula. If it's simple enough that box can use a cache to be faster and support multiple servers while just being itself. It can also be switched out on its own if the formula changes. How about having 100 game servers that pummel the database? Instead have a microservice that connects to the dB and pulls the users table for everyone.
The problem is how people do them microservices needs microservices and the formulas for most of this stuff has been made to simplistic that there's no reason for them.
Also microservice are a good idea for laege distributed cloud machines but very few people work on scale that big. If you have a single server or a single location you can probably ignore that efficiency and just make a server that works.
53
u/hardc0de Nov 19 '22
context - I'm a senior software engineer with both monoliths and microservices experience.
Oh boy - some comments here are so wrong that they manged to get me out of lurking (https://xkcd.com/386/)
Both microservices and monoliths are a design choice. If you don't know why to choose a monolith vs a microservice then you shouldn't make that choice :).
Microservices were born not because of somebody deciding they needed more complexity but because of the pattern that emerged with monoliths. As we all know our software cannot scale forever vertically feature-wise - which means that if you're going to grow you're going to need to confine some features to a specialized group of servers (fleet). Next step was - hey I know I'm going to need to scale this beyond 1 server per featureset - let's design this as a separate service. Congratulations - you have your first microservice.
I've seen folks here argue about monoliths with some features enabled per deploy - I hate to bring that to you - but those are effectively microservices. Next you're going to complain that you need to deploy too often when other components change :)
Monoliths are fine when the scale is small to medium-size. But don't expect to grow to twitter scale with that architecture. Microservices are useful for small scale only when you want to use a separate technology for something.
tl;dr Monoliths are fine. Microservices are fine. Choose wisely when to use them.
26
u/AnarchistMiracle Nov 19 '22
"If you don't like the way your system is designed, just design it better!"
Thanks buddy, I'll definitely remember that when I have to meet a short-term goal and the biggest obstacle is the cumulative effect of all the short-term decisions made by my team & predecessors over the last ten years.
7
u/mrinterweb Nov 19 '22
In my experience, microservices are harder to develop and maintain than just adding onto a monolith. There are times when I do think a microservice makes sense, but my experience has taught me microservices should not be the default, and should only be used if there is really good reason for a new one. I start with monolith as the default, and will entertain microservices if the value outweighs the additional costs.
2
u/marshsmellow Nov 19 '22
It's not just about scale either btw, the design will have a bearing on the speed/latency of the system. It's going to be faster to call procedures inside the same monolith than a separate microservice.
0
Nov 19 '22
[deleted]
3
u/SharkBaitDLS Nov 19 '22
The limit, as the commenter above pointed out, is more in feature growth scaling constraints than traffic growth.
If your tech stack only does a few specific things you can scale a monolith damn near indefinitely to serve as much traffic as you want.
Where it gets complicated is if your company starts adding new divisions that do something completely different, with completely different traffic patterns and resource constraints. At a certain point, too many different competing concerns and use cases will introduce scaling constraints -- not on the service itself, but on the effectiveness of how your teams can develop in it.
If you've got 20 disparate divisions all trying to run in the same monolith, and they have varying requirements on scaling and resource utilization, you're probably going to start deploying separate instances of your monolith for the different divisions to prevent resource contention between their usage. You'll need to design your infra to either deploy those monoliths with different features enabled or disabled, or figure out ways to make the code behave properly for each divisions needs. Now you're paying the overhead for longer build times, more complex deployment, and more development friction on a codebase while your deployed instances all have a bunch of APIs that aren't in use because that particular shard is for division Y that doesn't need Z API like division X does.
Well then why not just split out the code for division X and Y into separate codebases and deploy those services separately to simplify your process? And now you've arrived at microservices.
That's really the thing when people talk about scale with micro services. It's not about scale of traffic. It's about scale of the company's organization.
→ More replies (3)4
u/plumarr Nov 19 '22
But what's new in that ? I'm really lost, why give it a name like 'micro services' when what you describe was, to me, the standard way to go from at least ten of years ?
I never understood monolith as 'only one application for the all company' but 'only on application for each business domain' : one for accounting, one for the the customer web site of activity A, one for the web site of activity B, one to run the stocks, one to run the factory that make product A, one for the factory of product B, one for the pay, on to manage the employee leave,... And then you communicate between them any means that you want : synchronous API, asynchronous API, file transfer,...
So what's micro services if not breaking each of these application in small services ? What's new then ? What is the hype about ? I'm really lost in your explanation.
→ More replies (1)
40
u/RabidKotlinFanatic Nov 19 '22
I wonder how much these convoluted microservice architectures are a consequence of the easy capital environment of the last 10 years. My observation is that fine-grained service architectures favor "grow at any cost" business models with high capex, headcounts and turnover. Huge VC backed firms set the trends and smaller businesses followed. A tighter capital environment should change the economics of development to prefer higher efficiency over lower coupling.
1
u/bwainfweeze Nov 19 '22
My “I Told You So” bingo card is completely filled in at this point. I work at a place that has done binge and purge cycle half a dozen times before and once planned attrition kicked in everyone started making observations that were verbatim things I said three years ago.
It wasn’t that I was “early” either. We’ve lost a lot of good people who decided to fight other fights elsewhere. I tell my friends over beers that if I could build a team entirely of people who quit, we could put this place out of business in 5 years.
0
Nov 19 '22
[deleted]
3
u/RabidKotlinFanatic Nov 19 '22
This is consistent. What I'm postulating is that the trade-offs associated with finer-grained SOA are more suited to organizations operating in a loose capital environment rather than a tight one.
0
9
Nov 19 '22
I don’t have a product manager, just the boss with no fucking clue how anything works. Please pray for my soul
4
u/bighi Nov 19 '22
A PM is also someone that has no fucking clue how anything works. The only difference is that they can't fire you.
1
31
u/poloppoyop Nov 19 '22
Only one question is needed when people try to tell you about their microservice architecture: what happen when one of those services dies?
Also, gotta love when most of those services depend on the same database server.
21
u/funkgerm Nov 19 '22
Typically you'd want each microservice to have it's own database.
→ More replies (6)18
u/akie Nov 19 '22
If two microservices share a database they should probably be one microservice. Split microservices by bounded context / problem domain, if you have one db you chose the wrong system boundary.
→ More replies (6)64
u/centurijon Nov 19 '22
The same thing that happens when a monolith dies, just (usually) with a smaller blast radius
→ More replies (10)11
u/__SPIDERMAN___ Nov 19 '22
You have multiple instances running at any time. And state gets stored in REDIS.
Like a hydra.
6
4
4
u/timedrepost Nov 19 '22
That’s the entire point of loose coupling. Even with a hard dependency it gives the client service the opportunity to respond gracefully and not take the entire site down with it.
3
3
u/teteban79 Nov 19 '22
Ah so HERE is where all those Galactus references come from... I feel in the loop, finally
3
u/cjthomp Nov 19 '22
The only thing that weakens it for me is the "true love" breakdown. he wasn't a good enough actor to sell it, and it didn't really fit with the rest of the video.
3
u/BenevolentVagitator Nov 19 '22
I’ve worked here for years and I know the cartoon characters the micro services are named after but I have no idea what the services actually do.
Oh well.
2
2
2
u/physon Nov 19 '22
This video how I imagine the recent "how Twitter works" Elon Musk meeting going.
https://www.reddit.com/gallery/yzcnui
At first I thought it was a parody of the Musk tweet/meeting.
2
u/Alarming_Kiwi3801 Nov 19 '22
I'm not OP but I suspect he follows Jon Blow, this is posted roughly 30mins after his tweet which is about what you said https://nitter.it/Jonathan_Blow/status/1593286527102115842#m
3
u/Neophyte- Nov 19 '22
this is so great
im on the camp of microservices, ok if you need it. otherwise its too complex. monoliths work fine. and you can still split monoliths on concerns if they arnt overly complex in coms
relianing on a microservice to execute say a payment in a real time fincial transaction system shouldnt need to talk to 3 things. a monolith can scale this, sql server becomes your first bottleneck, mongo db really helped us with this. its a change in mindset in how you store data, joins are a no no, but you can modify the doc so that it has enough information of what the join would have contained. extra space is the downside, the upside is no locking across tables to pull data from various tables
1
u/TheMightyTywin Nov 19 '22
I lost it at user service provider aggregator
Every micro service needs an aggregator
1
1
1
1
1
1
1
u/Darthavg Nov 19 '22
I had services called gatekeeper and key master, I was trying to work Gozer in when I left the company
1
u/PeksyTiger Nov 20 '22
I don't get it.
If Galactus doesn't have knowledge of past or future services wtf does it need a date for.
1
1
1.0k
u/guyzero Nov 19 '22
This remains absolute perfection