Skip to content
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

Use cleanhttp.DefaultPooledTransport for the default API client #12409

Merged
merged 2 commits into from
Apr 6, 2022

Conversation

benbuzbee
Copy link
Contributor

The only difference is DefaultTransport sets DisableKeepAlives

This doesn't make much sense to me - every http connection from the
nomad client goes to the same NOMAD_ADDR so it's a great case for keep
alive. Except round robin DNS and anycast perhaps.

Consul does this already
https://github.com/hashicorp/consul/blob/1e47e3c82b6eb937baab0688a67cf7ef334ce42c/api/api.go#L397

@benbuzbee benbuzbee changed the title Use cleanhttp.DefaultPooledTransport Use cleanhttp.DefaultPooledTransport for the default API client Mar 30, 2022
@tgross tgross added this to Needs Triage in Nomad - Community Issues Triage via automation Mar 31, 2022
@tgross tgross self-requested a review March 31, 2022 13:10
@tgross tgross moved this from Needs Triage to In Progress in Nomad - Community Issues Triage Mar 31, 2022
@tgross tgross self-assigned this Mar 31, 2022
Ben Buzbee and others added 2 commits April 6, 2022 11:34
The only difference is DefaultTransport sets DisableKeepAlives

This doesn't make much sense to me - every http connection from the
nomad client goes to the same NOMAD_ADDR so it's a great case for keep
alive. Except round robin DNS and anycast perhaps.

Consul does this already
https://github.com/hashicorp/consul/blob/1e47e3c82b6eb937baab0688a67cf7ef334ce42c/api/api.go#L397
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've added a changelog entry and this will ship in the upcoming Nomad 1.3.0

@tgross tgross merged commit 6e1270d into hashicorp:main Apr 6, 2022
Nomad - Community Issues Triage automation moved this from In Progress to Done Apr 6, 2022
tgross added a commit that referenced this pull request Apr 6, 2022
tgross added a commit that referenced this pull request Apr 6, 2022
@tgross
Copy link
Member

tgross commented Apr 6, 2022

@benbuzbee just a heads up that I ended up having to revert this in #12480, as the command/agent tests were failing:

=== CONT  TestHTTPServer_Limits_OK/7-tls-true-timeout-5s-limit-2
    http_test.go:1202:
                Error Trace:    http_test.go:1202
                                                        http_test.go:1313
                Error:          Received unexpected error:
                                EOF
                Test:           TestHTTPServer_Limits_OK/7-tls-true-timeout-5s-limit-2
--- FAIL: TestHTTPServer_Limits_OK (0.00s)

I'm fairly certain this is a testing artifact and not a real problem with your patch, but I didn't want to hold up the Nomad 1.3.0 beta release while I debugged that. I'll follow-up shortly with a test fix and unrevert the patch so we can ship it in 1.3.0 GA. Thanks for your patience.

tgross added a commit that referenced this pull request Apr 6, 2022
We expect every Nomad API client to use a single connection to any
given agent, so take advantage of keep-alive by switching the default
transport to `DefaultPooledClient`. Provide a facility to close idle
connections for testing purposes.

Restores the previously reverted #12409
tgross added a commit that referenced this pull request Apr 6, 2022
We expect every Nomad API client to use a single connection to any
given agent, so take advantage of keep-alive by switching the default
transport to `DefaultPooledClient`. Provide a facility to close idle
connections for testing purposes.

Restores the previously reverted #12409
tgross added a commit that referenced this pull request Apr 6, 2022
We expect every Nomad API client to use a single connection to any
given agent, so take advantage of keep-alive by switching the default
transport to `DefaultPooledClient`. Provide a facility to close idle
connections for testing purposes.

Restores the previously reverted #12409

Co-authored-by: Ben Buzbee <bbuzbee@cloudflare.com>
tgross added a commit that referenced this pull request Apr 6, 2022
…12492)

We expect every Nomad API client to use a single connection to any
given agent, so take advantage of keep-alive by switching the default
transport to `DefaultPooledClient`. Provide a facility to close idle
connections for testing purposes.

Restores the previously reverted #12409


Co-authored-by: Ben Buzbee <bbuzbee@cloudflare.com>
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants