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

fix(idtoken): increase MaxIdleConnsPerHost to 100 in NewClient #1754

Merged
merged 2 commits into from Nov 21, 2022

Conversation

quartzmo
Copy link
Member

closes: #1744

@quartzmo quartzmo requested review from a team and yoshi-approver as code owners November 18, 2022 23:38
@@ -54,7 +54,9 @@ func NewClient(ctx context.Context, audience string, opts ...ClientOption) (*htt
// Skip DialSettings validation so added TokenSource will not conflict with user
// provided credentials.
opts = append(opts, option.WithTokenSource(ts), internaloption.SkipDialSettingsValidation())
t, err := htransport.NewTransport(ctx, http.DefaultTransport, opts...)
httpTransport := http.DefaultTransport.(*http.Transport).Clone()
httpTransport.MaxIdleConnsPerHost = 100
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a large increase. The default when not set is 2 for comparison. I wonder if there is a different way we could enable users to do something like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same default set in transport/http/dial.go. See some potentially relevant discussion here.

Copy link
Member Author

Choose a reason for hiding this comment

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

@david-gang Do you have any opinion on hardcoding to 100 here, as opposed to flexible configuration or some other value?

Copy link

Choose a reason for hiding this comment

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

@quartzmo 100 is fine for me. In the product i work on, we have 100 hardcoded for every http client.

@quartzmo quartzmo enabled auto-merge (squash) November 21, 2022 21:58
@quartzmo quartzmo merged commit 629e217 into googleapis:main Nov 21, 2022
@quartzmo quartzmo deleted the idtoken-maxidleconnsperhost branch November 21, 2022 23:10
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.

How to set a higher MaxIdleConnsPerHost for idtoken client
3 participants