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

perf: Reuse 1Password client #548

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Conversation

WillDaSilva
Copy link
Contributor

I noticed that the 1Password providers were very slow, and the amount of time it took to evaluate a YAML file with 1Password references increased approximately linearly with the number of 1Password references, which suggested to me that work was being unnecessarily repeated.

I found that the providers have a client field, and its assigned to, but we never check if its set, so we always create a new client. This PR updates the providers so that if the client is not set one will be created, and if one has been set then it'll be reused.

For my YAML file with 26 1Password references, this change reduced the time it took to evaluate the file from 29 seconds to 11 seconds. There is still room for improvement (e.g. by parallelizing the evaluation of each ref, improved caching, etc.), but this seems like a simple and worthwhile change on its own.

I noticed that the 1Password providers were very slow, and the amount of time
it took to evaluate a YAML file with 1Password references increased
approximately linearly with the number of 1Password references, which suggested
to me that work was being unnecessarily repeated.

I found that the providers have a `client` field, and its assigned to, but we
never check if its set, so we always create a new client. This PR updates the
providers so that if the `client` is not set one will be created, and if one
has been set then it'll be reused.

For my YAML file with 26 1Password references, this change reduced the time it
took to evaluate the file from 29 seconds to 11 seconds. There is still room
for improvement (e.g. by parallelizing the evaluation of each ref, improved
caching, etc.), but this seems like a simple and worthwhile change on its own.

Signed-off-by: Will Da Silva <will@willdasilva.xyz>
@yxxhero
Copy link
Member

yxxhero commented Oct 16, 2024

@WillDaSilva cool.

@yxxhero
Copy link
Member

yxxhero commented Oct 16, 2024

This pull request includes changes to ensure that the client is properly initialized before being used in the GetString method for both the onepassword and onepasswordconnect providers.

Initialization checks:

@yxxhero yxxhero merged commit 0c849cf into helmfile:main Oct 16, 2024
4 checks passed
@WillDaSilva
Copy link
Contributor Author

@yxxhero Thank you for the review. When do you expect these changes will be released? I'm currently using my custom build of vals for the performance enhancement, but I'd like my team to benefit as well.

@yxxhero
Copy link
Member

yxxhero commented Oct 20, 2024

@WillDaSilva https://github.com/helmfile/vals/releases/tag/v0.37.7

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