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

Optimization: Reuse HTTPClient / DynamicClient in reconcile #371

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

justinsb
Copy link
Contributor

Should be slightly more efficient via better HTTP connection reuse.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 16, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 16, 2024
Should be slightly more efficient via better HTTP connection reuse.
@justinsb
Copy link
Contributor Author

cc @cheftako - as requested re reusing the DynamicClient; I think the answer is that the caller should try to provide a cached DynamicClient, because client-go is more efficient if we can reuse the http.Client. Added a comment and ensured that k-d-p itself passes the dynamic client (which we actually already have!)

@atoato88
Copy link
Contributor

atoato88 commented Jan 24, 2024

First of all, this looks good.

BTW, I am not sure about my comment is related with this PR. 🤔
Current direct applier uses the dynamicClient at here.
This always uses the dynamicClient from Factory.
Should we update the direct.go to use the opt.DynamicClient?

On the other hand, dynamicClient in applylib.go takes care of the existance of opt.DynamicClient.
It's OK as-is, I think.

@justinsb
Copy link
Contributor Author

Great point @atoato88, and you're absolutely right. I added a commit that should also reuse the dynamic-client in the direct applier.

(I don't think we can practically reuse it in the exec applier.)

I also noticed that we probably should be trying to reuse the http client here, but I think I'll have to send a separate PR for that one!

@atoato88
Copy link
Contributor

atoato88 commented Feb 1, 2024

@justinsb
Thank you for the response and update.

(I don't think we can practically reuse it in the exec applier.)

I think so too.

I also noticed that we probably should be trying to reuse the http client here, but I think I'll have to send a separate PR for that one!

OK!
We can go forward. 🚀

@atoato88
Copy link
Contributor

atoato88 commented Feb 1, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 1, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8a932a2 into kubernetes-sigs:master Feb 1, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants