-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance of starting request handlers with Python 3.12+ #8661
Conversation
#3406 wrapped _handle_request in a task to copy the contextvars which delays the start of the request by one iteration of the event loop. In #8170 (reply in thread) we did not have a way to improve with without removing the task, however since Python 3.12+ has eager start for tasks, we can now avoid the delay.
#3406 wrapped _handle_request in a task to copy the contextvars which delays the start of the request by one iteration of the event loop. In #8170 (reply in thread) we did not have a way to improve with without removing the task, however since Python 3.12+ has eager start for tasks, we can now avoid the delay.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8661 +/- ##
=======================================
Coverage 97.97% 97.97%
=======================================
Files 107 107
Lines 33780 33784 +4
Branches 3966 3967 +1
=======================================
+ Hits 33096 33100 +4
Misses 507 507
Partials 177 177
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks |
Backport to 3.10: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 4d604ea on top of patchback/backports/3.10/4d604eafefbee22ad35886c3bd12e4c3048cc45b/pr-8661 Backporting merged PR #8661 into master
🤖 @patchback |
Backport to 3.11: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 4d604ea on top of patchback/backports/3.11/4d604eafefbee22ad35886c3bd12e4c3048cc45b/pr-8661 Backporting merged PR #8661 into master
🤖 @patchback |
…uest handlers with Python 3.12+ (#8665)
…uest handlers with Python 3.12+ (#8666)
What do these changes do?
#3406 wrapped _handle_request in a task to copy the contextvars which delays the start of the request by one iteration of the event loop and increases event loop overhead by forcing it to be scheduled which many of the handlers can finish synchronously.
In #8170 (reply in thread) we did not have a way to improve with without removing the task, however since Python 3.12+ has eager start for tasks, we can now avoid the delay and scheduling overhead.
Are there changes in behavior for the user?
Performance improvement
Is it a substantial burden for the maintainers to support this?
no