-
-
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
Avoid creating a task to do DNS resolution if there is no throttle #8163
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8163 +/- ##
==========================================
+ Coverage 97.37% 97.53% +0.16%
==========================================
Files 108 107 -1
Lines 32628 32843 +215
Branches 3875 3851 -24
==========================================
+ Hits 31770 32032 +262
+ Misses 654 610 -44
+ Partials 204 201 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
How do we feel about backporting this to 3.9. HA is having some stability problems with too many tasks, and this would help a lot in reducing them. |
I think this can easily be declared a bugfix since (1) it's not a new feature (meaning no grounds for requiring a minor version bump) and (2) it fixes an undesired behavior. |
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <sviat@redhat.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <sviat@redhat.com>
Thanks for the reviews. I'll merge it tomorrow or later tonight after some sleep + recheck. |
Still looks good, functional retest is good. |
Backport to 3.9: 💚 backport PR created✅ Backport PR branch: Backported as #8172 🤖 @patchback |
Backport to 3.10: 💚 backport PR created✅ Backport PR branch: Backported as #8173 🤖 @patchback |
…solution if there is no throttle (#8173) Co-authored-by: J. Nick Koston <nick@koston.org>
What do these changes do?
Avoid creating a task to do dns resolution if there is no throttle
When doing some debugging, I noticed that a large amount of tasks created on a Home Assistant instance were
TCPConnector._resolve_host
for cases where the host was an ip address or already in the cache. On this instance, it reduced the number of_resolve_host
tasks by 99%. Previously I observed ~500 per minute.Are there changes in behavior for the user?
There is a small performance improvement on cache hit and when the host is an ip address. Since requests no longer have to suspend on cache hit this can reduce latency of requests. Scheduling and awaiting a task on the event loop can take 2 order of magnitude more wall clock time vs running a simple function.
Is it a substantial burden for the maintainers to support this?
no
Related issue number
Checklist
CONTRIBUTORS.txt
CHANGES/
foldername it
<issue_or_pr_num>.<type>.rst
(e.g.588.bugfix.rst
)if you don't have an issue number, change it to the pull request
number after creating the PR
.bugfix
: A bug fix for something the maintainers deemed animproper undesired behavior that got corrected to match
pre-agreed expectations.
.feature
: A new behavior, public APIs. That sort of stuff..deprecation
: A declaration of future API removals and breakingchanges in behavior.
.breaking
: When something public is removed in a breaking way.Could be deprecated in an earlier release.
.doc
: Notable updates to the documentation structure or buildprocess.
.packaging
: Notes for downstreams about unobvious side effectsand tooling. Changes in the test invocation considerations and
runtime assumptions.
.contrib
: Stuff that affects the contributor experience. e.g.Running tests, building the docs, setting up the development
environment.
.misc
: Changes that are hard to assign to any of the abovecategories.
Make sure to use full sentences with correct case and punctuation,
for example:
Use the past tense or the present tense a non-imperative mood,
referring to what's changed compared to the last released version
of this project.