> Aside: I was reading earlier today about how Uber heavily uses microservices. I wonder if Uber could be a monolith running on one machine given the right architecture and implementation.
Throughput-wise, that might be possible for all I know.
For latency reasons, you'd probably want to have at least one monolith per city. Similar objections apply for redundancy and resilience.
Splitting your system into individual services ensures that there are well-defined interfaces between the different parts.
In principle, you can always wring more performance out of a system, if you are allowed to break down these interfaces. But that makes maintaining and further developing these systems harder and harder to do for mere mortals.
Have a look at how much of a kludgy mess our genome is for an example.
---
In principle, you could write something as individual services but compile them into a single binary that runs in a single memory space on bare metal (see unikernel architecture). A sufficiently strong type system could make sure that any one service being buggy wouldn't bring down the rest of the application.
You could probably even work on a system like the above that still allows you to replace individual parts without restarting everything else.
This could be much faster and smaller than traditional micro-services that live in separated processes or even machines, but even this utopian system would still be hampered by the conceptual walls between services that can only talk to each other via well-defined interfaces. (Even if your compiler is smart enough to do a lot of inlining etc.)
---
The discussion reminds me of exokernels. Have you heard of them?
Basically the idea is that traditionally operating systems are supposed to have at least two functions: abstract hardware, and safely multiplex different uses and users.
Serving two masters means serving neither of them well.
So the exokernel people say: let's just use libraries for abstracting over hardwarde, and let the operating system present the hardware as raw as possible and concentrate on safely multiplexing.
See eg https://www.classes.cs.uchicago.edu/archive/2019/winter/3310...