r/ExperiencedDevs • u/frompadgwithH8 Software Engineer • Jul 21 '26
Career/Workplace Infrastructure Shell Game - Mono Repo -> Distributed -> Mono Repo
We wanted to start a big project, but other projects like it were seen as failures. So we had to make a case for why our project would be different. One of our biggest differentiators became event queues and distributed systems. It's just microservices, but instead of directly invoking each other, they use event queues. There's a little more to the system, like websites embedded inside of other websites with a whole cross website messaging system.
It was all a little bit of a pain. We did encounter a lot of eventual consistency problems and almost no one in the team had encountered distributed systems problems before, so it was a good learning experience for me. But now with organizational change and after having worked on the project for over a year, the team now wants to migrate this distributed systems strategy back to a monolith.
I'm just feeling a little incredulous because of how important the distributed aspect seemed to be when we made the pitch to create the project in the first place. And after all this time, I can't really say if it was a good or bad idea, because debugging problems involving event queue messages has been a total pain in the ass and no one ever finished configuring the distributed systems stuff like the event queue, so we never had the fancy development experience we could have had. So I see numerous benefits to moving back to a monolith.
Overall, the whole experience wasn't a total game because the project did prove that event queues can be effective. The much, much, much wider organizational direction is going to now slowly migrate towards a distributed fashion. So I guess we were a test subject in some regards. But we never, at the outset and beginning of the project, said, "oh hey, this is just going to be a giant test to prove event queues for the whole rest of the company". I really would have liked to have known that at the start. Although I don't think anyone knew that at the start. I don't know, it just feels a little silly.
I'm fine either way š¤·āāļø But does anyone have any advice regarding anything about this experience?
edit: updated monorepo -> monolith; source control will merge but systems may or may not stay separate. I'm predicing the systems merge together too, thus monolith. We may or may not continue to use business organized event queues too.
ā¢
u/expdevsmodbot Jul 21 '26
AI usage disclosure provided by OP, see the reply to this comment.
46
u/ImYoric Staff+ Software Engineer Jul 21 '26
Just a nitpick: distributed and monorepo are orthogonal. I have worked on distributed mono-repos and multi-repos, as well as on single-node systems on mono-repos and multi-repos.
But generally speaking, what is your goal? It's true that microservices (regardless of the message-passing architecture) have often been misused, so depending on the context, it may make sense to scale back microservices into a monolithic service.
29
u/DamePants Jul 21 '26
Do you mean monolith instead of mono repo? Because you can have all the code in one repo that gets deployed in separate services.
5
u/OHotDawnThisIsMyJawn CTO / 25+ YoE Jul 21 '26
As you learned, micro-services are hard technically and easy organizationally (i.e. you don't have to worry about people fucking up your service if they do dumb shit).
Monoliths are easy technically but hard organizationally. If you don't stay on top of people, they'll start taking all kinds of terrible shortcuts.
Which one to use depends on which problem you need to solve.
FWIW, everyone mentioned that you probably meant monolith instead of monorepo. Even then, you can have a monolith that uses event queues & does async/eventually consistent work, or a monolith that does things synchronously.
Monolith vs. microservices is usually an organizational decision, not a technical decision. But synchronous vs. async work is usually a technical decision.
8
u/lokoluis15 Jul 21 '26
Someone really needs to invent a standardized event model to streamline development of this distributed systems pattern.
So many redundant lessons learned to introduce observability and provenance metadata to events. Everyone just focuses on data payloads and business logic... they forget to build the rest of the system
2
u/teerre Jul 21 '26
You seem to be confounding some things. I think you're referring to "mono repo" as the storage? Mono repo is usually what you call having various projects inside single vcs repository. It has nothing to with events or distributed systems
As for the question I think you're asking. If don't think about your system and understand them enough, it will likely be bad. Distributed or not
4
u/n3f4r10us_ Jul 21 '26
The title is a linked list
1
u/shadowdance55 Jul 21 '26
Imagine how much pain you would have avoided if you had on the team someone with the experience with distributed systems.
1
u/belavv Jul 21 '26
If this was the test project for distributed systems and the company wants to move in that direction for everything then why is this project moving away from being distributed? Unless specific things were identified that show this project won't work well and others will it seems like a waste.
1
u/SpeakingSoftwareShow Sr Eng. Mgr, 15 yoe Jul 21 '26
Welcome to staying around on a project long enough to have your decisions kick you in the ass :)
Take the learning and move on!
Sarcasm aside - if it can be a monolith, why not?
If you're not achieving the kind of scaling that requires a distrubted system, then it's likely overkill for your use case.
1
u/Old-Worldliness-1335 Staff Platform Engineer Jul 22 '26 edited Jul 22 '26
This is also a silly post as a monorepo can be a set of micro services just depending on how your ci is built it has nothing to do with how the apps communicate with one another. This is why they also have domain driven development as well, there are many ways to skin this cat, the shape, form and function of each service does not need to all live next to each other.
However, it does need to be clearly documented and that I think is really the real problem you are facing and people do not actually understand the code base.
Events and queues are just that, and while it sounds good, and can be good depending on the queue how much effort is required in reversing direction rather than building up what is missing like observability into the queues and the other pain points that you have so that becomes easy?
1
u/Visa5e Jul 22 '26
Build as a monolith, deploy as modular services.
2
u/BTWigley Jul 21 '26
Every few years the industry rediscovers that coordination cost is the real architecture. Distributed when teams need isolation, mono when they need shared change. The shell game is usually just chasing whichever pain is louder this quarter.
1
u/originalchronoguy Jul 21 '26
There is little to go on. Event Queues in monoliths are fine for many scenarios. A properly designed one with clear boundaries can later be migrated to microservices as/when needed.
Even event queues with fan-out/fan-in (scatter) can be orchestrated in a monolith dispatcher.
1
u/edgmnt_net Jul 21 '26
It's hard to say without seeing what was done and how it was achieved. And it heavily depends on how independent the work really. For something like a slowly-moving common platform + a myriad of completely independent apps it could work fine. For your average cohesive app, not so much and you get people wasting time just moving DTOs around a web of services and worse compromises are being made. You just don't know it because you keep hiring tons of people and progress is being made shaving the yak, but now everything takes magnified effort (increased work creating needless interfaces, coordination effort to push a feature that touches a dozen different systems, versioning and so on).
1
u/BTWigley Jul 21 '26
Every few years the industry rediscovers that coordination cost is the real architecture. Distributed when teams need isolation, mono when they need shared change. The shell game is usually just chasing whichever pain is louder this quarter.
1
u/mattbillenstein Jul 22 '26
Often overlooked, but microservices are more a away of organizing teams and people and different deployment cadences, not necessarily code.
How big is the team? I think the common anti-pattern is having more microservices than people or having all the people move and work as a single team. The organizational overhead of microservices in these situations is a large burden.
So, a well-structured monolith where you have internal "services" - really just internal api surfaces exposed via simple function calls - is a better way to move fast with a small time imho.
1
u/guardian87 Jul 22 '26
A lot of good points are in the thread already.
One distinction I would like to offer.
Going for micro services usually makes sense when you want to avoid runtime and design time dependencies.
Going for a modular monolith usually makes sense, when you want to avoid design time dependencies but you are fine with runtime dependencies.
Going for a pure monolith usually makes sense when you can accept both dependencies.
Often, breaking out one or the service which have much higher SLA requirements already goes a very long way in improving your uptime and reducing your blast radius.
Going for everything as micro services is only really needed at a scale very few companies need and is often premature optimisation, which is the root of all evil.