~/writing
rss.xml ↗Writing & Field Notes
Long-form notes and postmortems on backend systems, database migrations, distributed queues, and day-to-day engineering work.
Why Stacking Shared and Per-Actor DRF Throttles Causes Self-Inflicted DoS
How Django REST Framework's APIView.check_throttles() drains shared rate-limit buckets even when a stricter per-IP or per-phone throttle rejects the request, and the two-phase post-send fix.
Uniform Random Sampling Over a 110M-Row PostgreSQL Table
Why ORDER BY random() strands jobs at 77% selectivity, why TABLESAMPLE SYSTEM introduced 0.53 total-variation distance bias on a clustered heap, and how generate_series random-PK probing with adaptive overdraw fixed it in ~17s.
Dual-Write Migrations Without Stopping Production
Practical lessons from moving live Django domains off MongoDB onto PostgreSQL using feature flags, mixed-ID resolvers, and continuous reconciliation.