Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Datadog surfacer makes cloudprober binary too big #628

Closed
manugarg opened this issue Jul 16, 2021 · 2 comments
Closed

Datadog surfacer makes cloudprober binary too big #628

manugarg opened this issue Jul 16, 2021 · 2 comments
Assignees
Milestone

Comments

@manugarg
Copy link
Contributor

manugarg commented Jul 16, 2021

Datadog surfacer, added in #627, makes cloudprober binary size go from 35.7 MB to 43.7 MB (zipped 14.3 MB to 16.5 MB), that's more than 22% (15% for zipped version) increase in binary size, just for one surfacer. I believe this is due to monolithic datadog API package. We should look at avoiding the library package and using the HTTP REST API directly.

CC: @c6h12o6

@manugarg manugarg self-assigned this Jul 16, 2021
@manugarg
Copy link
Contributor Author

I've a change that fixes this. I'll submit it tomorrow.

manugarg added a commit that referenced this issue Jul 20, 2021
This change brings binary size back to 52M (from 61M). We need only 1% of the datadog API client's functionality and using it increases binary size by 17% to 22% (Ref: #628).

I believe this is happening because in datadog API client library, basic symbols like APIClient or Configuration refer to a lot of other symbols[1]. This means that even after compilation and linking, almost all the symbols become part of the generated binary.

I've verified that surfacer continues to work after this change.

[1] - https://github.com/DataDog/datadog-api-client-go/blob/5c76e2376ad3d1ceba0eb1199bf9447808e88948/api/v1/datadog/client.go#L43

PiperOrigin-RevId: 385683900
manugarg added a commit that referenced this issue Jul 20, 2021
This change brings binary size back to 52M (from 61M). We need only 1% of the datadog API client's functionality and using it increases binary size by 17% to 22% (Ref: #628).

I believe this is happening because in datadog API client library, basic symbols like APIClient or Configuration refer to a lot of other symbols[1]. This means that even after compilation and linking, almost all the symbols become part of the generated binary.

I've verified that surfacer continues to work after this change.

[1] - https://github.com/DataDog/datadog-api-client-go/blob/5c76e2376ad3d1ceba0eb1199bf9447808e88948/api/v1/datadog/client.go#L43

PiperOrigin-RevId: 385683900
manugarg added a commit that referenced this issue Jul 20, 2021
This change brings binary size back to 52M (from 61M). We need only 1% of the datadog API client's functionality and using it increases binary size by 17% to 22% (Ref: #628).

I believe this is happening because in datadog API client library, basic symbols like APIClient or Configuration refer to a lot of other symbols[1]. This means that even after compilation and linking, almost all the symbols become part of the generated binary.

I've verified that surfacer continues to work after this change.

[1] - https://github.com/DataDog/datadog-api-client-go/blob/5c76e2376ad3d1ceba0eb1199bf9447808e88948/api/v1/datadog/client.go#L43

PiperOrigin-RevId: 385683900
manugarg added a commit that referenced this issue Jul 20, 2021
This change brings binary size back to 52M (from 61M). We need only 1% of the datadog API client's functionality and using it increases binary size by 17% to 22% (Ref: #628).

I believe this is happening because in datadog API client library, basic symbols like APIClient or Configuration refer to a lot of other symbols[1]. This means that even after compilation and linking, almost all the symbols become part of the generated binary.

I've verified that surfacer continues to work after this change.

[1] - https://github.com/DataDog/datadog-api-client-go/blob/5c76e2376ad3d1ceba0eb1199bf9447808e88948/api/v1/datadog/client.go#L43

PiperOrigin-RevId: 385683900
@manugarg
Copy link
Contributor Author

manugarg commented Jul 20, 2021

Binary size is back to 14.3 MB zipped, 43.8 MB unzipped.

@manugarg manugarg added this to the v0.11.3 milestone Jul 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant