KNOWLEDGE BASE
Blog Posts
Notes on distributed systems, system design, algorithms, and software engineering.
119 posts across 9 categories
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.
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.
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.
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.
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.
Pattern: Application metrics
Record counters, gauges, and distributions for meaningful behavior. Aggregate across replicas and alert on symptoms users can experience.
Pattern: Audit logging
Keep a controlled record of security- or business-sensitive actions. Capture actor, action, target, time, and result with appropriate access rules.
Pattern: Backends for Frontends
Let a client team own a backend that adapts shared service contracts to its interface and interaction model.
Pattern: Circuit Breaker
Stop calling a failing dependency, then admit a limited number of calls to verify recovery.
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.
Pattern: Client-side UI composition
A browser shell loads and assembles independently owned interface modules. Agree on navigation, shared state, and isolation between modules.
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.
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.
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.
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.
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.
Pattern: Decompose by business capability
Start with durable business outcomes and assign the behavior, rules, and data that deliver each one to a boundary.
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.
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.
Pattern: Domain event
Represent a significant business change as an immutable fact. Include enough identity and version information for consumers to interpret it later.
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.
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.
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.
Pattern: Externalized configuration
Provide environment-specific settings at deployment or runtime. Keep artifacts portable, validate values, and retrieve secrets through an appropriate secret store.
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.
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.
Pattern: Log aggregation
Ship structured logs from workloads to a centralized query system. Include stable service identifiers and trace context when available.
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.
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.
Microservice Architecture pattern
Make business services independently deployable and let each service own its contracts and state. Callers communicate through explicit APIs or events.
Pattern: Microservice chassis
Share a maintained runtime foundation for concerns such as health checks, telemetry, configuration, and request handling.
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.
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.
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.
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.
Pattern: Saga
Coordinate several durable local transactions. Record progress and define compensating actions for earlier steps that remain reversible when a later step fails.
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.
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.
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.
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.
Pattern: Serverless deployment
Delegate instance provisioning and scaling to a provider. Bind execution to requests or events and keep durable state in managed stores.
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.
Pattern: Service deployment platform
Declare the desired replicas, resources, and rollout policies. Let a platform reconcile the desired state with actual instances and networking.
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.
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.
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.
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.
Pattern: Service registry
Keep a directory of instances and their addressing metadata. Retire entries when a lease expires or an authoritative health signal changes.
Pattern: Service Template
Start a new service from a maintained project scaffold. Include the build, deployment, configuration, health, and basic test setup.
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.
Pattern: Sidecar
Deploy a companion process alongside each application instance. Share a narrow local interface so the companion can supply a supporting capability.
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.
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.
Pattern: 3rd Party Registration
Use a scheduler, controller, or registrar to publish and remove service endpoints based on workload lifecycle and readiness.
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.
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.
System design basic - consistent hasing
consistent hasing
System design basic - HTTP Request vs HTTP Long-Polling vs WebSocket vs Server-Sent Events
System design
OOD learning
OOD
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.