노드, 에지, 방향
요청은 그래프의 경로입니다
요청이 만나는 각 구성 요소는 노드입니다: 클라이언트, DNS 해결기, CDN 에지, 역프록시, 백엔드 복제본, 데이터베이스, 캐시.
두 노드 사이의 연결은 방향 에지입니다: 요청은 전방향으로 흐르며, 응답은 후방향으로 흐르며. 전방향 에지는 개방 TCP 연결 및 위에 있는 프로토콜을 나타냅니다.
단일 요청은 이 그래프를 통한 경로입니다. 시스템이 요청을 처리하기 위해 수행하는 총 작업은 각 노드에서 수행되는 작업의 합과 각 에지의 레이턴시로 구성됩니다.
왜 중요할까요? 요청 그래프를 그린 후, 코드에서 가려진 속성이 눈에 띄게 됩니다:
- 홉 카운트: 경로에 있는 에지의 수. 각 홉은 레이턴시(네트워크 라운드 트립 + 노드 처리)를 추가합니다. 홉 수가 적을수록 레이턴시의 하한 값이 낮아집니다.
- 인-degree: 노드에 들어오는 에지의 수. 높은 인-degree는 노드가 많은 소스를 받고 스케일링하거나 자신을 보호해야 한다는 것을 의미합니다.
- 아웃-degree: 노드에서 나가는 에지의 수. 높은 아웃-degree는 노드가 많은 하위 스트림에 의존하고 여러 가지로 실패할 수 있다는 것을 의미합니다.
- 컷 정점: 그래프의 단일 노드의 제거로 그래프가 분리되는 경우입니다. 역프록시가 동료가 없는 경우 컷 정점입니다; 제거하면 원본에 대한 액세스도 제거됩니다.
교통이 집중되는 곳
Fan-In = Concentration
In-degree of a node = number of edges pointing into it. In a request graph, in-degree = number of upstream sources that send requests.
Fan-in pattern: many clients -> one CDN; many CDN edges -> few origin proxies; many proxies -> fewer backend replicas; many backends -> single database.
Concentration matters because the highest in-degree node sees the most aggregate load. The DB at the end of the chain may see queries from every active request in the entire system, even if no single user generates much.
Fan-Out = Dependency
Out-degree of a node = number of edges pointing out of it. High out-degree means many downstream dependencies.
A backend that calls a database, two caches, three external APIs, & a queue has out-degree 7. Its success probability is roughly the product of each downstream's success probability (if all are required for a successful response).
0.999 ^ 7 ≈ 0.993: a backend with 7 downstreams each at 99.9% reliability can only achieve ~99.3% reliability itself, even with no bugs of its own.
Reduce out-degree by: caching downstream results, making non-critical downstreams optional (graceful degradation), parallelizing what can be parallel.
The Asymmetry
Fan-in concentrates load; fan-out multiplies risk. A well-shaped graph minimizes both at the highest-impact nodes.
The database (highest fan-in): cache aggressively to reduce load. Read replicas to spread fan-in across multiple nodes.
The orchestrator service (highest fan-out): circuit breakers per dependency, graceful degradation, bulkheads.
Inserted Node Buys Flexibility
Indirection = Adding an Intermediate Node
Without a proxy, the graph is: client -> backend. The client must know about the backend's address. Moving the backend requires updating the client (via DNS or configuration). This is a tight binding.
With a proxy, the graph becomes: client -> proxy -> backend. The client knows only about the proxy. Moving the backend requires updating the proxy's upstream configuration, not the client.
The graph operation: insert a node along an existing edge. The new edge client -> proxy is stable; the new edge proxy -> backend is now the team's to manage.
Geometric reading: indirection adds a layer that decouples upstream change from downstream change. Each layer's edges can rewire independently.
Cost of Indirection
Each layer adds:
- One hop of latency (the edge from client to proxy)
- One more cut vertex on the path (the proxy itself)
- One more place where misconfiguration can happen
The benefits (rewire, scale, shield, terminate TLS, distribute load) usually outweigh the costs for any non-trivial system. But there is a limit: every indirection layer adds another hop & another SPOF candidate.
The folklore rule: any problem can be solved by adding a layer of indirection (except the problem of too many layers of indirection).
Read an Architecture as a Graph
Synthesis
You can now read a system architecture as a graph: count hops, identify cut vertices, measure fan-in concentration, compute availability ceilings from fan-out, & evaluate indirection trade-offs.
Apply all four.
새로운 서비스는 다음 아키텍처를 가지고 있습니다: 클라이언트 -> CDN -> 역프록시(2 개의 복제본) -> 백엔드 계층(8 개의 복제본) -> { DB 주, 캐시 클러스터(3 노드), 외부 API }.
보조 주석
보조 주석
이 기하학-lesson은 Proxies & Origins 주 lesson을 방향 그래프 분석으로 재조명합니다.
이 과목의 다음 보조, geometry_of_stateless_horizontal_scaling,는 메인 스케일링 lesson의 복제 수학에서 큐잉 곡선, Little's Law, 그리고 80% 활용률 무릎을 기하학적으로 도출합니다.
잘 했어요.