KNOWLEDGE BASE

Blog Posts

Notes on distributed systems, system design, algorithms, and software engineering.

119 posts across 9 categories

Showing60 postsinSystemDesignDesign PatternsClear ×

Pattern: Access token

Send a scoped credential with requests to a resource server. The receiver verifies or introspects it and enforces audience, expiry, scope, and resource ownership.

2026-11-20

Pattern: Aggregate

Model a small cluster of domain objects with one root that enforces its invariants. Change the aggregate in a single local transaction when its rules require it.

2026-11-20

Pattern: Anti-corruption layer

Translate across models in an adapter that sits at the boundary. Map identifiers, states, and failures into meanings the receiving domain can use.

2026-11-20

Pattern: API Composition

Query the services that own the data and merge their responses for a caller. Run independent calls concurrently when possible and bound their cost.

2026-11-20

Pattern: API Gateway / Backends for Frontends

Provide a stable public entry point that routes to internal services and applies shared edge policies. Compose responses where the public contract needs several services.

2026-11-20

Pattern: Application metrics

Record counters, gauges, and distributions for meaningful behavior. Aggregate across replicas and alert on symptoms users can experience.

2026-11-20

Pattern: Audit logging

Keep a controlled record of security- or business-sensitive actions. Capture actor, action, target, time, and result with appropriate access rules.

2026-11-20

Pattern: Backends for Frontends

Let a client team own a backend that adapts shared service contracts to its interface and interaction model.

2026-11-20

Pattern: Circuit Breaker

Stop calling a failing dependency, then admit a limited number of calls to verify recovery.

2026-11-20

Pattern: Client-side service discovery

The caller obtains healthy endpoints from a service registry and picks a destination locally. Refresh discovery information while applying connection and retry policies.

2026-11-20

Pattern: Client-side UI composition

A browser shell loads and assembles independently owned interface modules. Agree on navigation, shared state, and isolation between modules.

2026-11-20

Pattern: Command-side replica

Replicate only the facts a command needs into the service that executes it. Update the local copy from an authoritative stream or snapshots.

2026-11-20

Pattern: Service Integration Contract Test (Consumer-driven)

Encode the interactions a consumer relies on and verify them against the provider implementation in the provider pipeline.

2026-11-20

Pattern: Service Integration Contract Test (Consumer-side)

Exercise the consumer’s adapter against a verified contract stub to check how it sends requests and interprets success and failure responses.

2026-11-20

Pattern: Command Query Responsibility Segregation (CQRS)

Use different models for commands and reads when their constraints differ. A projector can update read-optimized views from committed changes.

2026-11-20

Pattern: Database per service

Give one service authority over each data set. Enforce ownership with separate permissions or stores and expose changes through the service contract.

2026-11-20

Pattern: Decompose by business capability

Start with durable business outcomes and assign the behavior, rules, and data that deliver each one to a boundary.

2026-11-20

Pattern: Decompose by subdomain

Use domain language, rules, and invariants to decide where models should be independent. Translate data explicitly where the meaning changes between contexts.

2026-11-20

Pattern: Distributed tracing

Propagate trace context across process boundaries and record spans for individual operations. Group spans to see timing, causality, and errors across services.

2026-11-20

Pattern: Domain event

Represent a significant business change as an immutable fact. Include enough identity and version information for consumers to interpret it later.

2026-11-20

Pattern: Domain-specific protocol

Use an established protocol that matches the interaction’s domain, with an adapter when the rest of the system speaks a different contract.

2026-11-20

Pattern: Event sourcing

Store each accepted state change as an append-only event. Reconstruct current state by replaying an entity stream, with snapshots when replay gets expensive.

2026-11-20

Pattern: Exception tracking

Collect errors with runtime context and group similar failures into issues. Route changes in frequency or newly introduced failures to the responsible team.

2026-11-20

Pattern: Externalized configuration

Provide environment-specific settings at deployment or runtime. Keep artifacts portable, validate values, and retrieve secrets through an appropriate secret store.

2026-11-20

Pattern: Health Check API

Expose a lightweight endpoint for the checks infrastructure needs. Distinguish whether a process should be restarted from whether it can serve new traffic.

2026-11-20

Pattern: Idempotent Consumer

Make a replay of the same message leave the intended result unchanged. For local database effects, record the message or operation ID and update business state in one transaction.

2026-11-20

Pattern: Log aggregation

Ship structured logs from workloads to a centralized query system. Include stable service identifiers and trace context when available.

2026-11-20

Pattern: Log deployments and changes

Record deployments, configuration updates, and feature-flag changes as time-stamped operational events. Include the affected service, version, and scope.

2026-11-20

Pattern: Messaging

Send commands or publish facts through an intermediary. Producers finish after the required acknowledgement, while consumers process the message on their own schedule.

2026-11-20

Microservice Architecture pattern

Make business services independently deployable and let each service own its contracts and state. Callers communicate through explicit APIs or events.

2026-11-20

Pattern: Microservice chassis

Share a maintained runtime foundation for concerns such as health checks, telemetry, configuration, and request handling.

2026-11-20

Pattern: Monolithic Architecture

Keep business modules in one deployable application. Give each module a clear interface so it can own decisions and data without a network call.

2026-11-20

Pattern: Multiple service instances per host

Run several service instances on one machine. Isolate their processes, configuration, and resource budgets as much as the deployment model allows.

2026-11-20

Pattern: Polling publisher

A worker reads batches of unprocessed outbox rows, publishes them, and records progress. Coordinating workers must claim rows without dropping uncompleted work.

2026-11-20

Pattern: Remote Procedure Invocation (RPI)

Define a request and response contract that lets a caller invoke work across a service boundary. The caller waits for a result or an explicit failure within a deadline.

2026-11-20

Pattern: Saga

Coordinate several durable local transactions. Record progress and define compensating actions for earlier steps that remain reversible when a later step fails.

2026-11-20

Self-contained service

Arrange the synchronous request path so the service can make its decision with local information. Prepare a replica or accept work for asynchronous completion when needed.

2026-11-20

Pattern: Self Registration

Have each instance announce its address and renew a lease while it is ready. On a planned shutdown it drains and withdraws its entry.

2026-11-20

Pattern: Server-side service discovery

Call a stable service address. A proxy or platform load balancer discovers instances and chooses where to send each request.

2026-11-20

Pattern: Server-side page fragment composition

Assemble a page on the server from fragments owned by separate capabilities. Define the fragment interface, timeout, and fallback behavior.

2026-11-20

Pattern: Serverless deployment

Delegate instance provisioning and scaling to a provider. Bind execution to requests or events and keep durable state in managed stores.

2026-11-20

Pattern: Service Component Test

Start a service as a unit and drive it through its public API or event boundary. Substitute controllable implementations for remote dependencies.

2026-11-20

Pattern: Service deployment platform

Declare the desired replicas, resources, and rollout policies. Let a platform reconcile the desired state with actual instances and networking.

2026-11-20

Pattern: Service mesh

Use a data plane to mediate service-to-service traffic and a control plane to manage policy. The data plane can apply identity, routing, and traffic telemetry consistently.

2026-11-20

Pattern: Service instance per container

Bundle the application and userspace dependencies into an image. Start each replica in a container and have the platform apply runtime limits and health checks.

2026-11-20

Service per team

Choose boundaries that a team can build, release, and support end to end. Keep changes that routinely need coordination within a service the team can own.

2026-11-20

Pattern: Service Instance per VM

Package a service with its guest OS and boot one instance per virtual machine. Roll out changes by replacing instances from a versioned image.

2026-11-20

Pattern: Service registry

Keep a directory of instances and their addressing metadata. Retire entries when a lease expires or an authoritative health signal changes.

2026-11-20

Pattern: Service Template

Start a new service from a maintained project scaffold. Include the build, deployment, configuration, health, and basic test setup.

2026-11-20

Pattern: Shared database

Let more than one service use the same database schema where a common transaction or direct access is an intentional design constraint.

2026-11-20

Pattern: Sidecar

Deploy a companion process alongside each application instance. Share a narrow local interface so the companion can supply a supporting capability.

2026-11-20

Pattern: Single Service Instance per Host

Reserve each host for one service instance. Provision, replace, and scale hosts with that instance as the deployment unit.

2026-11-20

Pattern: Strangler application

Put a routing seam in front of a legacy capability. Reimplement a bounded slice, direct that slice to the new service, and retire the legacy branch after validation.

2026-11-20

Pattern: 3rd Party Registration

Use a scheduler, controller, or registrar to publish and remove service endpoints based on workload lifecycle and readiness.

2026-11-20

Pattern: Transaction log tailing

Read committed changes from a database change stream or replication log. Store an offset or position so the relay can resume after a restart.

2026-11-20

Pattern: Transactional outbox

Commit the business change and an event record in the same database transaction. A relay reads committed records and publishes them after the commit.

2026-11-20

System design basic - consistent hasing

consistent hasing

2025-04-11

System design basic - HTTP Request vs HTTP Long-Polling vs WebSocket vs Server-Sent Events

System design

2025-01-18

OOD learning

OOD

2023-11-14

Cross-Service Consistency with Two-Phase Commit, Sagas, and Outbox

Choose between a coordinated commit and local transactions with compensation using an order and inventory example.

2023-06-24