Track cheat sheet
Monolith & microservices cheat sheet
When to split an app into services, what every split costs, and how services find each other without one shared thing taking them all down.
Key concepts
- One app or many services?
- Splitting an application into services turns function calls into network calls, each of which can fail or be slow.
- The database every service shares
- Services that share a database are still coupled: by its schema, which forces deploys in step, and by its capacity.
- How services find each other
- Service discovery keeps a current list of a service's instances, which change on every deploy, crash and scale-up.
- When discovery itself fails
- Service discovery is on the path of every call between services, so a registry outage can stop every service at once.
Decision rules
- Split where teams need to deploy or scale on their own, keep the services a request waits for few, and queue what the user does not wait for.
- Give each service its own data; others read it through its API or keep their own copy from the events it publishes.
- Keep a health-checked registry that clients follow, cap how long clients keep addresses and connections, and retry a refused connection on another instance.
- Fail static: keep using the last list that worked when the registry does not answer, and drop an instance only on direct evidence.
Common traps
- One service per table, so a single checkout waits for five network calls in a row and fails or stalls far more often.
- Splitting the code into services but leaving one database, so a schema change or a heavy report in one breaks another.
- Resolving a service's addresses once at startup, so a routine deploy leaves callers calling instances that are gone.
- Looking up every call, or caching for seconds, so an overloaded registry takes down services that are healthy.
Lessons and boss fights
- One app or many services? · 3 min
- The database every service shares · 3 min
- How services find each other · 3 min
- When discovery itself fails · 3 min
Real outages on this track: The proxy every call goes through · The dashboard that took DNS · Bigger boxes didn't help
BuildBreak · Monolith & microservices · each line comes from its lesson, where the sources are linked.