#36964: Clarify how persistent connections interact with runserver
-------------------------------------+-------------------------------------
Reporter: Adam Sołtysik | Owner: Youssef
Type: | Tarek Ali
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Adam Sołtysik):
> The quoted statement in the documentation was written by one of Django's
most esteemed contributors (2ee21d9f0d9eaed0494f3b9cd4b5bc9beffffae5).
While something may have changed in the intervening years, we need a more
rigorous explanation.
The statement was probably correct when it was written, and what changed
later was the keep-alive support added around
https://github.com/django/django/pull/10609.
> How is the development server's behavior different from multithreaded
WSGI servers used in production? Do they "guarantee that sequential
requests will use the same thread"?
It seems that, unlike production servers, runserver generally keeps
creating new threads for each client, as mentioned earlier and confirmed
in a [https://forum.djangoproject.com/t/development-
server/24292/2#:~:text=The%20runserver%20command%20relies%20on%20socketserver.ThreadingMixIn%20which%20defaults%20to%20creating%20one%20thread%20per%20request
forum post]. But the threads are reused with HTTP keep-alive, which allows
persistent DB connections to work.
--
Ticket URL: <https://code.djangoproject.com/ticket/36964#comment:13>
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/0107019cec326e09-70aa27f9-b024-4aa1-95b7-2ec36973942d-000000%40eu-central-1.amazonses.com.