← All series

Production Django Task Queue

Building a ~300 LOC task queue on Django ORM from prototype to production — memory leaks, fork pitfalls, pessimistic locking, and security hardening.

  1. django-simple-queue: 300 Lines to Replace Celery

    How a ~300 LOC task queue built on Django ORM replaces Celery for small teams — the architecture, the tradeoffs, and when it makes sense.

  2. Hunting Memory Leaks in a Django Task Worker

    Production memory climbing to 500 MB. The fix: run tasks in subprocesses so the OS reclaims everything. From 500 MB to 50 MB.

  3. The Fork, the File Descriptor, and the Deployment

    Two production bugs from subprocess isolation: shared database connections after fork, and lost working directories after deployment.

  4. Pessimistic Locking: One Task, One Worker

    Using SELECT FOR UPDATE SKIP LOCKED to prevent multiple workers from claiming the same task — database-level concurrency without application-level locks.

  5. From Bug Fix to Production Hardening: A Refactoring Marathon

    Stalled task detection, security hardening, code refactoring, and lifecycle signals — turning a task queue into production-grade infrastructure.