Skip to content

Commit 84effb4

Browse files
committed
Override MaxRAMPercentage
Override MaxRAMPercentage for JVMs invoked by Maven to avoid attempting to use too much of the pod RAM. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent 068f897 commit 84effb4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

modules/maven/default/artifacts/opt/jboss/container/maven/default/maven.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function maven_init_var_MAVEN_SETTINGS_XML() {
3434
}
3535

3636
function maven_init_var_MAVEN_OPTS() {
37-
export MAVEN_OPTS="${MAVEN_OPTS:-$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options)}"
37+
export MAVEN_OPTS="${MAVEN_OPTS:-$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) -XX:MaxRAMPercentage=25.0}"
3838
}
3939

4040
function maven_init_var_MAVEN_ARGS() {

tests/features/java/memory.feature

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
@ubi9
21
Feature: OPENJDK-559 JVM Memory tests
32

3+
@ubi9
44
Scenario: Check default JVM max heap configuration
55
Given container is started as uid 1000
66
Then container log should contain -XX:MaxRAMPercentage=80.0
77

8+
@ubi9
89
Scenario: Check configured JVM max heap configuration
910
Given container is started with env
1011
| variable | value |
1112
| JAVA_MAX_MEM_RATIO | 90.0 |
1213
Then container log should contain -XX:MaxRAMPercentage=90.0
1314

15+
@ubi9
1416
Scenario: Check default JVM initial heap configuration is unspecified
1517
Given container is started as uid 1000
1618
Then container log should not contain -XX:InitialRAMPercentage
1719
And container log should not contain -Xms
20+
21+
# Not the runtime images
22+
@ubi9/openjdk-11
23+
@ubi9/openjdk-17
24+
Scenario: Ensure Maven doesn't use MaxRAMPercentage=80
25+
Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple
26+
Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$

0 commit comments

Comments
 (0)