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

[pkg/stanza] json_parser is a GC hot spot #33784

Closed
atoulme opened this issue Jun 27, 2024 · 1 comment · Fixed by #33785
Closed

[pkg/stanza] json_parser is a GC hot spot #33784

atoulme opened this issue Jun 27, 2024 · 1 comment · Fixed by #33785
Labels
bug Something isn't working pkg/stanza

Comments

@atoulme
Copy link
Contributor

atoulme commented Jun 27, 2024

Component(s)

pkg/stanza

What happened?

Description

json_parser is a hot spot under high load as it allocates too many objects.

The problem is exacerbated by the json library used as it is not optimized to handle the creation of a []byte slice that is not preallocated, creating many copies as it is resized.

https://github.com/json-iterator/go/blob/71ac16282d122fdd1e3a6d3e7f79b79b4cc3b50e/iter_str.go#L35

Steps to Reproduce

Expected Result

Actual Result

Collector version

v0.103.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

@atoulme atoulme added the bug Something isn't working label Jun 27, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg/stanza
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant