Architecture / 2 / 4
Service discovery
An orders service calls inventory instances that start, stop and move. How a registry with heartbeats replaces hard-coded IPs, and the three ways to ask it: from the client, through DNS, or through a load balancer.
- 11 min
- Intermediate
- 9 steps
- Failed stock calls
- 0.1 %
- Time to stop calling a dead instance
- —
- Live inventory instances
- 2
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
Orders service → Inventory ARequest
GET /v1/stock/sku_19 HTTP/1.1
Host1: 192.0.2.11:8080
Response
HTTP/1.1 200 OK
{
"sku": "sku_19",
"qty": 214
}
Host— A raw IP and port. The caller knows exactly which machine it is talking to.qty— 14 in stock. The order can go ahead.
Course: 42 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes