Blog
Deep dives that tie several CS tips into one story, such as how an outage unfolds or how an estimate comes together.
- Composite index column order: diagnose slow PostgreSQL queries with EXPLAIN
An index exists, yet the query is slow. Follow an order-history API to choose column order from WHERE and ORDER BY, recognize expressions that prevent selective lookups, replace deep OFFSETs, and check foreign-key indexes.
- Prevent duplicate webhook processing: signatures, idempotency, and durable retries
Duplicate deliveries, lost work after a 200 response, and out-of-order events require different safeguards. Use Stripe as an example to connect raw-body verification, a durable inbox, database constraints, conditional updates, and external API idempotency.
- How to improve RAG accuracy: diagnose retrieval, chunking, filters, and evaluation
Separate missing evidence from generation errors before tuning a RAG system. Use an internal help desk to work through recall@k, chunk boundaries, hybrid retrieval, authorization filters, pgvector result shortfalls, and regression evaluation.
- Cache stampedes explained: protect your database with Redis, TTL jitter, and singleflight
Why does database load spike when a Redis key expires? Compare TTL jitter, Go singleflight, stale-while-revalidate, and distributed locks using a product API receiving 10,000 reads per second, with worked examples and implementation guidance.
- Choosing an architecture from nonfunctional requirements: comparisons and ADRs
Turn “highly available and scalable” into conditions you can compare. An order system connects SLOs, failure capacity, and operational ownership to mandatory constraints, option comparisons, and an ADR with evidence and review triggers.
- Monolith or microservices? Choose boundaries through changes, data, and operations
More services do not automatically mean less coordination. Compare a modular monolith with service extraction through orders, inventory, and notifications, including transactions, contract tests, and operational ownership.
- Migrating a legacy system incrementally: data authority, cutover, and rollback
Routing users to a replacement does not finish a data migration. Follow an order-system modernization through behavioral baselines, transfer of write ownership, business-level reconciliation, recovery after new writes, and retirement of the legacy system.
- What is the N+1 query problem? Find it in SQL logs and fix it with JOINs or batching
A slow list API can hide behind individually fast queries. Follow a posts endpoint to detect N+1 queries, choose between JOINs and batched reads, apply Rails or Django eager loading, and check pagination, indexes, and performance afterward.
- Stock that doesn't add up, double bookings, stuck transfers
Concurrency bugs never show up in tests that run one request at a time. This post sets off five of them on an online store's sale day and checks where to guard against each.
- 502s on every deploy
Errors during deploys are easy to ignore because they stop quickly, but they rarely have a single cause. This post follows one pod being replaced and removes the causes one at a time.
- The account is suspended, but the token still works
A departing employee's account was suspended in the evening, yet it could still read customer data the next morning. This post inspects, in order, the six checkpoints a token passes through from issue to expiry.
- Why a slightly slow database can take everything down
It started with one query that missed an index. Following a payment API from there to a full outage shows the order in which timeout and retry settings come into play.
- Is "CPU is only at 80%" really fine?
Sizing a system takes four formulas, all multiplication and division. Using an API that peaks at 3,000 requests per second, this post works out servers, headroom, and connections in turn.
- Why "save, then publish" breaks
Save the order, then publish an event. A crash between those two lines is enough to leave an order with no confirmation email, or a customer charged twice. This post follows an order through the system to see what to guard, and where.