Skip to content

Decode Prometheus /series response from stream#2

Draft
github-vincent-miszczak wants to merge 2 commits intomainfrom
prometheus-find-decode-stream
Draft

Decode Prometheus /series response from stream#2
github-vincent-miszczak wants to merge 2 commits intomainfrom
prometheus-find-decode-stream

Conversation

@github-vincent-miszczak
Copy link
Copy Markdown
Owner

@github-vincent-miszczak github-vincent-miszczak commented Mar 26, 2021

When working with millions of series the memory goes crazy (tens of gigabytes)
There are at least 2 issues:

  • HTTP responses are transformed from io.Reader to plain string
  • Decoding large JSON arrays with a naive json.Unmarshal() uses a lot of memory

This PR optimizes memory usage by decoding the response stream as it comes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant