Home

Writing

Notes on systems, databases, and things I've had to fix at 2am.

Databases · TestingSeptember 2026 8 min read

My database lost every committed write, and one test found it

PyDB had a write-ahead log, fsync on every commit, and a README promising crash recovery. The first time I killed it mid-workload, 50 committed rows came back as zero.

Read
Security · PostgreSQLSeptember 2026 7 min read

Row-level security: the tenant check you can't forget

Cross-tenant leaks come from one missing WHERE clause. PostgreSQL can enforce the check for you, if you avoid the quiet ways row-level security switches itself off.

Read
Event systems · ReliabilitySeptember 2026 7 min read

Alerting on something that didn't happen

An AI camera can tell you someone climbed a fence. It can't tell you the guard never walked past. Timers over missing events: late messages, restarts, one alert per lapse.

Read
Distributed SystemsSeptember 2026 7 min read

Add one server, move 90% of your keys

hash(key) % N falls apart the moment N changes. Measured numbers from a consistent-hash ring, virtual nodes, and why the hash function matters more than you'd expect.

Read
Systems · DatabasesJuly 2026 9 min read

Building a B-Tree Storage Engine From Scratch

Why I built a database instead of using one: pages, a pager, a B-Tree, splits, and a Write-Ahead Log, all from first principles.

Read
Real-time · SystemsJuly 2026 7 min read

We were polling our own database to death

Every dashboard hit the API every three seconds asking 'anything new?'. Swapping polling for WebSockets and Redis Pub/Sub cut backend traffic by 80%.

Read
Distributed Systems · KafkaJuly 2026 8 min read

Exactly-once is mostly a marketing slide

A deploy blipped and some tax records got processed twice. Here's how I stopped chasing 'exactly-once' and built consumers that just don't care about duplicates.

Read
Performance · DatabasesJuly 2026 6 min read

53 endpoints, one lazy loop, 15.6 seconds

One page took 15.6 seconds to load. It wasn't a slow query. It was 101 fast ones. A short story about the N+1 problem and counting your round trips.

Read
Concurrency · SystemsJuly 2026 7 min read

Two requests, one row, and a lost update

Two people saved the same record a second apart and one edit silently vanished. On the lost-update race, optimistic concurrency, and when to reach for a distributed lock.

Read
Resilience · SystemsJuly 2026 6 min read

Your retry logic is a small DDoS you wrote yourself

A downstream service hiccuped for thirty seconds. Our retries turned it into a four-minute outage. On backoff, jitter, knowing when to quit, and the dead-letter queue.

Read