노드, 에지, 방향
요청으로 그래프를 걸어다니는 것
요청이 만나는 각 구성 요소마다 노드입니다: 클라이언트, DNS 해결기, CDN 에지, 역 프록시, 백엔드 복제본, 데이터베이스, 캐시.
노드 간 두 노드 사이의 연결은 지향 에지입니다: 요청은 전방향으로 흐르며, 응답은 후방향으로 흐르며. 전방향 에지는 열린 TCP 연결과 위에 있는 프로토콜을 나타냅니다.
단일 요청은 이 그래프를 통해 경로입니다. 시스템이 요청을 처리하기 위해 수행하는 총 작업은 각 노드에서 수행하는 작업의 합과 각 에지의 레이턴시를 포함합니다.
왜 신경 써야 할까요? 그래프를 그릴 때, 코드에서 보다못할 것인 속성이 눈에 띄게 나타납니다:
- Hop count: 경로에 있는 에지의 수. 각 홉은 레이턴시를 추가합니다(네트워크 라운드 트립 + 노드 처리). 홉 수가 적으면 레이턴시의 낮은 바닥이 있습니다.
- In-degree: 노드에 들어오는 에지의 수. 높은 인-디그리면 노드가 여러 원천에서 요청을 받고 스케일링하거나 보호해야 합니다.
- Out-degree: 노드에서 나가는 에지의 수. 높은 아웃-디그리면 노드가 많은 하류에 의존하고 여러 가지 방식으로 실패할 수 있습니다.
- Cut vertex: 그래프의 단일 노드 중 하나로 그래프가 분리되는 경우가 있습니다. 역 프록시에서 한 번의 피어를 사용하지 않으면 쪼개진 꼭짓점입니다; 이를 제거하면 원본에 대한 모든 액세스가 제거됩니다.
교통이 집중되는 곳
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.
추가 노드가 유연성을 구매한다
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 }.
보조 주석
보조 주석
이 기하학-수업은 Proxies & Origins 주 수업을 직접 그래프 분석으로 재조명합니다.
다음 보조 수업인 geometry_of_stateless_horizontal_scaling은 주 대규모 수업에서 복제 수학을 가져와 큐잉 곡선, Little's Law, 그리고 80% 활용률 무릎을 기하학적으로 파생합니다.
잘 했어요.