-
Notifications
You must be signed in to change notification settings - Fork 810
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
Fix memory leak in distributor due to cluster label #4739
Fix memory leak in distributor due to cluster label #4739
Conversation
15200a9
to
899cbce
Compare
LGTM |
@@ -19,3 +21,11 @@ func StringsMap(values []string) map[string]bool { | |||
} | |||
return out | |||
} | |||
|
|||
// StringsClone returns a copy input s | |||
// see: https://github.com/golang/go/blob/master/src/strings/clone.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-) nice! We should update Go one day.
899cbce
to
687f4e4
Compare
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
687f4e4
to
c876750
Compare
Thanks for this. Note we also have a function with the same intent here: cortex/pkg/ingester/index/index.go Lines 110 to 113 in 4e9fc3a
In Go it is fairly common to copy a tiny function rather than exposing it - "a little copying is better than a little dependency". |
What this PR does:
The HA cluster label is exposed through the distributor metrics. This can cause memory leak when one tenant sends a lot of different clusters. The metrics is only cleaned up after 30 mins.
The memory is leaked because the
yoloString
in the request is kept alive for a longer period.The following is the memory consumed by the distributor over time without cloning the cluster label.
The following is the memory consumed by distributor when cluster label was cloned.
The above leak in
snappyDecode
appears to have disappeared.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]