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
utils: let http client can reuse connections #6914
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #6914 +/- ##
==========================================
+ Coverage 74.23% 74.37% +0.14%
==========================================
Files 427 427
Lines 45127 45140 +13
==========================================
+ Hits 33500 33573 +73
+ Misses 8672 8628 -44
+ Partials 2955 2939 -16
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -433,12 +433,16 @@ func CreateClients(tlsConfig *tls.Config, acUrls []url.URL) (*clientv3.Client, * | |||
|
|||
// createHTTPClient creates a http client with the given tls config. | |||
func createHTTPClient(tlsConfig *tls.Config) *http.Client { | |||
return &http.Client{ | |||
Transport: &http.Transport{ | |||
DisableKeepAlives: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need DisableKeepAlives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need, otherwise cannot reuse.
Signed-off-by: nolouch <nolouch@gmail.com>
TLSClientConfig: tlsConfig, | ||
}, | ||
} | ||
// FIXME: Currently, there is no timeout set for certain requests, such as GetRegions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DisableKeepalive is in many releases, do we need to pick this pr for the older versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be some reason to open DisableKeepalive
in the old version like some places may not close resp.Body
, that's cause the connect cannot reuse and then need to establish a new connection. before, DisableKeepalive can make connect close faster to reduce connection leaks issues.
I think the problem does not exist now, let's only pick to the recent version first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/merge |
@bufferflies: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: d139862
|
@nolouch: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
In response to a cherrypick label: new pull request created to branch |
close tikv#6913 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
close #6913 utils: let HTTP client can reuse connections Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Signed-off-by: nolouch <nolouch@gmail.com> Co-authored-by: ShuNing <nolouch@gmail.com> Co-authored-by: nolouch <nolouch@gmail.com>
What problem does this PR solve?
Issue Number: Close #6913
What is changed and how does it work?
Check List
Tests
Before:
pd-0(follower):
pd-1(leader):
After:
pd-1(follower):
pd-2(leader):
Release note