#35592: ASGIHandler fully buffers request before handling it -------------------------------------+------------------------------------- Reporter: Klaas van Schelven | Type: | Uncategorized Status: new | Component: | Uncategorized Version: 5.1 | Severity: Normal Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- The `ASGIHandler` [https://github.com/django/django/blob/86e13843c2ab510fba1de84588efe7fd03555531/django/core/handlers/asgi.py#L170 reads the full request body] before proceeding with actually "doing the Django thing" (processing the request with a view).
In this aspect the `ASGIHandler` has less support for streaming than the `WSGIHandler`. When running Django as a WSGI application, I am able to start reading from a request (using `request.read(chunk_size)` as it becomes available to my web server. This enables me to process large requests in a streaming way (lower latency, support for abort-early). When running Django as an ASGI application (at least as per the provided `asgi.py`) I am unable to do this. This is contrary to my general expectation that things starting with an 'A' should have equal or better support for streaming than things starting with a 'W'. The following line from the ASGI spec gives credit to that expectation "ASGI attempts to preserve a simple application interface, while providing an abstraction that allows for data to be sent and received at any time" -- Ticket URL: <https://code.djangoproject.com/ticket/35592> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070190a175d272-43af4faa-fd14-4faf-802d-a7e0a9c3c2f4-000000%40eu-central-1.amazonses.com.