One app or many services?
Step 1 · The pattern
One app: function calls, not network calls
The whole shop runs as one application. A checkout prices the basket, reserves stock, reads the customer's address and queues a receipt, all as function calls in one process. None of them can time out on the way. (All numbers are illustrative.)
- a checkout
- answered
In short
One app or many services?: how it works and how it breaks
Inside one application, a checkout that needs prices, stock and the customer's details makes function calls: fast, and they do not fail on their own. Split the application into services and each of those calls crosses the network. A network call can time out, hit a service mid-deploy, or wait behind someone else's slow request. One hop rarely does; a request that crosses five services in a row takes five chances, so the share of checkouts that fail, or that hit at least one slow call, grows with every hop on the path. Services are still worth it when teams need to deploy on their own or parts need to scale on their own. Split along those lines, not one service per table: keep the services a request must wait for few, and move work the user does not wait for, such as a receipt, onto a queue.
What this simulation simplifies
- Each network call here fails 3% of the time and is slow 8% of the time, far more than real calls inside a data centre, so the effect shows within seconds.
- There are no retries or timeouts in this picture; real clients retry, which wins back some failures at the cost of extra load and latency.
How this comes up in interviews
"When would you split a monolith into microservices, and what does it cost?"
Then they ask
- How does the number of services on a request's path affect its reliability?
- Where would you draw the boundaries?
- What would you move off the request path?
A strong answer covers
- Services buy independent deploys and scaling, usually for separate teams.
- Every split turns function calls into network calls that can fail, be slow, or be mid-deploy.
- A request that waits for n services in a row multiplies their failure chances and adds their latencies.
- Draw boundaries around business capabilities a team owns, not one per table.
- Keep the critical path short; publish events for work the user does not wait for.
Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.
On one page: the track cheat sheet.
Sources: Martin Fowler: Microservice trade-offs ↗ · Martin Fowler: Monolith first ↗ · Google SRE book: Service level objectives ↗ · Report a problem
Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.