Repository navigation
Replace wait_event_or_timeout internals with async_timeout - #1081
Merged
Merged
Conversation
Its unlikely that https://bugs.python.org/issue39032 and python/cpython#83213 will be fixed soon. While we moved away from an asyncio.Condition, we still has a similar problem with waiting for an asyncio.Event which wait_event_or_timeout played well with. async_timeout avoids creating a task so its a bit more efficient. Since we call these when resolving ServiceInfo, avoiding task creation will resolve a performance problem when ServiceBrowsers startup as they tend to create task storms when coupled with ServiceInfo lookups.
Codecov Report
@@ Coverage Diff @@
## master #1081 +/- ##
==========================================
- Coverage 99.92% 99.92% -0.01%
==========================================
Files 23 23
Lines 2559 2548 -11
Branches 477 476 -1
==========================================
- Hits 2557 2546 -11
Misses 1 1
Partials 1 1
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Member
Author
|
Testing showed this decreased the number of tasks created by ~500/minute with on my production network, and ~1200/minute on my busy test network I'll leave this as a draft for a while as I want to make sure it works ok in production for a while |
Member
Author
|
This has been solid for a day. I want to clean up some of the tests before the next release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Its unlikely that https://bugs.python.org/issue39032 and
python/cpython#83213 will be fixed
soon. While we moved away from an
asyncio.Condition, we stillhas a similar problem with waiting for an
asyncio.Eventwhichwait_event_or_timeoutplayed well with.async_timeoutavoidscreating a task so its a bit more efficient. Since we call
these when resolving
ServiceInfo, avoiding task creationwill resolve a performance problem when
ServiceBrowsersstartup as they tend to create task storms when coupled
with
ServiceInfolookups.async_timeoutwas chosen as a replacement becauseits by the
asyncioauthors and does not add any platformspecific requirements as its pure python.