Skip to content

Reduce memory usage from ingester Push() errors#1922

Merged
bboreham merged 3 commits intomasterfrom
smaller-ingester-push-errors
Dec 18, 2019
Merged

Reduce memory usage from ingester Push() errors#1922
bboreham merged 3 commits intomasterfrom
smaller-ingester-push-errors

Conversation

@bboreham
Copy link
Contributor

Fixes #1301

There is quite a lot of refactoring here, pulling out various things into helper functions in a new file errors.go. Also I moved a couple of places that the discarded samples metric is incremented for consistency.

I'm not very clear why we need "httpgrpc" at all here, as Push() is only called over gRPC, but left that for another day.

Benchmark before:

BenchmarkIngesterPushErrors  10  154925847 ns/op  137223744 B/op  516830 allocs/op

after:

BenchmarkIngesterPushErrors  50  33549567 ns/op    4411341 B/op    64796 allocs/op

Signed-off-by: Bryan Boreham <bryan@weave.works>
Signed-off-by: Bryan Boreham <bryan@weave.works>
…tion

It's more efficient to defer constructing the httpgrpc error until the
end, because we only report the last error out of possibly hundreds.

Signed-off-by: Bryan Boreham <bryan@weave.works>
@bboreham bboreham force-pushed the smaller-ingester-push-errors branch from dd8f7c4 to d4cd56c Compare December 18, 2019 13:01
Copy link
Contributor

@khaines khaines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bboreham bboreham merged commit d57fe0f into master Dec 18, 2019
@bboreham bboreham deleted the smaller-ingester-push-errors branch December 18, 2019 17:42
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.

Ingestion latency spikes when discarding metrics due to limits

2 participants