From 053ab2e47a22c6f22e6587dcde77e13fd48b82fa Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Wed, 5 Jan 2022 11:52:01 +0100 Subject: [PATCH 1/4] Fix #128: Improve Docker container footprint by switching to OpenJ9 --- .env | 4 ++-- docker-powerauth-data-adapter/Dockerfile | 4 ++-- docker-powerauth-nextstep/Dockerfile | 4 ++-- docker-powerauth-push-server/Dockerfile | 4 ++-- docker-powerauth-server/Dockerfile | 4 ++-- docker-powerauth-tpp-engine/Dockerfile | 4 ++-- docker-powerauth-webflow/Dockerfile | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.env b/.env index c925caa..93b6332 100644 --- a/.env +++ b/.env @@ -1,8 +1,8 @@ # Java options -POWERAUTH_JAVA_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -Xmx750m +POWERAUTH_JAVA_OPTS=-Xshareclasses -Xscmx50M # Memory settings -JAVA_PROCESS_MEMORY_LIMIT=786432000 +JAVA_PROCESS_MEMORY_LIMIT=524288000 # Configuration for PostgreSQL database related to PowerAuth Server POWERAUTH_POSTGRESQL_PATH=/var/lib/powerauth/postgresql-pas diff --git a/docker-powerauth-data-adapter/Dockerfile b/docker-powerauth-data-adapter/Dockerfile index 8d2390f..0e8a542 100644 --- a/docker-powerauth-data-adapter/Dockerfile +++ b/docker-powerauth-data-adapter/Dockerfile @@ -1,8 +1,8 @@ -FROM tomcat:9-jdk11 +FROM tomcat:jdk11-adoptopenjdk-openj9 LABEL maintainer="petr@wultra.com" # Prepare environment variables -ENV JAVA_HOME /usr/local/openjdk-11 +ENV JAVA_HOME /opt/java/openjdk ENV TOMCAT_HOME /usr/local/tomcat # Clear root context diff --git a/docker-powerauth-nextstep/Dockerfile b/docker-powerauth-nextstep/Dockerfile index 91ca0f0..e6f77fc 100644 --- a/docker-powerauth-nextstep/Dockerfile +++ b/docker-powerauth-nextstep/Dockerfile @@ -1,8 +1,8 @@ -FROM tomcat:9-jdk11 +FROM tomcat:jdk11-adoptopenjdk-openj9 LABEL maintainer="petr@wultra.com" # Prepare environment variables -ENV JAVA_HOME /usr/local/openjdk-11 +ENV JAVA_HOME /opt/java/openjdk ENV TOMCAT_HOME /usr/local/tomcat # Clear root context diff --git a/docker-powerauth-push-server/Dockerfile b/docker-powerauth-push-server/Dockerfile index 9736c91..de449e2 100644 --- a/docker-powerauth-push-server/Dockerfile +++ b/docker-powerauth-push-server/Dockerfile @@ -1,8 +1,8 @@ -FROM tomcat:9-jdk11 +FROM tomcat:jdk11-adoptopenjdk-openj9 LABEL maintainer="petr@wultra.com" # Prepare environment variables -ENV JAVA_HOME /usr/local/openjdk-11 +ENV JAVA_HOME /opt/java/openjdk ENV TOMCAT_HOME /usr/local/tomcat # Clear root context diff --git a/docker-powerauth-server/Dockerfile b/docker-powerauth-server/Dockerfile index 259463d..6b206ee 100644 --- a/docker-powerauth-server/Dockerfile +++ b/docker-powerauth-server/Dockerfile @@ -1,8 +1,8 @@ -FROM tomcat:9-jdk11 +FROM tomcat:jdk11-adoptopenjdk-openj9 LABEL maintainer="petr@wultra.com" # Prepare environment variables -ENV JAVA_HOME /usr/local/openjdk-11 +ENV JAVA_HOME /opt/java/openjdk ENV TOMCAT_HOME /usr/local/tomcat # Clear root context diff --git a/docker-powerauth-tpp-engine/Dockerfile b/docker-powerauth-tpp-engine/Dockerfile index 2964d6b..93e372e 100644 --- a/docker-powerauth-tpp-engine/Dockerfile +++ b/docker-powerauth-tpp-engine/Dockerfile @@ -1,8 +1,8 @@ -FROM tomcat:9-jdk11 +FROM tomcat:jdk11-adoptopenjdk-openj9 LABEL maintainer="petr@wultra.com" # Prepare environment variables -ENV JAVA_HOME /usr/local/openjdk-11 +ENV JAVA_HOME /opt/java/openjdk ENV TOMCAT_HOME /usr/local/tomcat # Clear root context diff --git a/docker-powerauth-webflow/Dockerfile b/docker-powerauth-webflow/Dockerfile index 54e6e4e..bb0f883 100644 --- a/docker-powerauth-webflow/Dockerfile +++ b/docker-powerauth-webflow/Dockerfile @@ -1,8 +1,8 @@ -FROM tomcat:9-jdk11 +FROM tomcat:jdk11-adoptopenjdk-openj9 LABEL maintainer="petr@wultra.com" # Prepare environment variables -ENV JAVA_HOME /usr/local/openjdk-11 +ENV JAVA_HOME /opt/java/openjdk ENV TOMCAT_HOME /usr/local/tomcat ENV WEBFLOW_RESOURCES /opt/ext-resources From a1e6629d13a0dbd6146046bbaec00148f232a756 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Wed, 5 Jan 2022 11:54:48 +0100 Subject: [PATCH 2/4] Re-add memory limit to avoid out of memory exceptions --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 93b6332..d387dcd 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ # Java options -POWERAUTH_JAVA_OPTS=-Xshareclasses -Xscmx50M +POWERAUTH_JAVA_OPTS=-Xshareclasses -Xscmx50M -Xmx500m # Memory settings JAVA_PROCESS_MEMORY_LIMIT=524288000 From 61e63d3f492fe508de48c9e944dd06fa23341795 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Wed, 5 Jan 2022 12:07:59 +0100 Subject: [PATCH 3/4] Disable class sharing for now --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index d387dcd..72968a5 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ # Java options -POWERAUTH_JAVA_OPTS=-Xshareclasses -Xscmx50M -Xmx500m +POWERAUTH_JAVA_OPTS=-Xmx500m # Memory settings JAVA_PROCESS_MEMORY_LIMIT=524288000 From 96eb337783644ddf241aad0f547551265f5618a4 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Wed, 5 Jan 2022 13:25:24 +0100 Subject: [PATCH 4/4] Avoid Out of memory exception when Java process size reaches mem_limit --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 72968a5..09ba744 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ # Java options -POWERAUTH_JAVA_OPTS=-Xmx500m +POWERAUTH_JAVA_OPTS=-Xmx450m # Memory settings JAVA_PROCESS_MEMORY_LIMIT=524288000