-
Notifications
You must be signed in to change notification settings - Fork 137
Open
Description
Currently, ASGI applications must read and send each file chunk in Python to transmit file data. This is inefficient since it steals a lot of GIL time for something that is an IO-bound task.
Pure-python ASGI webservers could implement pathsend as something akin to asyncio.to_thread( os.sendfile, ... ). When wrapping the operating system's syscall in a thread, it would would free up a ton of GIL time, especially for multiple concurrent huge payloads.
If os.sendfile doesn't exist (such as on Windows) then it would need to fall-back to traditional python chunking.
I can PR this behavior, just let me know if you agree.
Ref:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels