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

feat(cli): reduce binary size by 1/3 #3244

Closed
wants to merge 1 commit into from

Conversation

squakez
Copy link
Contributor

@squakez squakez commented Apr 28, 2022

Adding -s and -w flag reduce significatively the size of the output (52 vs 73 MiB)

$ ll kamel -h
-rwxrwxr-x 1 squake squake 73M abr 28 16:47 kamel*

vs

$ ll kamel -h
-rwxrwxr-x 1 squake squake 52M abr 28 16:50 kamel*

Release Note

feat(cli): reduce binary size by 1/3

Adding -s and -w flag reduce significatively the size of the output (52 vs 74 MiB)
@claudio4j
Copy link
Contributor

It seems these flags just remove debugging information from the final binary file. So if developers want to debug kamel or operator binary, these flags should not be used.

@squakez
Copy link
Contributor Author

squakez commented May 4, 2022

It seems these flags just remove debugging information from the final binary file. So if developers want to debug kamel or operator binary, these flags should not be used.

Thanks for having a look. The meaning of those flags can be found here: https://pkg.go.dev/cmd/link .I am not sure how much of that information is actually used by our troubleshooting operations. I made some test and, apparently, we still manage to get the error traces. Actually I don't know what we really loose in order to measure the tradeoff.

@squakez
Copy link
Contributor Author

squakez commented May 5, 2022

@astefanutti what do you think about this possible improvements? do you have any familiarity with it?

@astefanutti
Copy link
Member

@squakez thanks for this proposal.

On one hand, removing the debug symbol is probably acceptable.

On the other hand, for the operator part, what really matters IMO is the size of the container image, which reduces/dilutes the benefit of these flags. For the CLI part of the binary, it seems providing a CLI only binary would be an even better solution, size-wise, granted it's more work than adding some build flags.

It's not clear to me what are the consequences of the -s flag.

Last but not least, I haven't seen these flags being used in other projects, but maybe I overlooked it.

@squakez
Copy link
Contributor Author

squakez commented May 10, 2022

Thanks for the review @astefanutti. Yeah, I don't have much experience on golang projects, reason why I was asking your review. I agree about the opportunity to reduce the CLI size only (see #3175), but in the while, I wonder if we can try experimenting with this and collect feedback (complains!?). Reverting the change would be quick.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2022

This PR has been automatically marked as stale due to 90 days of inactivity.
It will be closed if no further activity occurs within 15 days.
If you think that’s incorrect or the issue should never stale, please simply write any comment.
Thanks for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants