系統設計模式 System Design Pattern

持續更新

Design Pattern

  1. Layered architecture
  2. Event-driven architecture
  3. Microkernel architecture (or Plugin architecture)
  4. Microservices architecture
  5. Space-based architecture (or Cloud architecture pattern)

Layered architecture

最常使用在 monolithic 應用程式的架構,基本的概念是將應用程式的邏輯拆分成各個有各自角色的層級。例如 Persistence layer,將會負責應用程式和資料庫之間的溝通

Layered architecture pattern

Event-driven architecture

此模式的概念是將應用程式邏輯解耦成非同步接收和處理事件的單一用途的事件處理元件。

Event-driven architecture mediator topology

Microkernel Architecture

此模式的設計方式是拆分兩個主要的元件:核心系統和套件模組。舉例來說就像是瀏覽器和相關的 extensions。

Microkernel architecture pattern

Microservices Architecture

現行最流行的設計模式,全部的系統由數個服務所組成,其每個服務都只負責一件事情。每個服務之間都各自獨立

Basic Microservices architecture pattern

API REST-based topology

Application REST-based topology

Centralized messaging topology

Space-Based Architecture

其主要概念是以分散式系統之下,共享記憶體。

Space-based architecture pattern

微服務系統設計 Best Practices

  1. Single Responsibility Principle
  2. Have a separate data store(s) for your microservice
  3. Use asynchronous communication to achieve loose coupling
  4. Fail fast by using a circuit breaker to achieve fault tolerance
  5. Proxy your microservice requests through an API Gateway
  6. Ensure your API changes are backwards compatible
  7. Version your microservices for breaking changes
  8. Have dedicated infrastructure hosting your microservice
  9. Create a separate release train
  10. Create Organizational Efficiencies

Reference