helm: derive memcached's -m flag from resources overrides to prevent OOM kills - #16348
Open
bharathjyothi wants to merge 3 commits into
Open
helm: derive memcached's -m flag from resources overrides to prevent OOM kills#16348bharathjyothi wants to merge 3 commits into
bharathjyothi wants to merge 3 commits into
Conversation
…t exceed the container's memory limit (grafana#9737)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Every memcached-backed cache (
chunks-cache,index-cache,metadata-cache,results-cache) alwayspassed
.allocatedMemoryto memcached's own-mflag, even when a user overrode.resourceswith alower memory limit. That mismatch let memcached grow past the container's real memory limit and get OOM
killed.
This PR derives
-mfromresources.limits.memory(falling back toresources.requests.memory) when.resourcesis overridden, using the existingmimir.siToByteshelper and the same 1.2x headroom ratiothe default path already uses. Behavior is unchanged when
.resourcesisn't overridden.Verified with
helm templateagainst everyci//ci/offlinefixture (no diffs) plus a new regressionfixture, and end-to-end on a real cluster below.
Before/after on a live cluster (100Mi memory limit, 300MB write load)
Before:
-m 8192→ podOOMKilled(exit 137) after ~95MB written.After:
-m 83→ all 300MB written, 0 restarts, memcached self-manages via LRU eviction(
limit_maxbytes: 87031808= 83MiB exactly,evictions: 218).Which issue(s) this PR fixes or relates to
Fixes #9737
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. If changelog entry is not needed, please add thechangelog-not-neededlabel to the PR.about-versioning.mdupdated with experimental features.