How to scale old Django apps for free
summary
Clear claim: using gevent monkey-patching with Django + Gunicorn converts blocking I/O into cooperative green threads so IO-bound endpoints handle far more concurrent requests. Demo app uses two views (CPU-bound summation, IO-bound external sleeper using requests) and shows Gunicorn gevent worker yields about 4x throughput with 10x less memory versus 20 sync workers, while CPU-bound work sees no benefit. Caveats: C extensions like psycopg2 need event-friendly drivers or custom connection pooling, otherwise you get no speedup. Migration removes a bottleneck but exposes other issues.
AI-written summary · about
chapters (14)
- 0:00Introduction and speaker intro
- 1:06Talk overview and scalability basics
- 3:07Processes vs threads limitations
- 5:31Python GIL and threading issues
- 7:11Green threads explained
- 9:31Green threads in web servers
- 12:48Async Django without code changes
- 16:09Monkey patching and limitations
- 16:35Demo app setup
- 18:07Benchmark results IO bound
- 19:40Benchmark results CPU bound
- 20:27Real-world implementation experience
- 22:31Dependency considerations
- 23:26Q&A session
