Microservice Architecture and Design Patterns Overview
This article explains the core goals of microservice architecture, outlines essential design principles, and presents a comprehensive catalog of decomposition and design patterns—including Strangler, Bulkhead, Sidecar, API Gateway, Aggregator, Proxy, Chained, Branch, UI composition, database strategies, CQRS, Event‑driven, Saga, observability, logging, metrics, tracing, health checks, external configuration, service discovery, circuit breaker, and blue‑green deployment—providing practical guidance for building resilient, scalable systems.
Microservices can positively impact enterprises, so understanding microservice architecture (MSA) and its design patterns is valuable. Four common goals of MSA are cost reduction, faster release, increased resilience, and improved visibility.
Key design principles include scalability, availability, resilience, flexibility, autonomy, decentralized governance, fault isolation, automatic provisioning, and continuous delivery via DevOps.
Decomposition Patterns
Decompose by business functionality, mapping services to specific business objects such as order management or customer management.
Decompose by problem domain using Domain‑Driven Design (DDD) sub‑domains: core, supporting, and generic.
Two‑phase commit (2PC) can be used for transactional decomposition but may be too slow for high‑load scenarios.
Design Patterns
Strangler Pattern : Replace a monolith with a new service by transforming, coexisting, and eventually eliminating the old system.
Bulkhead Pattern : Isolate components or pools to prevent failures from cascading across services.
Sidecar Pattern : Deploy auxiliary components alongside a service to provide isolation, encapsulation, and shared lifecycle.
Integration Pattern : Use an API gateway to route, aggregate, transform, and secure requests across multiple microservices.
Aggregator Pattern : Combine data from several services into a single response, either via a composite service or an API gateway.
Proxy Pattern : Proxy remote services to handle cross‑cutting concerns such as security and routing.
Chained Microservice Pattern : Services call each other synchronously in a chain to fulfill a request.
Branch Pattern : Mix aggregation and chaining to handle parallel calls to multiple services.
Client‑UI Composition Pattern : Build UI pages from multiple micro‑frontend components (e.g., Angular, React) each backed by its own service.
Database Patterns
Consider service‑per‑database, shared database (as a transitional approach for brownfield migrations), and the need for independent, loosely‑coupled data stores.
CQRS : Separate command (create, update, delete) and query responsibilities, often paired with event sourcing.
Event‑Driven Pattern : Record state changes as immutable events in an append‑only store, enabling materialized views and reactive processing.
Saga Pattern : Ensure data consistency across services using either choreography (event‑based) or orchestration (central coordinator) with compensating actions.
Observability Patterns
Log Aggregation : Centralize logs from all service instances for search and alerting.
Metrics : Push or pull performance data (e.g., New Relic, Prometheus) for monitoring and alerting.
Distributed Tracing : Propagate a trace ID across service calls to reconstruct end‑to‑end request flows.
Health Checks : Expose a /health endpoint that verifies service and dependency status.
Cross‑Cutting Concern Patterns : Include external configuration management, service discovery (client‑side like Netflix Eureka or server‑side like AWS ALB), circuit breaker (fail‑fast, fallback, recovery), and blue‑green deployment for zero‑downtime releases.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
