P.01Gossip Protocols Explained: How Clusters Spread News
How gossip protocols spread state across a cluster in log(N) rounds, why Cassandra and Consul use them, and a 20-line simulation you can run yourself.
Tag
88 articles tagged #Architecture.
P.01How gossip protocols spread state across a cluster in log(N) rounds, why Cassandra and Consul use them, and a 20-line simulation you can run yourself.
P.02Two-phase commit makes several databases commit or abort together. How prepare and commit work, why a coordinator crash blocks you, and Postgres examples.
P.03MVCC keeps several versions of each row so reads never wait on writes. See xmin and xmax in a live Postgres session, and why long transactions cause bloat.
P.04Your p99 is slower than your average suggests, and fan-out makes it worse. How hedged requests and load shedding cut tail latency, with TypeScript code.
P.05An LSM tree turns random writes into sequential ones by buffering in memory and merging sorted files. How it works, what compaction costs, and when to pick it.
P.06Postgres LISTEN/NOTIFY pushes events to connected clients with no extra infrastructure. Working Node.js code, a trigger, and the limits that bite in production.
P.07A write-ahead log makes a database durable by recording changes before touching data files. How WAL commits, recovers, replicates, and what it trades.
P.08When a popular cache key expires, every waiting request hits your database at once. Here's why that happens and four real ways to stop it.
P.09Signals are the reactivity model behind Angular, Vue, Solid, and Svelte 5. Here's how they actually work, and the TC39 proposal to standardize them.
P.10A practical RBAC pattern for Node.js and Postgres: roles, permissions, a middleware that checks both, and the traps that turn clean RBAC into unmaintainable spaghetti.
P.11Cron jobs fail in three specific ways in production: overlapping runs, missed runs after downtime, and silent failures nobody notices. Here's how to close all three.
P.12Offset pagination breaks under concurrent writes and gets slower on every page. Cursor pagination fixes both, at the cost of features you might actually need.
P.13A staff engineer is scoped by impact across teams, not seniority. Here is how to screen for that instead of promoting your best senior engineer.
P.14Shared database or one per customer? Most SaaS teams pick wrong for their stage and pay later. How the three patterns trade off, and which one you need.
P.15TEEs encrypt data even from the cloud provider running it, which is why confidential computing became a real AI requirement. What it does and doesn't cover.
P.16Spec-driven development treats a written spec, not code, as the artifact an AI agent builds from. How Spec Kit, Kiro, and BMAD differ, and when it's worth it.
P.17Cloudflare logged 13 incidents between August 7 and 14, touching R2, Durable Objects, and Workers KV. What that means for building on one edge provider.
P.18Random UUIDs wreck index locality; auto-increment leaks counts and won't shard. What UUIDv7, ULID, and Snowflake each give you, and the real tradeoffs.
P.19Two writes hit different replicas at once. Which came first? Sometimes neither. How vector clocks tell a real conflict from a false one, without wall time.
P.20Polling misses deletes, adds load, and always lags. CDC reads the write-ahead log instead, turning every insert, update, and delete into an event stream.
P.21Plain mod-N hashing reshuffles almost every key when you add a server. Consistent hashing moves roughly 1/N instead. Working code and a real simulation.
P.22Three tools solve three different versions of "this query is slow." How materialized views, read replicas, and caches differ, and how to pick one.
P.23A Merkle tree proves a piece of data belongs to a large dataset, or finds exactly what changed between copies, without reading all of it. How, and where.
P.24A Bloom filter answers one question in almost no memory: is this definitely absent, or possibly present. How it works, and why false positives are a feature.
P.25Run three copies of a service and only one should do certain jobs. How leader election works, from Raft's term voting to the etcd lease pattern teams use.
P.26A webhook receiver has to trust a request it can't control the timing, order, or count of. Verifying signatures, handling retries, surviving delivery chaos.
P.27When production outruns consumption, a system must buffer, drop, or push back. How backpressure works across queues, streams, and APIs, with patterns.
P.28Integration tests that boot every dependency are slow and flaky. Contract testing checks that consumer and provider agree on a shape without either running.
P.29A message that fails every retry shouldn't loop forever or vanish. How dead letter queues catch it, how to set retry limits, and the reprocessing workflow.
P.30One checkout request touches five services and nobody knows which is slow. How trace IDs, spans, and context propagation fix that, with OpenTelemetry code.
P.31An SLA is a promise with a penalty. An SLO is the internal target that keeps you inside it. An error budget is what's left. The math, on a real example.
P.32A circuit breaker stops calls to a failed service. A bulkhead stops a merely slow one from eating every thread and starving the rest of your app.
P.33Four philosophies for one problem: moving a schema from what it is to what it should be, safely, in a team. How they differ and which fits your stack.
P.34DDD has a reputation for ceremony that scares teams off before they see the idea. The idea is simple and solves a real problem. What it is, and when to use it.
P.35Almost every queue advertising exactly-once actually gives you at-least-once plus a way to make your handler idempotent. The real distinction, and why.
P.36Pessimistic locking stops one request from starting; optimistic lets both run and catches the conflict at the end. How each works, with SQL, and how to pick.
P.37Soft delete sounds like the safe default, but it quietly breaks unique constraints, foreign keys, and query performance unless you design for it up front.
P.38Full rewrites fail because the business can't stand still for two years, not because the new code is bad. How the strangler fig moves traffic piece by piece.
P.39Partitioning and sharding get confused constantly. Partitioning stays on one server. How range, list, and hash work, and when it solves it before sharding.
P.40Most developers use whatever their ORM defaults to. What Read Committed, Repeatable Read, and Serializable prevent, what they allow, and how to choose.
P.41A background task that outlives the function that spawned it is a real production bug. How structured concurrency fixes it in Python, Kotlin, and Swift.
P.42A practical comparison of the four vector databases teams actually shortlist for RAG, with real pricing, when each wins, and the question that decides it.
P.43Chaos engineering injects failure into a running system to find weaknesses before an outage does. What it involves, what tools help, and when to skip it.
P.44Event sourcing stores every change as an immutable event and replays them for current state. What that buys, and the operational cost most systems skip.
P.45Hexagonal architecture stops business logic importing your database driver or payment SDK. How it works, a working example, and when you don't need it.
P.46Most teams default to cache-aside without asking if it's right. How cache-aside, write-through, and write-behind behave under real traffic, and how to pick.
P.47CAP theorem forces a consistency-versus-availability choice during a network partition, not all the time. Here is what it constrains and how to pick a model.
P.48Webhooks push the moment something happens; polling asks repeatedly. How to decide, with code for both, and the hybrid most production systems land on.
P.49A distributed lock stops two processes on separate machines from touching the same resource at once. Here's how Redis, ZooKeeper, and fencing tokens work.
P.50Round robin, least connections, and consistent hashing route traffic differently. Here's when each load balancing algorithm fits, with a hash ring example.
P.51Exponential backoff plus jitter stops retries from turning a blip into an outage. Working code, what not to retry, and how to bound the loop.
P.52Sharding splits one database across many machines. The strategy you pick decides whether you get hot spots, painful resharding, or something that scales.
P.53All three move messages between services, but answer different questions about delivery, replay, and who reads what. The decision, and the failure modes.
P.54Writing to your database and publishing an event are two operations, and a crash between them loses data silently. How the transactional outbox closes it.
P.55A single GraphQL schema works until several teams own different parts of the data. What federation solves, how Apollo composes subgraphs, and the cost.
P.56When a transaction spans services you can't wrap it in one database transaction. Sagas use local transactions plus compensating actions. When that pays.
P.57Idempotency keys let a client retry a request that may have already succeeded, without double-charging a card. The pattern, in Postgres and in Redis.
P.58CQRS separates the path that changes data from the path that reads it. It solves real problems and is heavily over-applied. When it earns its complexity.
P.59A circuit breaker stops your app hammering a failing dependency until it recovers. The three states, a minimal implementation, and how retries differ.
P.60TC39 is standardizing signals, the reactive pattern already inside Vue, Solid, Angular, and Preact. Years from browsers, but it changes what to build on.
How to assess a codebase before you buy, inherit, or partner on it: the documents to request, what kills deals, and what turns out to be fixable.
Three tools, three bets on where complexity belongs. How to choose between BullMQ, Inngest, and Temporal based on what your system needs, not what sounds big.
P.63Every cloud decision locks you in somewhere; the real question is which lock-in costs less. A practical framework for when to abstract and when to accept it.
An ADR captures why a technical choice was made, not just what. One page per decision, stored in the repo. Here's the format and how to make it stick.
MCP is the standard for connecting AI models to external systems. How it works, how to implement a server, and what to lock down before production.
Most slow queries come from a small set of fixable problems: missing indexes, N+1 patterns, and over-fetching. This is the practical diagnostic and fix guide.
P.67Blue-green and canary deployments limit the blast radius of a bad release. Here's how each works, with real Kubernetes and Argo Rollouts configs.
NestJS is Express with structure imposed: modules, dependency injection, decorators. When that pays for its learning curve, and when it does not.
CRDTs and sync engines make local-first apps feel instant and merge edits without conflicts. Here is how they work and whether your app actually needs them.
P.70Sanity, Contentful, Strapi and Payload compared on the criteria that decide it: who edits the content, where it's hosted, and whether schema lives in git.
Row Level Security moves tenant isolation into the database itself. How to set it up for a multi-tenant SaaS, handle the edge cases, and avoid the traps that break it.
Multi-cloud usually costs more in engineering time than the lock-in risk it prevents; most teams do better on one cloud with deliberate exceptions.
P.73Three agent orchestration frameworks, three different mental models. Here's when each earns its place, what it costs in complexity, and the choice at 2am when it breaks.
An agent that forgets everything when the session ends is a limited tool. Here are the practical patterns for building different kinds of memory into your agents.
TypeScript leaves errors untyped by default. Effect TS fixes that with typed failures, dependency injection, and structured concurrency.
gRPC has been available for years but many teams default to REST without thinking through the tradeoffs. Here's how gRPC works, where it fits, and where it doesn't.
URL versioning, header versioning, and content negotiation compared with real code. Here's how to pick one and retire old versions without stranding clients.
Kafka isn't always the right call for event-driven systems. Choose between Kafka, Redis Streams, and BullMQ based on real throughput and durability needs.
The multi-tenancy model you pick early is hard to change later. Compare database-per-tenant, schema-per-tenant, and row-level security by cost and isolation.
Every public API needs rate limiting, but the algorithm you choose shapes the user experience and the failure modes. Here's how each approach works and when to use it.
Use multiple agents when one agent has too many tools or too much context. The core patterns, MCP as the tool layer, and real code for three agent SDKs.
What breaks when you move from Celery to Django 6.0's Tasks framework, which workloads migrate cleanly, and when you should stay on Celery.
A deep dive into how we built codercops.com with Astro 5 SSR, Supabase as a CMS, Git-based content, and Edge Functions. Architecture decisions and lessons learned.
How we built a Git-to-Supabase content pipeline with SHA-256 delta sync, Edge Functions, and GitHub Actions. Full architecture and code walkthrough.
P.85Every engineering team faces build vs buy decisions constantly. Here's a practical framework for making these decisions without analysis paralysis.
Choosing a tech stack is one of the earliest and most consequential decisions for a startup. Here's a practical guide to making choices you won't regret.
Splitting a growing blog into its own repo, linked by a Git submodule, fixes merge conflicts and CI noise. Here is our exact setup for 130+ posts.
Learn the 5 SOLID principles of clean code through real-world analogies, humor, and simple examples. No PhD required - just common sense and a sense of humor.