by FpUser · 6y ago · 0 comments
Long time ago when computers were slow I did design some distributed applications myself - reliable IP multicast server, business process servers, map reduce type solutions like bill generation etc where it did make sense. That was long time ago and now most of those at their old scale could run on a single reasonable priced server.
For smaller teams or small projects it isn't really super useful. Also, my personal experience is that when you start making microservices, the monolith doesn't go away. It also isn't so cumbersome if each team is in charge of one or a few services and you only split things if there's a clear benefit.
I'm probably saying things you already know. My point is that I think for multiple cooperating teams, monoliths and microservices are complementary.
Microservices (where it makes sense) + Macrorepos.
Microservices are really handy when you're at scale and/or the problem you're solving works well with the paradigm. I'm thinking back to a gig I had where each of our vendor integration points (sending the same data, just formatted for that vendor) was a good use case even for a smaller company. We used Scheduled tasks to launch the application that did what was basically an ETL.
Oh, that vendor is down? Great, just have the sysadmin stop the thing.
No database muckery required. No need to build a fancy front end. Easy to delegate to/train on helpdesk type folks.
But any microservice is part of a larger ecosystem. It's critical to have a workflow that doesn't make refactoring the domain a huge chore/lift. IOW: Keep the related microservices in a single repo.
Really, unless you've got a use case like the above (processes that need granular control) or HA/Scaling concerns (since in that case you'll be able to better focus on the parts that need to scale), A Monolith or domain based services are the way to try to go.
Take one example: The single server idea is going to suffer outages. You could at the very least have two monoliths either load balanced or in some kind of failover setup.
But, what distributing some of the components into so-called microservices would give you is a graceful failure scenario where even if all the instances of a specific component fail, the rest of the application still works. Maybe only one function stops working temporarily but most work continues on.
This doesn't mean everything must be microservice koolaid all the time all the way, but I'm sure you can conceive of that being an advantage under certain use cases that would be worth other possible trade-offs.
As you point out, there is nothing inherent in a monolith that makes it less robust. I currently am building a monolith that is deployed on auto-scaling servers on a cloud provider, so if one server dies it just spins up other instances.
I've also found that most so-called monoliths still often end up breaking apart components anyway. I've only seen true monoliths as described above in the mom and pop type IT shops where there's only a couple support staff and they don't have the resources or experience to properly break things out into separate resilient components. And yes supportability is definitely a valid part of that design call.
Again that was just one example of a potential advantage to it while admitting there are trade offs. Others here have given better examples such as at larger orgs where multiple independent teams get involved with a single app.
For particular usecases that fall out of the wheelhouse of my preferred language, I'll typically use single OpenFaaS functions + endpoints for these things (think doing ML with Python, or really heavy computation with Go/Rust).
This combination of containerized Mostly-Monolith with single-purpose endpoints for particular usecases works really well and is very productive. If something is much easier in another language (due to tooling/ecosystem) for example, then I can just build that method or sub-system out in whatever language it's fastest in with this architecture.
The important thing to note here is that microservices give you one way to build a graceful failure scenario. You don't get it for free. Often that 500 will propagate all the way back! So you have all the same failure modes + network failure modes!
You could also build a monolith that could handle component level failures, for that matter. Tooling doesn't seem to be as common, though.
The point being you don't need to be a paying subscriber to microservices(tm) to recognize there can be positives to the approach, which you describe in your last paragraph
A monolith that can handle component level failures is very close to the same idea infrastructure-wise minus a lot of baggage implied by the buzzword microservices.
Just curious, but how do you take advantage of the multiple cores? Are you using a language that handles concurrency directly, with something like threads? If you use a language that has historically been single threaded (Ruby, PHP, partially Python) do you use multiple processes? If you use multiple processes, what manages the processes? What can spin up additional processes? And when you talk about a "multicore monster" what are you actually running there, the application or the web server or both? If the web server runs elsewhere, how does it connect to the app? Do you have something else to load balance the web server itself?
I do not thing upgrading microservices is any simpler. It could actually be way way worse.
What you should be doing is telling people what they need to hear and let the biggest layers figure out for themselves that they don’t work that way.
But we want to know what the big people are doing as if that will let us become big too.
But the bulk of what we do is reacting to situations, not creating them.