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

chore: Try SSA for Kamelet install only once #2823

Merged
merged 2 commits into from
Dec 9, 2021
Merged

chore: Try SSA for Kamelet install only once #2823

merged 2 commits into from
Dec 9, 2021

Conversation

astefanutti
Copy link
Member

This PR follows up #2814 to take into account #2814 (comment).

@zregvart let me know if that corresponds to what you had in mind.

Release Note

NONE

Copy link
Member

@zregvart zregvart left a comment

Choose a reason for hiding this comment

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

Something like this using a mutex to lock on the first write to hasServerSideApply in order to prevent multiple gorutines competing to write to it. Written from the top of my head, might not compile...

Feel free to disregard the whole idea if you think it complicates the implementation needlessly. This will have (perhaps a slight) impact on startup performance, as all goroutines will wait for the first one to complete before running.

pkg/install/kamelets.go Show resolved Hide resolved
pkg/install/kamelets.go Outdated Show resolved Hide resolved
pkg/install/kamelets.go Show resolved Hide resolved
pkg/install/kamelets.go Outdated Show resolved Hide resolved
pkg/install/kamelets.go Outdated Show resolved Hide resolved
@astefanutti
Copy link
Member Author

astefanutti commented Dec 9, 2021

@zregvart I've taken on your idea to use a mutex, and I've gone for using sync.Once, which encapsulates the mutex, and exposes just the right semantic for doing the SSA attempt / fallback logic only once.

Interestingly, the installation of the 137 bundled Kamelets now takes less than 200ms on my computer using Minikube, which is less than what I observed without the extra synchronisation. That being said, we're probably inside the measurement margin error, but at least the impact is either negligible or positive.

@astefanutti astefanutti changed the title chore: Use atomic.Value for client-side apply fallback chore: Try SSA for Kamelet install only once Dec 9, 2021
Copy link
Member

@zregvart zregvart left a comment

Choose a reason for hiding this comment

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

Sweet!

@astefanutti astefanutti merged commit 23401b2 into apache:main Dec 9, 2021
@astefanutti astefanutti deleted the pr-353 branch December 9, 2021 13:25
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.

None yet

2 participants