Files
2nd/10_Wiki/Topics/AI_and_ML/Architecture Anti-patterns.md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

7.0 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-architecture-anti-patterns Architecture Anti-patterns 10_Wiki/Topics verified self
아키텍처 안티패턴
design anti-patterns
distributed monolith
big ball of mud
none B 0.9 applied
architecture
anti-patterns
distributed-systems
microservices
adr
code-smell
technical-debt
2026-05-10 pending
language framework
language-agnostic any

Architecture Anti-patterns

📌 한 줄 통찰

"매 안 하면 좋은 것". 매 design 의 mistake catalog. 매 timeout misconfig, 매 distributed monolith, 매 big ball of mud. 매 anti-pattern 의 catalog 의 senior 의 첫 weapon.

📖 핵심

매 카테고리

Distributed system

  • Distributed monolith: 매 microservice 가 sync coupling — 매 worst of both.
  • Chatty service: 매 N+1 inter-service call.
  • Wrong timeout: 매 too short = false fail / too long = bad UX.
  • Shared database: 매 service 가 같은 DB → 매 coupling.
  • No circuit breaker: 매 cascading failure.
  • Synchronous chain: 매 5 service hop = 매 latency 합.

Decision-making

  • Analysis paralysis: 매 fear-driven indecision.
  • Forgotten decision: 매 email-only / 매 ADR 없음.
  • Premature optimization: 매 evidence X 의 optimize.
  • Cargo cult: 매 "Netflix 가 이렇게" 의 무비판 모방.

Code structure

  • Big ball of mud: 매 boundary X.
  • God object: 매 single class 의 모든 logic.
  • Anaemic model: 매 entity 가 data 만 (case-by-case).
  • Spaghetti: 매 control flow tangled.
  • Lava flow: 매 dead code + commented-out.

Microservice 특화

  • Nano-service: 매 너무 작 — 매 communication 의 logic 의 dominate.
  • Entity service: 매 1 entity = 1 service (vs business capability).
  • Sync everywhere: 매 async 의 부재.
  • No bounded context: 매 model 의 leak.
  • Versioning chaos: 매 breaking change 의 coordination X.

Data

  • Data in flight: 매 in-memory 의 single source of truth.
  • Eventual consistency 의 ignore: 매 user 의 see stale.
  • Cache stampede: 매 expire 시 동시 fetch.
  • Read-modify-write race: 매 lost update.

Sequence problem

  • 매 anti-pattern 의 fix 가 매 다른 anti-pattern 의 generate.
  • 매 distributed monolith 의 fix → 매 chatty / 매 sync chain.
  • 매 god object 의 split → 매 nano-service.

→ 매 trade-off awareness 의 핵심.

매 detect 방법

  • Architecture test: dependency-cruiser, ArchUnit.
  • Dependency graph: 매 cycle / 매 hub.
  • Latency analysis: 매 hop count.
  • Code metric: 매 cyclomatic / 매 LOC / 매 fan-out.
  • Tracing: 매 distributed trace 의 path.
  • Postmortem catalog: 매 incident pattern.

매 modern catalog

  • Mark Richards 의 "Software Architecture: The Hard Parts".
  • Sam Newman 의 "Building Microservices".
  • Vaughn Vernon "Implementing DDD".
  • AWS / Azure architecture pattern.

💻 패턴 (응용 — detection / fix)

Architecture test

// .dependency-cruiser.js
module.exports = {
  forbidden: [
    {
      name: 'no-domain-to-infrastructure',
      severity: 'error',
      from: { path: '^src/domain' },
      to: { path: '^src/infrastructure' },
    },
    {
      name: 'no-circular',
      severity: 'error',
      from: {},
      to: { circular: true },
    },
  ],
};

ADR (Architecture Decision Record) template

# ADR-0042: Use Kafka for inter-service events

## Status
Accepted (2026-05-10)

## Context
3 services (order, billing, inventory) need to coordinate.
Sync HTTP creates cascading failure risk.

## Decision
Adopt Kafka for async event-driven coordination.
Use Avro for schema evolution.

## Consequences
+ Decoupling, scale, replay.
- Operational complexity (Kafka cluster).
- Debugging async harder.

## Alternatives considered
1. RabbitMQ — simpler but less throughput.
2. SQS — vendor lock-in.
3. Sync HTTP — original problem.

Circuit breaker (anti-pattern fix)

class CircuitBreaker {
  state: 'closed' | 'open' | 'half-open' = 'closed';
  failures = 0;
  lastFailure = 0;
  
  async call<T>(fn: () => Promise<T>): Promise<T> {
    if (this.state === 'open') {
      if (Date.now() - this.lastFailure > 30_000) this.state = 'half-open';
      else throw new CircuitOpen();
    }
    try {
      const result = await fn();
      if (this.state === 'half-open') this.state = 'closed';
      this.failures = 0;
      return result;
    } catch (e) {
      this.failures++;
      this.lastFailure = Date.now();
      if (this.failures > 5) this.state = 'open';
      throw e;
    }
  }
}

Detect distributed monolith

def detect_distributed_monolith(services, traces):
    """매 sync coupling chain 의 detect"""
    for trace in traces:
        sync_chain = [s for s in trace.spans if s.kind == 'sync']
        if len(sync_chain) > 3:
            yield ('long sync chain', trace.id, sync_chain)
    
    # 매 deploy coupling
    deploy_pairs = collections.Counter()
    for incident in incidents:
        if len(incident.affected_services) > 1:
            for pair in combinations(incident.affected_services, 2):
                deploy_pairs[pair] += 1
    
    return deploy_pairs.most_common(5)

🤔 결정 기준

안티패턴 해결
Distributed monolith Async event + bounded context
Wrong timeout Tiered timeout + circuit breaker
Forgotten decision ADR + central wiki
Analysis paralysis Last responsible moment + spike
God object Refactor by responsibility
Nano-service Merge by business capability
Cache stampede Probabilistic refresh, lock

기본값: 매 ADR + architecture test + tracing + postmortem.

🔗 Graph

🤖 LLM 활용

언제: 매 architecture review. 매 design decision. 매 incident 의 root cause analysis. 언제 X: 매 simple project (대부분 의 anti-pattern 의 N/A).

안티패턴 (meta)

  • 모든 anti-pattern 의 fix: 매 trade-off 의 ignore.
  • Cargo cult: 매 "최선" 의 context 의 ignore.
  • No ADR: 매 future-self 의 confusion.
  • Architecture astronaut: 매 over-design.
  • YAGNI 의 무시: 매 future hypothetical 의 design.

🧪 검증 / 중복

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — 카테고리 + 매 distributed / decision / data + ADR + circuit breaker