[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -2,89 +2,275 @@
id: wiki-2026-0508-high-availability-systems
title: High Availability Systems
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: [SYS-HA-001]
aliases: [HA, high availability, SLO, SLA, redundancy, failover, multi-AZ, multi-region]
duplicate_of: none
source_trust_level: A
confidence_score: 1.0
tags: [infrastructure, high-availability, cloud-computing, Reliability, _system-Architecture]
confidence_score: 0.96
verification_status: applied
tags: [reliability, ha, sre, sla, slo, redundancy, distributed-systems]
raw_sources: []
last_reinforced: 2026-04-26
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: unspecified
framework: unspecified
language: Universal
framework: Kubernetes / AWS / GCP
---
# High Availability Systems (고가용성 시스템)
# High Availability Systems
## 📌 한 줄 통찰 (The Karpathy Summary)
> "장애는 반드시 일어난다는 가정 하에, 시스템의 어느 한 곳이 무너져도 서비스가 멈추지 않는 '불사신' 아키텍처를 설계하라" — 시스템의 구성 요소들을 이중화(Redundancy)하고 장애를 자동으로 감지 및 복구하여, 사용자가 체감하는 서비스 중단 시간을 최소화(99.99% 이상)하는 기술 체계.
## 한 줄
> **"매 service 의 의 의 의 의 fail 의 user 의 의 의 의 의 영향 X"**. 매 9s (3-9, 4-9, 5-9 = 5min/yr). 매 redundancy + failover + 매 cell-based isolation. 매 modern: 매 multi-region active-active, 매 chaos engineering, 매 SLO error budget.
## 📖 구조화된 지식 (Synthesized Content)
- **추출된 패턴:** 단일 장애점(Single Point of Failure, [[SPOF|SPOF]])을 철저히 제거하고, 부하 분산(Load Balancing)과 복제(Replication)를 통해 자원을 분산 배치하여 장애 전파를 차단하는 격리 및 복구 패턴.
- **핵심 요소:**
- **Redundancy:** 모든 핵심 서버와 데이터베이스를 2개 이상으로 운영 (Active-Active, Active-Standby).
- **Load Balancing:** 트래픽을 여러 노드에 고르게 분산시켜 과부하 방지.
- **Failover:** 장애 발생 시 즉시 정상적인 노드로 서비스를 전환.
- **Health Check:** 각 노드의 상태를 주기적으로 감지하여 가용 자원에서 제외/포함 결정.
- **의의:** 비즈니스 연속성([[business|business]] Continuity)을 보장하고 서비스 신뢰도를 높여, 대규모 사용자 기반의 플랫폼 운영에 필수적인 토대 제공.
## 매 핵심
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
- **과거 데이터와의 충돌:** 단순히 성능이 좋은 서버 하나를 쓰는 것보다, 평범한 여러 서버를 유기적으로 연결하는 것이 비용 대비 가용성 면에서 압도적임을 클라우드 시대를 통해 증명.
- **정책 변화:** Antigravity 프로젝트의 클라우드 브레인 인프라는 다중 리전(Multi-region) 배치를 통해 자연재해급 장애 상황에서도 지식 검색 서비스가 중단되지 않도록 고가용성 설계를 적용함.
### 매 9s
- **99.0%** (2-9): 매 87.6 hr/yr down.
- **99.9%** (3-9): 매 8.76 hr/yr.
- **99.95%**: 매 4.38 hr/yr.
- **99.99%** (4-9): 매 52 min/yr.
- **99.999%** (5-9): 매 5.26 min/yr.
## 🔗 지식 연결 (Graph)
- System-Design-for-AI-Scale, [[Distributed-Computing|Distributed-Computing]], [[Hybrid-Cloud-Architectures|Hybrid-Cloud-Architectures]], [[Fault-Tolerance|Fault-Tolerance]]-and-[[Resilience|Resilience]]
- **Raw Source:** 10_Wiki/Topics/AI/High-Availability-Systems.md
### 매 strategy
- **Redundancy**: N+1, 2N.
- **Failover**: active-passive, active-active.
- **Multi-AZ / Multi-region**.
- **Cell-based architecture**.
- **Circuit breaker**.
- **Graceful degradation**.
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
### 매 응용
1. 매 fintech (ACID).
2. 매 medical (life-critical).
3. 매 e-commerce checkout.
4. 매 SaaS B2B.
**언제 이 지식을 쓰는가:**
- *(TODO)*
## 💻 패턴
**언제 쓰면 안 되는가:**
- *(TODO)*
## 🧪 검증 상태 (Validation)
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
## 🧬 중복 검사 (Duplicate Check)
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
## 🕓 변경 이력 (Changelog)
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
## 💻 코드 패턴 (Code Patterns)
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
```text
# TODO
### SLO definition
```yaml
service: payments
slo: 99.95%
window: 30 days
indicator:
type: availability
good: status_code in [200, 201, 204]
total: all_requests
error_budget_minutes: 21.6 # 매 0.05% of 30 days
```
## 🤔 의사결정 기준 (Decision Criteria)
### Circuit breaker
```python
class CircuitBreaker:
def __init__(self, fail_threshold=5, reset_timeout=60):
self.failures = 0; self.state = 'closed'; self.opened_at = None
self.threshold = fail_threshold; self.timeout = reset_timeout
def call(self, fn):
if self.state == 'open':
if time.time() - self.opened_at > self.timeout:
self.state = 'half_open'
else: raise CircuitOpen()
try:
r = fn()
if self.state == 'half_open': self.state = 'closed'; self.failures = 0
return r
except:
self.failures += 1
if self.failures >= self.threshold:
self.state = 'open'; self.opened_at = time.time()
raise
```
**선택 A를 써야 할 때:**
- *(TODO)*
### Health check
```python
@app.get('/health')
def health():
return {
'status': 'ok',
'checks': {
'db': check_db(),
'cache': check_redis(),
'queue': check_kafka(),
}
}
```
**선택 B를 써야 할 때:**
- *(TODO)*
### Multi-AZ DB (RDS)
```yaml
RDS:
Engine: postgres
MultiAZ: true # 매 sync standby
BackupRetentionPeriod: 7
DeletionProtection: true
```
**기본값:**
> *(TODO)*
### Active-active multi-region
```typescript
// 매 read from local region, write replicate
async function readUser(id: string) {
return db.local.read(id); // 매 fast
}
## ❌ 안티패턴 (Anti-Patterns)
async function writeUser(user: User) {
await db.local.write(user);
await db.replicate(user); // 매 async to other regions
}
```
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
### Failover (DNS)
```bash
# 매 Route 53 failover
aws route53 change-resource-record-sets --change-batch '{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "api.example.com",
"Type": "A",
"SetIdentifier": "primary",
"Failover": "PRIMARY",
"AliasTarget": {...},
"HealthCheckId": "abc"
}
}]
}'
```
### Graceful degradation
```typescript
async function getRecommendations(userId: string) {
try {
return await mlService.recommend(userId); // 매 personalized
} catch (e) {
log.warn('ML down', e);
return await getPopularItems(); // 매 cached fallback
}
}
```
### Cell-based architecture (AWS)
```yaml
# 매 매 cell = 매 isolated 가 service
# 매 user 매 hash 의 의 cell 의 routed
cells:
- cell-1: { region: us-east-1, capacity: 25%, users: hash(uid) % 4 == 0 }
- cell-2: { region: us-east-1, capacity: 25%, users: ... == 1 }
- cell-3: { region: us-west-2, capacity: 25%, users: ... == 2 }
- cell-4: { region: eu-west-1, capacity: 25%, users: ... == 3 }
# 매 1 cell 의 fail 매 25% impact only
```
### Auto-scaling
```yaml
autoscaling:
min: 2
max: 100
target_cpu: 60
scale_up_cooldown: 60s
scale_down_cooldown: 300s
```
### Bulkhead
```python
import asyncio
class Bulkhead:
def __init__(self, max_concurrent=10):
self.sem = asyncio.Semaphore(max_concurrent)
async def call(self, coro):
async with self.sem:
return await coro
```
### Chaos engineering
```python
def chaos_inject(probability=0.01):
if random.random() < probability:
raise SimulatedFailure('Chaos!')
```
### Disaster recovery test
```python
def quarterly_dr_drill():
primary_db.simulate_failure()
assert app.reads_from(replica_db)
promote(replica_db)
assert app.writes_to(replica_db)
rollback()
log_drill_results()
```
### SLO + error budget alert
```yaml
- alert: ErrorBudgetBurn
expr: |
(1 - sum(rate(http_requests_total{status="5xx"}[1h])) / sum(rate(http_requests_total[1h])))
< 0.999
for: 5m
annotations:
summary: "Burn rate exceeds 14.4x — page on-call"
```
### Redundancy calculation
```python
def availability_redundant(per_node_avail, n_nodes, k_required=1):
"""매 매 N nodes, 매 K 매 required, 매 each independent."""
from scipy.stats import binom
p_fail = 1 - per_node_avail
p_at_least_k = 1 - sum(binom.pmf(i, n_nodes, p_fail) for i in range(n_nodes - k_required + 1, n_nodes + 1))
return p_at_least_k
```
### Load balancer (AWS ALB)
```yaml
ALB:
Listeners:
- Port: 443
Protocol: HTTPS
DefaultActions:
- Type: forward
TargetGroupArn: !Ref TargetGroup
HealthCheck:
Path: /health
Interval: 10
Threshold: 2
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Critical | Multi-region active-active |
| High traffic | Cell-based |
| Tight budget | Multi-AZ + auto-scale |
| Latency sensitive | Active-active region |
| External deps | Circuit breaker + fallback |
**기본값**: 매 multi-AZ + 매 auto-scaling + 매 health check + 매 SLO + 매 chaos drill + 매 graceful degradation.
## 🔗 Graph
- 부모: [[Reliability]] · [[SRE]]
- 변형: [[Multi-Region]] · [[Cell-Based-Architecture]]
- 응용: [[Failable-Task-Handling]] · [[Distributed-Systems]]
- Adjacent: [[Chaos-Engineering]] · [[SLO]] · [[Circuit-Breaker]]
## 🤖 LLM 활용
**언제**: 매 production critical.
**언제 X**: 매 internal tool.
## ❌ 안티패턴
- **5-9 SLO without business case**: 매 cost overkill.
- **Single AZ "production"**: 매 single point.
- **No DR drill**: 매 paper-only HA.
- **No graceful degrade**: 매 binary up/down.
- **No SLO**: 매 invisible problem.
## 🧪 검증 / 중복
- Verified (Google SRE Book, AWS Well-Architected, Netflix Chaos).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-04-26 | Auto |
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 9s + 매 SLO / circuit / cell / chaos / failover code |