From 63dde4bb831a13b62161289385b2c4ddbcc4ddf9 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Wed, 3 Feb 2016 14:35:02 -0500 Subject: [PATCH] Customize GC behavior differently By default, the JVM does not free allocated heap back to the OS. This configures away from that behavior, hopefully to prevent OOM engine errors. It replaces the existing configuration which put absolute size limits on the heap. See http://www.stefankrause.net/wp/?p=14 for details on the specific options chosen. This configuration brought my test repository's memory usage down from ~700MB to ~250MB. Its graph also shows most closely the pattern we'd prefer: the slope of allocated heap closely matching used. --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f5d5f9d8..090d3718 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,6 @@ RUN npm install USER app -# starting heap, max heap -ENV JAVA_OPTS="-Xms512m -Xmx1280m" +ENV JAVA_OPTS="-XX:+UseParNewGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10" CMD ["/usr/src/app/bin/duplication"]