---
django: 6.1.3 (f16e25dcb9fe55734ba4ea2b00ac34405b7df74a)
part: In practice
promise: "Each layer is independent."
---

# Where Django leaks

The full measured latency and query ladder of a single endpoint, the failure modes that cross layer boundaries in production, and the sharp Django 6.x shifts that trip up older mental models.

Every earlier chapter opened one layer in isolation. Real production outages almost never stay inside one layer: a lazy `QuerySet` passed into a cached template fires queries during rendering, a synchronous middleware sitting in front of an async view bounces every request onto a thread pool, and a database connection held open across an external HTTP call exhausts the pool while CPU sits idle.

## The cost ladder of one request

When a view returns a rendered page from our newsroom application, time does not spread evenly across Python code. URL resolution and middleware dispatch take microseconds; a single unplanned foreign-key lookup inside a template loop can outweigh the rest of the view combined.

> **Changed in 6.1.** Django 6.1 introduced `QuerySet.fetch_mode` with `FETCH_PEERS` and `FETCH_RAISE`, giving teams a direct way to either batch accidental lazy loads across peer instances or turn hidden queries into loud `FieldFetchBlocked` exceptions in tests (`django/db/models/fetch_modes.py:FetchPeers`, `django/db/models/fetch_modes.py:FetchRaise`).
