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

Reuse http.DefaultTransport in UIMetricsProxy #14521

Merged
merged 2 commits into from
Sep 8, 2022
Merged

Conversation

kisunji
Copy link
Contributor

@kisunji kisunji commented Sep 8, 2022

http.Transport keeps a pool of connections and should be reused when possible. We instantiate a new http.DefaultTransport for every metrics request, making large numbers of concurrent requests inefficiently spin up new connections instead of reusing open ones. This PR sets http.DefaultTransport once and re-uses it per request to generate the reverse proxy.

Testing & Reproduction steps

  • No logic change
  • No existing tests should fail

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

Chris S. Kim added 2 commits September 8, 2022 09:43
http.Transport keeps a pool of connections and should be reused when possible. We instantiate a new http.DefaultTransport for every metrics request, making large numbers of concurrent requests inefficiently spin up new connections instead of reusing open ones.
@@ -771,6 +771,7 @@ func (s *HTTPHandlers) UIMetricsProxy(resp http.ResponseWriter, req *http.Reques
Director: func(r *http.Request) {
r.URL = u
},
Transport: s.proxyTransport,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kisunji kisunji requested review from a team and DanStough and removed request for a team September 8, 2022 14:07
Copy link
Contributor

@DanStough DanStough left a comment

Choose a reason for hiding this comment

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

TIL 🚀 . Thanks for the great background links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants