fix(probes): mongod exec 프로브 창 확대 + mongot 자원 지정 - #404
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
라이브에서 mongod 파드가 만성 재시작했는데, 죽인 것은 OOM 이 아니라 프로브였다. exec liveness 가 mongosh 를 띄우는데 mongosh 는 Node.js 런타임이라 붙기 전에 기동 비용부터 든다(정상 노드 실측 ~0.6s). 노드의 컨테이너 exec 경로가 잠깐 막히면 프로브만 느려지는데, 5s 타임아웃은 그 스파이크를 DB 장애로 오독해 SIGKILL 을 불렀다. 판별 근거 3종(2026-08-25 실측): - exit 137 인데 reason 은 OOMKilled 가 아니라 Error — cgroup OOM 킬러가 아니라 kubelet 이 죽였다. 이벤트도 "failed liveness probe" 를 지목한다. - 클러스터 exec 타임아웃 10,007건 중 99.6%가 단일 노드에 몰렸고, 그 노드의 파드 70개 중 Unhealthy 를 낸 5건이 전부 무거운 바이너리를 띄우는 exec 프로브다. httpGet·tcpSocket 프로브 65개는 0건. - 해당 컨테이너의 cgroup cpu.stat 스로틀 비율은 1.0~1.2% — 자원 부족이 아니다. 시간축을 명명 상수 하나로 모으고 창을 넓혔다. liveness 는 hang 판정에 실제 ping 이 필요하므로 exec 을 유지한다 — TCP 는 멈춘 mongod 도 accept 한다. 같은 파일의 mongos 가 이미 이 교훈을 반영하고 있었는데 cfg 와 shard 만 구 설정에 남아 있었다. 두 번째 결함은 같은 파드의 mongot 사이드카에 requests·limits 가 아예 없던 것이다. mongot 은 JVM 인데 -Xmx 를 주지 않으므로 힙 상한을 컨테이너 cgroup 에서 읽는다. limit 이 없으면 노드 전체 RAM 기준으로 잡는다 — 실측 15본이 571Mi~3956Mi 로 제각각 부풀었고 상한을 아무도 몰랐다. 이 컨테이너 하나 때문에 파드 QoS 가 Burstable 로 떨어져 mongod 까지 축출 후보가 된다. 사유와 대안 비교는 ADR-0042 에 있다. 창을 다시 좁히면 internal/resources/builder_probe_timing_test.go 가 실패한다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbPL3ACkTc18bnwYUd7G3w Signed-off-by: phil <phil@keiailab.com>
eightynine01
force-pushed
the
fix/mongod-probe-timing-gh
branch
from
August 25, 2026 23:24
673bfa0 to
9957b48
Compare
Merged
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.
무엇을 고치나
mongod 의 exec liveness/readiness 프로브 시간축을 명명 상수 하나로 모으고 창을 넓힌다.
같은 pod 의 mongot 사이드카에 requests·limits 를 지정한다.
mongosh 를 부르는 전 프로브에
--norc추가 — 이 파일의 mongos 가 이미 쓰던 규약이다.왜
라이브에서 mongod 파드가 만성 재시작했는데 죽인 것은 OOM 이 아니라 프로브였다.
exec 프로브가 띄우는 mongosh 는 Node.js 런타임이라 붙기 전에 기동 비용부터 든다
(정상 노드 실측 ~0.6s). 노드의 컨테이너 exec 경로가 잠깐 막히면 프로브만 느려지는데,
5s 타임아웃이 그 스파이크를 DB 장애로 오독했다.
판별 근거 3종 (2026-08-25 실측):
exit 137인데reason은OOMKilled가 아니라Error— cgroup OOM 킬러가 아니라kubelet 이 죽였다. 이벤트가 출처를 지목한다:
Killing / Container mongodb failed liveness probe, will be restartedUnhealthy / Liveness probe failed: command timed out ... after 5sUnhealthy 를 낸 5건이 전부 무거운 바이너리를 띄우는 exec 프로브였고
(mongosh,
bao status), httpGet·tcpSocket 프로브를 쓰는 65개는 0건이다.cpu.stat스로틀 비율은 1.0~1.2% — 자원 부족이 아니다.즉 노드의 exec 경로가 간헐적으로 막히는 것이고, mongod 는 멀쩡했다.
데이터베이스 재시작은 싸지 않다(선거·초기 동기화 위험·mongos 순단). 스테이트풀 워크로드의
liveness 는 확실할 때만 발화해야 한다.
liveness 의 exec 은 유지한다 — hang 판정에는 실제 ping 이 필요하고, TCP 는 멈춘 mongod 도
accept 한다. mongos(무상태 라우터)가 TCP 를 쓰는 것과 이유가 다르다.
mongot 자원
같은 조사에서 나온 두 번째 결함이다.
MongotSidecar가 만드는 컨테이너에 requests·limits 가아예 없었다. mongot 은 JVM 인데
-Xmx를 주지 않으므로 힙 상한을 컨테이너 cgroup 에서 읽는다(
UseContainerSupport) — limit 부재 = 힙 상한 부재이고 노드 전체 RAM 을 기준으로 잡는다.실측 15본이 571Mi~3956Mi 로 제각각 부풀었고 상한을 아무도 몰랐다. 파드 QoS 도 이 컨테이너
하나 때문에 Burstable 로 떨어져 노드 압박 시 mongod 까지 축출 후보가 된다.
limit 은 mongod 와 같은 눈금(6Gi)으로 둔다 — mongot 은 Lucene mmap 이라 페이지 캐시가 cgroup 에
함께 계상되므로, 여유 없는 상한은 인덱스 페이지를 계속 회수시켜 검색을 느리게 한다.
테스트
internal/resources/builder_probe_timing_test.go— RS / configServer / shard 3경로의period·timeout·failureThreshold 와
--norc를 고정. mongot requests·limits 비어있지 않음 단언.구 값(period 10s)으로 되돌려 가드가 실제로 실패하는 것을 확인했다:
go vet·gofmt통과. envtest 스위트는 이 환경에 etcd 바이너리가 없어 변경 전 트리에서도동일하게 실패한다.
사유와 대안 비교는
docs/kb/adr/0042-mongod-exec-probe-timing.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01VbPL3ACkTc18bnwYUd7G3w