Opened 3 weeks ago

Closed 13 days ago

Last modified 13 days ago

#37165 closed Cleanup/optimization (fixed)

Update Async Topic Docs

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 Carlton Gibson)

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:

  1. It strongly implies that Django's asynchronous story is unfinished. It's often linked 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_async adapter is a low-cost bridge (see :ref:async_performance)."""
  1. The performance warnings are severely outdated. sync_to_async/async_to_sync usage 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 that sync_to_async usage (in particular) incurs a (relatively) massive performance hit.
  1. 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 (10)

comment:1 by Carlton Gibson, 3 weeks ago

Has patch: set

comment:2 by Carlton Gibson, 3 weeks ago

Description: modified (diff)

comment:3 by Carlton Gibson, 3 weeks ago

Description: modified (diff)

comment:4 by Mariusz Felisiak, 3 weeks ago

Triage Stage: UnreviewedAccepted

comment:5 by Carlton Gibson, 2 weeks ago

FWIW this has come up again today on comments on ann interview of Jeff’s from PyCon US. “when will the ORM be async?”

Version 0, edited 2 weeks ago by Carlton Gibson (next)

comment:7 by Natalia Bidart, 13 days ago

Triage Stage: AcceptedReady for checkin

comment:8 by nessita <124304+nessita@…>, 13 days ago

Resolution: fixed
Status: assignedclosed

In 2c5e4af3:

Fixed #37165 -- Updated Async Support topics doc.

Removed outdated warnings, and updated performance considerations to
reflect current realities.

Thanks to Mykhailo Havelia for the detailed review.

comment:9 by Natalia <124304+nessita@…>, 13 days ago

In 11393f27:

[6.1.x] Fixed #37165 -- Updated Async Support topics doc.

Removed outdated warnings, and updated performance considerations to
reflect current realities.

Thanks to Mykhailo Havelia for the detailed review.

Backport of 2c5e4af3cccd88a7f0ea66a56aff1a49ad274681 from main.

comment:10 by Natalia <124304+nessita@…>, 13 days ago

In a6cfda9:

[6.0.x] Fixed #37165 -- Updated Async Support topics doc.

Removed outdated warnings, and updated performance considerations to
reflect current realities.

Thanks to Mykhailo Havelia for the detailed review.

Backport of 2c5e4af3cccd88a7f0ea66a56aff1a49ad274681 from main.

Note: See TracTickets for help on using tickets.
Back to Top