fix: memory bloat from unlimited JVM heap and missing HTTP Range support
Build & Deploy / build-and-deploy (push) Failing after 35s
Build & Deploy / build-and-deploy (push) Failing after 35s
Two root causes for memory growing to 1.7GB and never shrinking: 1. No -Xmx limit (Dockerfile): JVM grew its heap without bound after processing large uploads and never returned memory to the OS. Now capped at 128MB with G1GC periodic GC every 30s to shrink when idle. 2. Broken HTTP Range (StaticResource): The server advertised Accept-Ranges: bytes but didn't actually handle Range headers — every request sent the entire .jsdos file (up to 1.2GB for GTA). The OS cached the full file in page cache, which counts against Docker container memory and persists after play stops. js-dos v7 loads .jsdos via Range requests (lazy ZIP loading). Now properly parses Range: bytes=start-end headers, responds with 206 Partial Content, and seeks to exact offsets in the file — only the requested bytes stream through, keeping page cache minimal.
This commit is contained in:
+4
-1
@@ -25,4 +25,7 @@ COPY --from=build /build/target/quarkus-app/ /app/
|
||||
EXPOSE 8765
|
||||
VOLUME /data
|
||||
ENV DOSTALGIA_DATA_DIR=/data
|
||||
ENTRYPOINT ["java", "-jar", "quarkus-run.jar"]
|
||||
# Limit JVM heap — the app streams everything (upload/serve) so 128MB is plenty
|
||||
# G1GC with periodic GC allows heap to shrink when idle
|
||||
ENTRYPOINT ["java", "-Xmx128m", "-Xms64m", "-XX:+UseG1GC", "-XX:G1PeriodicGCInterval=30000",
|
||||
"-jar", "quarkus-run.jar"]
|
||||
|
||||
Reference in New Issue
Block a user