Related book
Kubernetes Patterns
Detailed catalog of patterns for production deployments in K8s.
Designing Distributed Systems
Authors: Brendan Burns
Publisher: O'Reilly Media, 2018
Length: 162 pages
Patterns from Brendan Burns: sidecar, ambassador, scatter/gather, work queues and batch processing.
Original
TranslatedDocumentaries
Book structure
Single-Node Patterns
Patterns for one node: sidecar, ambassador, adapter. Composition of containers within a Pod.
Multi-Node Patterns
Serving patterns: replicated, sharded, scatter/gather. Scaling and fault tolerance.
Batch Patterns
Work queues, event-driven batch, coordinated processing. Patterns for data processing.
Single-Node Patterns
Patterns for organizing several containers on one node (in one Pod). Based on the principle of division of responsibility.
Sidecar Pattern
An additional container extends the functionality of the main application without changing its code.
Examples of use:
- Log shipping (Fluentd, Filebeat)
- Configuration sync (git-sync)
- SSL termination
Pod
Ambassador Pattern
A proxy container simplifies access to external services by hiding the complexity of the connection.
Examples of use:
- Database connection pooling
- Service mesh proxy (Envoy)
- Circuit breaker
Proxy hides connection details
Adapter Pattern
The adapter container converts the application's output to a standard format.
Examples of use:
- Prometheus exporter
- Log format normalization
- Legacy API wrapper
Normalization of formats and metrics
Multi-Node Serving Patterns
Deep Dive
Designing Data-Intensive Applications
Kleppmann about replication, partitioning and consistency.
Replicated Load-Balanced Services
Identical replicas for the load balancer. The simplest scaling pattern for stateless services.
Sharded Services
Data is divided between nodes by key. Each shard processes its own subset of data.
Sharding strategies:
- Hash-based (consistent hashing)
- Range-based (geographic, time)
- Directory-based (lookup table)
Challenges:
- Hot spots
- Rebalancing
- Cross-shard queries
Scatter/Gather Pattern
The request is distributed to all nodes in parallel, the results are aggregated.
Used in search engines, distributed databases, analytics.
Batch Computational Patterns
Related book
Building Microservices
Sam Newman about workflow orchestration and choreography.
Work Queue Systems
Producer-consumer pattern for parallel processing of tasks.
Source
Generates work items
Queue
Buffer between stages
Workers
Parallel processing
Event-Driven Batch Processing
Processing is triggered by events (new file, message in queue, webhook).
File upload / webhook / message queue
Coordinated Batch Processing
Multi-stage pipelines with dependencies between stages.
Implemented through workflow engines: Airflow, Argo Workflows, Temporal.
Ownership and Functions as a Service
Hands-Off Table
Responsibility matrix: who owns which system component. Critical for incident response and maintenance.
FaaS Decorator Pattern
Functions as decorators to add cross-cutting concerns: authentication, logging, rate limiting.
Decorators add cross-cutting concerns
Application at System Design interview
Useful Concepts
- Sidecar for cross-cutting concerns
- Ambassador for service mesh
- Sharded services for scale
- Scatter/Gather for search
- Work queues for batch processing
Questions where it will be useful
- “How to add logging without changing the code?”
- “How to scale a stateful service?”
- “How to implement distributed search?”
- “How to process millions of events?”
