Opened 3 weeks ago
Last modified 13 days ago
#37165 closed Cleanup/optimization
Update Async Topic Docs — at Version 2
| Reported by: | Carlton Gibson | Owned by: | Carlton Gibson |
|---|---|---|---|
| Component: | Documentation | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The Asynchronous support topic doc was written when we first introduced async support. It's outdated, and the warnings it gives are misleadingly negative. Time to refresh it.
The main problems are:
- It strongly implies that Django's asynchronous story is unfinished. It's often liked to in blog posts. And it's totally misleading. The user API is essentially finished. From the PR: """Many parts of Django provide asynchronous APIs, including :ref:
the ORM <async-queries>, the cache framework, authentication, sessions, mail, and signals. For other code, the :func:sync_to_asyncadapter is a low-cost bridge (see :ref:async_performance)."""
- The performance warnings are severely outdated.
sync_to_async/async_to_syncusage is in the order or microseconds with modern versions of Python. This plays directly into implementation considerations where we're constantly pulled towards duplicating whole code trees, on the mistaken assumption thatsync_to_asyncusage (in particular) incurs a (relatively) massive performance hit.
- It makes no mention of the remaining async difficulties — such as concurrent DB queries — which are not Django specific. In particular connection pooling is the appropriate lever to increase throughput, regardless of whether you're using Django, any other async orm, or raw connections by hand. (The current phrasing implies it's the ORM that's at fault here: it's not!)
The topic doc here is a big source of the negative narrative about Django's async story. It's time to correct that.
Change History (2)
comment:1 by , 3 weeks ago
| Has patch: | set |
|---|
comment:2 by , 3 weeks ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.
PR