Skip to content

Commit 6faed3b

Browse files
perf(docker): pin JVM container memory limits to stop host oversubscription (#1410)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8e3618c commit 6faed3b

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

.changeset/jvm-memory-limits.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"hephaestus": minor
3+
---
4+
5+
The application-server, application-worker and webhook-server containers now have explicit memory
6+
limits, so each JVM sizes its heap for its own container instead of the whole host. Co-located
7+
services no longer oversubscribe host memory and push the box into swap.
8+
9+
**Operators:** defaults are webhook-server 1 GB, application-server 5 GB, application-worker 3 GB,
10+
overridable via `WEBHOOK_SERVER_MEM_LIMIT`, `APPLICATION_SERVER_MEM_LIMIT` and
11+
`APPLICATION_WORKER_MEM_LIMIT`. Keep the sum under the host's RAM; raise them on larger hosts.

docker/compose.app.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ services:
9393

9494
application-server:
9595
image: "ghcr.io/ls1intum/hephaestus/application-server:${IMAGE_TAG}"
96+
# Bounds heap sizing to this container; without it the JVM targets host RAM and co-located
97+
# services oversubscribe and swap. Hosts the NATS sync consumers, so it takes the largest limit.
98+
mem_limit: ${APPLICATION_SERVER_MEM_LIMIT:-5g}
9699
ports:
97100
- "8080"
98101
environment:
@@ -291,6 +294,8 @@ services:
291294
# Worker runtime — same image, worker profile, no HTTP server, dials the hub over WSS.
292295
application-worker:
293296
image: "ghcr.io/ls1intum/hephaestus/application-server:${IMAGE_TAG}"
297+
# Bounds heap sizing to this container (see application-server).
298+
mem_limit: ${APPLICATION_WORKER_MEM_LIMIT:-3g}
294299
environment:
295300
APP_VERSION: ${IMAGE_TAG}
296301
SPRING_PROFILES_ACTIVE: prod,worker

docker/compose.core.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ services:
88
# ─────────────────────────────────────────────────────────────────────────────
99
webhook-server:
1010
image: "ghcr.io/ls1intum/hephaestus/application-server:${IMAGE_TAG}"
11+
# Bounds heap sizing to this container; without it the JVM targets host RAM and co-located
12+
# services oversubscribe and swap. Webhook only receives and republishes, so its heap is small.
13+
mem_limit: ${WEBHOOK_SERVER_MEM_LIMIT:-1g}
1114
expose:
1215
- "8080"
1316
environment:

0 commit comments

Comments
 (0)