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

Add --skip-refresh flag to the build command #444

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

indrekj
Copy link
Contributor

@indrekj indrekj commented Oct 18, 2022

Discussion: #426


This improves the helmfile sync performance.

From the code: BuildDeps is used only by runHelmDepBuilds, which only is used by PrepareCharts which is finally only used by withPreparedCharts.

withPreparedCharts already does SyncReposOnce which means we do not have to refresh the local repository cache on each chart build.

This is only supported in Helm v3.

This seems to be mostly affecting helmfiles which have a lot of releases and those release charts use sub dependencies.

I saw significant performance improvements for a helmfile with 45 releases, 2 repositories, and most of the charts also had their own dependencies. Results:

Before the patch:

  • real 9m10.565s
  • real 9m38.335s
  • real 9m14.941s
  • real 5m13.106s (with cache)

After the patch:

  • real 6m51.965s
  • real 6m36.605s
  • real 6m31.685s
  • real 3m0.271s (with cache)

These were tested with:

rm -rf ~/.cache/helmfile ~/.cache/helm ~/.config/helm/repositories.* && helmfile sync ...

The result with (with cache) was without deleting the caches first.

From these metrics it seems that the sync duration decreased 20-45% depending on the run, release count, dependencies and if the cache was used or not.

As far as I understand, this should be backward-compatible change.

@yxxhero
Copy link
Member

yxxhero commented Oct 18, 2022

@indrekj Please fix DCO issue.

This improves the `helmfile sync` performance.

From the code: `BuildDeps` is used only by `runHelmDepBuilds`, which
only is used by `PrepareCharts` which is finally only used by
`withPreparedCharts`.

`withPreparedCharts` already does `SyncReposOnce` which means we do not
have to refresh the local repository cache on each chart build.

This is only supported in Helm v3.

This seems to be mostly affecting helmfiles which have a lot of releases
and those release charts use sub dependencies.

I saw significant performance improvements for a helmfile with 45
releases, 2 repositories, and most of the charts also had their own
dependencies. Results:

Before the patch:
* real  9m10.565s
* real  9m38.335s
* real  9m14.941s
* real  5m13.106s (with cache)

After the patch:
* real  6m51.965s
* real  6m36.605s
* real  6m31.685s
* real  3m0.271s (with cache)

These were tested with:
```
rm -rf ~/.cache/helmfile ~/.cache/helm ~/.config/helm/repositories.* && helmfile sync ...
```

The result with `(with cache)` was without deleting the caches first.

From these metrics it seems that the sync duration decreased 20-45%
depending on the run, release count, dependencies and if the cache was
used or not.

As far as I understand, this should be backward-compatible change.

Signed-off-by: Indrek Juhkam <indrek@urgas.eu>
@indrekj
Copy link
Contributor Author

indrekj commented Oct 18, 2022

Fixed, and fixed a test issue as well. The next run should be green now.

@yxxhero
Copy link
Member

yxxhero commented Oct 18, 2022

@indrekj I have a question. why not add the skip-refresh option? from the logic. it will add --the skip-refresh option by default when helm v3.

@indrekj
Copy link
Contributor Author

indrekj commented Oct 18, 2022

To my understanding, there's no need to do a refresh if we're already doing SyncReposOnce. I don't see a reason for a flag in that case. Do you see a reason why we would need both SyncReposOnce and refresh together?

@yxxhero
Copy link
Member

yxxhero commented Oct 18, 2022

@indrekj oh. I see.

Copy link
Member

@yxxhero yxxhero left a comment

Choose a reason for hiding this comment

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

LGTM

@mumoshu
Copy link
Contributor

mumoshu commented Oct 20, 2022

Seems good to me. Thanks for your proposal and contribution!

@mumoshu mumoshu merged commit a409b45 into helmfile:main Oct 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2022
@indrekj indrekj deleted the skip-refresh branch November 20, 2022 12:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants