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

compute/metadata: binary size increase by 6.5Mb after the commit 81c6039503121f8da3de4f4cd957b8488a3ef620 #4783

Closed
valyala opened this issue Sep 21, 2021 · 2 comments · Fixed by #4784
Assignees
Labels
api: compute Issues related to the Compute Engine API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@valyala
Copy link

valyala commented Sep 21, 2021

We at VictoriaMetrics use golang.org/x/oauth2/google package here for obtaining metada from Google Compute Engine. The golang.org/x/oauth2/google package imports cloud.google.com/go/compute/metadata package. The commit 81c6039 adds an additional dependency to this package - github.com/googleapis/gax-go/v2. This dependency increased VictoriaMetrics binary size by 6.5Mb after we upgraded cloud.google.com/go dependency from v0.93.3 to v0.94.1 in the commit VictoriaMetrics/VictoriaMetrics@2814388 . This is more than 30% of binary size increase. We try hard keeping dependency bloat at minimum - see https://valyala.medium.com/stripping-dependency-bloat-in-victoriametrics-docker-image-983fb5912b0d . So it would be great if you could reduce the compute/metadata dependency size to pre-v0.94.0 sizes.

Possible solutions:

  • Remove the dependency on github.com/googleapis/gax-go/v2 from compute/metadata package. It is used for gax.Sleep() call, which can be easily embedded inside the cloud.google.com/go package.
  • Restructure the github.com/googleapis/gax-go/v2 package, so it doesn't include unneeded bloat by default when imported.

Related issue #4642 .

@valyala valyala added the triage me I really want to be triaged. label Sep 21, 2021
@product-auto-label product-auto-label bot added the api: compute Issues related to the Compute Engine API. label Sep 21, 2021
@codyoss codyoss added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Sep 21, 2021
@codyoss codyoss self-assigned this Sep 21, 2021
@codyoss
Copy link
Member

codyoss commented Sep 21, 2021

@valyala Thanks for reporting this. I agree that this seems like a lot of extra bloat for just adding some retries. I think we can do some refactoring here to make this package lighter again.

valyala added a commit to VictoriaMetrics/VictoriaMetrics that referenced this issue Sep 21, 2021
…e binary size bloat issue is resolved

This returns back VictoriaMetrics binary size from 24Mb to 18Mb.

See googleapis/google-cloud-go#4783
valyala added a commit to VictoriaMetrics/VictoriaMetrics that referenced this issue Sep 21, 2021
…e binary size bloat issue is resolved

This returns back VictoriaMetrics binary size from 24Mb to 18Mb.

See googleapis/google-cloud-go#4783
gcf-merge-on-green bot pushed a commit that referenced this issue Sep 21, 2021
Because of how the gax package is structured today it ends up
pulling in proto and gRPC which can add a lot of extra deps to the
tree if all you really need is this package.

Fixes: #4783
@codyoss
Copy link
Member

codyoss commented Sep 21, 2021

This has been released under: https://github.com/googleapis/google-cloud-go/releases/tag/v0.95.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants