Skip to content

fix(k8s): cut prod Elasticsearch heap to 4g - #110

Merged
rhanka merged 1 commit into
mainfrom
chore/es-heap-4g
Sep 14, 2026
Merged

rhanka merged 1 commit into
mainfrom
chore/es-heap-4g

Conversation

@rhanka

@rhanka rhanka commented Sep 14, 2026

Copy link
Copy Markdown
Member

Why

On the prod node (4 vCPU / 16 GiB, ES cgroup limited to 13Gi), a 6g heap left only ~6.8 GB of page cache for a 15.2 GB index. The node ran at ~74% iowait, the ES search thread pool saturated, and API p95 was several seconds.

Measured old-gen usage was 224 MB with zero full GCs, so 6g was heavily oversized. Cutting to 4g frees ~2 GB back into page cache.

Measured effect in prod

metric before after
iowait 74% 5%
idle 1.6% 75%
search pool queue saturated 0
/search median — 1 ms
/search p95 several seconds 289 ms

Measured over 1016 real requests.

Note

The change was already applied live to the prod StatefulSet via kubectl patch. This commit brings git in line with the running cluster.

Changes

  • deploy/k8s/overlays/prod/elasticsearch.prod.yaml: ES_JAVA_OPTS -Xms6g -Xmx6g -> -Xms4g -Xmx4g
  • deploy/k8s/tests/prod-manifest.sh: pin the rendered value so the heap cannot silently drift back

Tests

  • deploy/k8s/tests/prod-manifest.sh — pass
  • deploy/k8s/tests/prod-secrets-preflight.sh — pass
  • deploy/k8s/tests/prod-publication-guardrails.sh — fails identically on pristine main (dataprep-monthly must scan every 4 hours); pre-existing and unrelated to this change

On the prod node (4 vCPU / 16 GiB, ES cgroup limited to 13Gi), a 6g heap
left only ~6.8 GB of page cache for a 15.2 GB index. The node ran at ~74%
iowait and the ES search thread pool saturated; API p95 was several
seconds.

Measured old-gen usage was 224 MB with zero full GCs, so 6g was heavily
oversized. Cutting to 4g frees ~2 GB back into page cache.

Measured after applying in prod: iowait 74% -> 5%, idle 1.6% -> 75%,
search pool queue drained to 0, /search median 1 ms and p95 289 ms over
1016 real requests.

The change was already applied live to the prod StatefulSet via
kubectl patch; this commit brings git in line with the running cluster.

deploy/k8s/tests/prod-manifest.sh pins the rendered value so the heap
cannot silently drift back.
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: b4837694-2648-4718-98d8-13084d0c8980


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rhanka
rhanka merged commit 605a147 into main Sep 14, 2026
11 checks passed
@rhanka
rhanka deleted the chore/es-heap-4g branch September 14, 2026 15:28
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.

2 participants