#37177: Performance issue in Async Middleware handling.
--------------------------------+---------------------------------------
Reporter: Carlton Gibson | Owner: Jacob Walls
Type: Bug | Status: assigned
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Comment (by Natalia Bidart):
As part of other async benchmarking work I'm doing, I took some time to
measure the problem from this ticket, and got consistent results. On a
real ASGI server end-to-end (daphne, single process), using the default 7
middlewares, and an async view returning immediately, Python 3.14.5 and
asgiref 3.11.1, I tested with `ab` across concurrency 10 to 200 (`-n
8000`):
{{{
-c │ async_capable=True │ async_capable=False
────┼─────────────────────┼─────────────────────
10 │ 576 req/s │ 920 req/s
50 │ 587 req/s │ 926 req/s
100 │ 570 req/s │ 933 req/s
200 │ 533 req/s │ 883 req/s
}}}
Throughput stays flat and latency grows linearly in both (I ran this in my
laptop, a saturated single process), so the change shows up as the
throughput **ceiling:** marking the built-in middleware sync-only lifts it
~1.6x at every load level (~1.7 ms to ~1.1 ms per request, WSGI reference,
same view: ~1690 req/s.)
--
Ticket URL: <https://code.djangoproject.com/ticket/37177#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019edc685789-85c00a0c-f123-49e6-89e3-80664650d85f-000000%40eu-central-1.amazonses.com.