Microservices Patterns

作者 wshobson46891e7e60da無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Design microservices architectures with service boundaries, event-driven communication, and resilience patterns. Use when building distributed systems, decomposing monoliths, or implementing microservices.

AI 產生的概覽

指導微服務架構設計:服務拆分、通訊、資料管理與韌性模式。

功能
此技能為微服務系統設計提供架構指引。內容涵蓋服務拆分策略(依業務能力、領域驅動子領域、絞殺者模式)、同步與非同步通訊方式、每服務獨立資料庫與 Saga 資料管理,以及斷路器、退避重試、艙壁等韌性模式。它會指向一份參考檔案,內含詳細的模式說明與範例。
適用情境
適用於將單體拆分為微服務、定義服務邊界與契約,或選擇服務間通訊方式的場景。也適合處理分散式資料與交易、事件驅動架構、服務探索與負載平衡,以及建構具韌性的分散式系統。
執行需求
無需指令碼或特殊工具,僅為指令型技能。代理會讀取隨附的參考檔案,以取得詳細模式與範例。

Microservices Patterns

Master microservices architecture patterns including service boundaries, inter-service communication, data management, and resilience patterns for building distributed systems.

When to Use This Skill

  • Decomposing monoliths into microservices
  • Designing service boundaries and contracts
  • Implementing inter-service communication
  • Managing distributed data and transactions
  • Building resilient distributed systems
  • Implementing service discovery and load balancing
  • Designing event-driven architectures

Core Concepts

1. Service Decomposition Strategies

By Business Capability

  • Organize services around business functions
  • Each service owns its domain
  • Example: OrderService, PaymentService, InventoryService

By Subdomain (DDD)

  • Core domain, supporting subdomains
  • Bounded contexts map to services
  • Clear ownership and responsibility

Strangler Fig Pattern

  • Gradually extract from monolith
  • New functionality as microservices
  • Proxy routes to old/new systems

2. Communication Patterns

Synchronous (Request/Response)

  • REST APIs
  • gRPC
  • GraphQL

Asynchronous (Events/Messages)

  • Event streaming (Kafka)
  • Message queues (RabbitMQ, SQS)
  • Pub/Sub patterns

3. Data Management

Database Per Service

  • Each service owns its data
  • No shared databases
  • Loose coupling

Saga Pattern

  • Distributed transactions
  • Compensating actions
  • Eventual consistency

4. Resilience Patterns

Circuit Breaker

  • Fail fast on repeated errors
  • Prevent cascade failures

Retry with Backoff

  • Transient fault handling
  • Exponential backoff

Bulkhead

  • Isolate resources
  • Limit impact of failures

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

來源與署名

來源:wshobson/agents位於plugins/backend-development/skills/microservices-patterns提交46891e7

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架