You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The github.com/goccy/go-json module contains an init() function which warms up a cache even if the module is never used. I believe this causes around 20 MB of memory per Collector instance. This is an issue for users who run many instances of the Collector. If you run hundreds of instances, 20 MB per instance adds up to a lot.
Currently, github.com/goccy/go-json seems to be used only by the Splunk HEC Exporter, Stanza, and OTTL. I suppose all other functionality doesn't need the cache.
There is a PR opened upstream to improve the cache so that it is loaded lazily - only if goccy/go-json is used.
There are a few solutions to this problem:
Wait for the upstream fix to be merged and update the github.com/goccy/go-json version which Collector uses.
Add build directives so that github.com/goccy/go-json is not used for certain builds. This is similar to the goccy_gojson build tag used in datadog-api-client-go and the arrow_json_stdlibbuild tag. I suspect that's not an option for the Collector though. I suspect this is not an option for the collector though.
To reproduce the issue, run a configuration like this one:
Component(s)
No response
Describe the issue you're reporting
The
github.com/goccy/go-json
module contains aninit()
function which warms up a cache even if the module is never used. I believe this causes around 20 MB of memory per Collector instance. This is an issue for users who run many instances of the Collector. If you run hundreds of instances, 20 MB per instance adds up to a lot.Currently,
github.com/goccy/go-json
seems to be used only by the Splunk HEC Exporter, Stanza, and OTTL. I suppose all other functionality doesn't need the cache.There is a PR opened upstream to improve the cache so that it is loaded lazily - only if
goccy/go-json
is used.There are a few solutions to this problem:
github.com/goccy/go-json
version which Collector uses.goccy/go-json
with a lazy cache, similar to grafana/grafana and grafana/alloy.github.com/goccy/go-json
is not used for certain builds. This is similar to thegoccy_gojson
build tag used in datadog-api-client-go and thearrow_json_stdlib
build tag. I suspect that's not an option for the Collector though. I suspect this is not an option for the collector though.To reproduce the issue, run a configuration like this one:
Then get a memory pprof:
Then view it in Pyroscope:
The text was updated successfully, but these errors were encountered: