chore(api): cap JVM heap at 6% of host via JAVA_TOOL_OPTIONS #1246
Loading…
Reference in a new issue
No description provided.
Delete branch "chore/api-heap-cap"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Production
memories-apiRSS measured 4.68 GiB (2026-10-15) on a 46 GiB host. Oracle diagnosis (ora-1): not a leak — G1 high-water mark:-Xmx, so the JVM defaultMaxRAMPercentage=25applies to the host → max heap ≈ 11.7 GiB./proc/1/mapsshows an 11,536 MB PROT_NONE G1 reservation (JRE-only image, no jcmd).owner_face_recognitionPOSTs with 512-dim boxed embeddings + full-pool embeddings GET) push G1 to ~4 GiB committed, which it never uncommits (G1PeriodicGCdefault off) → RSS ratchets across container lifetime: 408 MB @5min fresh → 1.15 GiB @35min baseline → 4.68 GiB after 3 recognition transients in one evening.Fix
One env line in
deploy/compose.yaml:JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=6 -XX:InitialRAMPercentage=2(≈2.8 GiB max, overridable viaMEMORIES_API_JAVA_TOOL_OPTIONS).Out of scope (deliberately)
G1PeriodicGCIntervaluncommit tuning (aesthetic; rec #1 bounds RSS already)jvm_memory_usedmetrics exposure — separate small change if wanted