Files
2nd/10_Wiki/Topic_Programming/Architecture/Distributed Systems Fallacies.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

192 lines
6.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: wiki-2026-0508-distributed-systems-fallacies
title: Distributed Systems Fallacies
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Fallacies of Distributed Computing, 8 Fallacies, Deutsch Fallacies]
duplicate_of: none
source_trust_level: A
confidence_score: 0.95
verification_status: applied
tags: [distributed-systems, architecture, networking, reliability]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: polyglot
framework: distributed-systems
---
# Distributed Systems Fallacies
## 매 한 줄
> **"매 network 의 invisible 한 assumption 의 매 production failure 의 source"**. 1994년 Peter Deutsch (Sun) 가 매 7 fallacies 의 articulate, 1997년 James Gosling 가 8th 의 add. 매 2026 cloud-native 시대 에도 매 microservices / serverless / edge compute 의 매 매 valid.
## 매 핵심
### 매 8 Fallacies
1. **Network 의 reliable**: 매 packet drop / partition / DNS failure 의 inevitable.
2. **Latency 의 zero**: 매 LAN ~0.5ms, 매 cross-region ~150ms, 매 satellite ~600ms.
3. **Bandwidth 의 infinite**: 매 video / ML model weights / log shipping 의 saturate.
4. **Network 의 secure**: 매 default 의 insecure — 매 zero-trust assume.
5. **Topology 의 안 변함**: 매 autoscaling / k8s pod reschedule / failover 의 매 second.
6. **Administrator 의 single**: 매 multi-cloud / multi-region 의 매 다른 policy.
7. **Transport cost 의 zero**: 매 serialization / TLS handshake / egress fee 의 real.
8. **Network 의 homogeneous**: 매 IPv4/IPv6, 매 protocol versions, 매 MTU mismatch.
### 매 왜 fallacy 인가
- 매 dev 의 localhost / monolith mental model 의 distributed 에 적용 시 fail.
- 매 "happy path" coding 의 매 timeout / retry / circuit breaker 의 lack.
- 매 50ms RTT 의 매 100 calls 의 5 second user-facing latency.
### 매 응용
1. Microservices design — 매 call graph 의 latency budget 산정.
2. Cross-region replication — 매 split-brain / eventual consistency 의 plan.
3. Edge computing — 매 intermittent connectivity 의 first-class.
## 💻 패턴
### Pattern 1: Timeout + Retry with Exponential Backoff
```typescript
async function callWithRetry<T>(
fn: () => Promise<T>,
opts = { maxRetries: 3, baseMs: 100, timeoutMs: 2000 }
): Promise<T> {
for (let attempt = 0; attempt <= opts.maxRetries; attempt++) {
try {
return await Promise.race([
fn(),
new Promise<never>((_, reject) =>
setTimeout(() => reject(new Error("timeout")), opts.timeoutMs)
),
]);
} catch (err) {
if (attempt === opts.maxRetries) throw err;
const jitter = Math.random() * opts.baseMs;
await new Promise(r => setTimeout(r, opts.baseMs * 2 ** attempt + jitter));
}
}
throw new Error("unreachable");
}
```
### Pattern 2: Circuit Breaker (Resilience4j-style)
```typescript
class CircuitBreaker {
private failures = 0;
private state: "closed" | "open" | "half-open" = "closed";
private openedAt = 0;
constructor(private threshold = 5, private cooldownMs = 30_000) {}
async exec<T>(fn: () => Promise<T>): Promise<T> {
if (this.state === "open" && Date.now() - this.openedAt < this.cooldownMs)
throw new Error("circuit open");
if (this.state === "open") this.state = "half-open";
try {
const r = await fn();
this.failures = 0; this.state = "closed";
return r;
} catch (e) {
if (++this.failures >= this.threshold) {
this.state = "open"; this.openedAt = Date.now();
}
throw e;
}
}
}
```
### Pattern 3: Bulkhead (concurrency limiter)
```typescript
import pLimit from "p-limit";
const dbLimit = pLimit(20); // 매 DB pool 의 isolate
const apiLimit = pLimit(50); // 매 external API 의 separate
async function getUser(id: string) {
return dbLimit(() => db.users.findOne({ id }));
}
```
### Pattern 4: Idempotency Key
```typescript
async function chargeCard(req: ChargeReq, idemKey: string) {
const cached = await redis.get(`idem:${idemKey}`);
if (cached) return JSON.parse(cached);
const result = await stripe.charges.create(req);
await redis.setex(`idem:${idemKey}`, 86400, JSON.stringify(result));
return result;
}
```
### Pattern 5: Latency Budget
```typescript
// 매 user-facing 200ms 의 budget
// API gateway: 20ms
// auth check: 10ms (cached)
// service call: 50ms (timeout 100ms)
// DB query: 30ms (timeout 80ms)
// serialization: 10ms
// buffer: 80ms
// 매 each hop 의 explicit budget — over 시 fail fast.
```
### Pattern 6: Chaos Testing (Toxiproxy)
```bash
# 매 latency injection
toxiproxy-cli toxic add api -t latency -a latency=500 -a jitter=100
# 매 packet loss
toxiproxy-cli toxic add db -t timeout -a timeout=2000
```
### Pattern 7: Health check with deep probe
```typescript
app.get("/health/deep", async (_, res) => {
const checks = await Promise.allSettled([
db.raw("SELECT 1").then(() => ({ db: "ok" })),
redis.ping().then(() => ({ redis: "ok" })),
fetch(upstream + "/health", { signal: AbortSignal.timeout(500) }),
]);
const failed = checks.filter(c => c.status === "rejected");
res.status(failed.length ? 503 : 200).json({ checks });
});
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| LAN microservice call | timeout 1-2s, retry 2x |
| Cross-region call | timeout 5-10s, circuit breaker |
| 3rd-party API | bulkhead + circuit breaker + idempotency |
| Streaming / WebSocket | heartbeat + auto-reconnect |
| Critical write | idempotency key 의 mandatory |
**기본값**: 매 every remote call 의 timeout + retry + circuit breaker 의 wrap.
## 🔗 Graph
- 부모: [[Distributed Systems]] · [[Software Architecture]]
- 변형: [[CAP Theorem & PACELC]] · [[PACELC]]
- 응용: [[Microservices Architecture]] · [[Service Mesh]]
- Adjacent: [[Resilience Patterns]] · [[Chaos Engineering]]
## 🤖 LLM 활용
**언제**: 매 distributed system design review, 매 incident postmortem, 매 SLO 산정.
**언제 X**: 매 single-process monolith, 매 batch job 의 isolated.
## ❌ 안티패턴
- **Infinite retry**: 매 retry storm — 매 backoff + max attempts 의 mandatory.
- **Timeout 의 unset**: 매 default infinite — 매 thread pool exhaustion.
- **Synchronous fan-out**: 매 N services 의 sequential await — 매 N×latency.
- **Trust LAN security**: 매 zero-trust / mTLS 의 default.
- **Ignore tail latency**: 매 p50 의 보고 의 — 매 p99 / p99.9 의 user experience.
## 🧪 검증 / 중복
- Verified (Deutsch 1994 / Gosling 1997 original list, AWS Builders' Library, Google SRE book).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 8 fallacies + resilience patterns |