Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated java options manage. Fixes #229 #231

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rigazilla
Copy link
Contributor

@rigazilla rigazilla commented May 29, 2024

Updates java-opts.sh with the latest from run-java.sh
unfortunately run-java.sh funcs cannot be imported without execute the script, so copy is needed

@rigazilla
Copy link
Contributor Author

Difference between old and new opts list
OLD
2024-05-30 08:47:19,877 INFO (main) [BOOT] JVM arguments = [... -Xmx256m, -XX:+ExitOnOutOfMemoryError, -XX:MetaspaceSize=32m, -XX:MaxMetaspaceSize=96m, ... ]

NEW
2024-05-30 09:20:53,665 INFO (main) [BOOT] JVM arguments = [... -XX:MaxRAMPercentage=50.0, -XX:+UseParallelGC, -XX:MinHeapFreeRatio=10, -XX:MaxHeapFreeRatio=20, -XX:GCTimeRatio=4, -XX:AdaptiveSizePolicyWeight=90, -XX:+ExitOnOutOfMemoryError, ... ]

Full lists

OLD
2024-05-30 08:47:19,866 INFO (main) [BOOT] JVM OpenJDK 64-Bit Server VM Red Hat, Inc. 21.0.3+9-LTS
2024-05-30 08:47:19,877 INFO (main) [BOOT] JVM arguments = [-server, --add-exports, java.naming/com.sun.jndi.ldap=ALL-UNNAMED, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.base/java.util.concurrent=ALL-UNNAMED, -Xlog:gc*:file=/opt/infinispan/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Djgroups.dns.query=infinispan-ping.default.svc.cluster.local, -Xmx256m, -XX:+ExitOnOutOfMemoryError, -XX:MetaspaceSize=32m, -XX:MaxMetaspaceSize=96m, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.infinispan.server.loader.LogManager, -Dinfinispan.server.home.path=/opt/infinispan, -classpath, :/opt/infinispan/boot/infinispan-server-runtime-15.0.4.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap, --cluster-name=infinispan, --server-config=/etc/config/infinispan.yml, --logging-config=/etc/config/log4j2.xml, --bind-address=0.0.0.0]

NEW
2024-05-30 09:20:53,587 INFO (main) [BOOT] JVM OpenJDK 64-Bit Server VM Red Hat, Inc. 21.0.3+9-LTS
2024-05-30 09:20:53,665 INFO (main) [BOOT] JVM arguments = [-server, --add-exports, java.naming/com.sun.jndi.ldap=ALL-UNNAMED, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.base/java.util.concurrent=ALL-UNNAMED, -Xlog:gc*:file=/opt/infinispan/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Djgroups.dns.query=infinispan-ping.default.svc.cluster.local, -XX:MaxRAMPercentage=50.0, -XX:+UseParallelGC, -XX:MinHeapFreeRatio=10, -XX:MaxHeapFreeRatio=20, -XX:GCTimeRatio=4, -XX:AdaptiveSizePolicyWeight=90, -XX:+ExitOnOutOfMemoryError, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.infinispan.server.loader.LogManager, -Dinfinispan.server.home.path=/opt/infinispan, -classpath, :/opt/infinispan/boot/infinispan-server-runtime-15.0.4.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap, --cluster-name=infinispan, --server-config=/etc/config/infinispan.yml, --logging-config=/etc/config/log4j2.xml, --bind-address=0.0.0.0]

@rigazilla
Copy link
Contributor Author

extra java options are added at the end of the jvm args so user can override defaults

extraJvmOpts: "-XX:MaxRAMPercentage=75.0"

OLD
JVM arguments = [-server, --add-exports, java.naming/com.sun.jndi.ldap=ALL-UNNAMED, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.base/java.util.concurrent=ALL-UNNAMED, -Xlog:gc*:file=/opt/infinispan/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Djgroups.dns.query=infinispan-ping.default.svc.cluster.local, -XX:MaxRAMPercentage=75.0, -Xmx256m, -XX:+ExitOnOutOfMemoryError, -XX:MetaspaceSize=32m, -XX:MaxMetaspaceSize=96m, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.infinispan.server.loader.LogManager, -Dinfinispan.server.home.path=/opt/infinispan, -classpath, :/opt/infinispan/boot/infinispan-server-runtime-15.0.4.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap, --cluster-name=infinispan, --server-config=/etc/config/infinispan.yml, --logging-config=/etc/config/log4j2.xml, --bind-address=0.0.0.0]

NEW
VM arguments = [-server, --add-exports, java.naming/com.sun.jndi.ldap=ALL-UNNAMED, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.base/java.util.concurrent=ALL-UNNAMED, -Xlog:gc*:file=/opt/infinispan/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Djgroups.dns.query=infinispan-ping.default.svc.cluster.local, -XX:MaxRAMPercentage=50.0, -XX:+UseParallelGC, -XX:MinHeapFreeRatio=10, -XX:MaxHeapFreeRatio=20, -XX:GCTimeRatio=4, -XX:AdaptiveSizePolicyWeight=90, -XX:+ExitOnOutOfMemoryError, -XX:MaxRAMPercentage=75.0, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.infinispan.server.loader.LogManager, -Dinfinispan.server.home.path=/opt/infinispan, -classpath, :/opt/infinispan/boot/infinispan-server-runtime-15.0.4.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap, --cluster-name=infinispan, --server-config=/etc/config/infinispan.yml, --logging-config=/etc/config/log4j2.xml, --bind-address=0.0.0.0]

@rigazilla rigazilla marked this pull request as ready for review May 30, 2024 13:13
Copy link
Collaborator

@ryanemerson ryanemerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bunch of JAVA_ env variables in the image descriptor files that are no longer valid. I think we need to remove them as part of this PR.

if [ -z "${CONTAINER_MAX_MEMORY:-}" ]; then
return
fi
source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this script provide us?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it provides logging facilities in case of debugging

# This has forked (and diverged) from:
# at https://github.com/fabric8io/run-java-sh
#
# ==========================================================
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ported from the original script, I guess it can be removed from here

@rigazilla
Copy link
Contributor Author

@ryanemerson do you think are we ok with the new GC settings?
-XX:+UseParallelGC ... -XX:GCTimeRatio=4

@ryanemerson
Copy link
Collaborator

do you think are we ok with the new GC settings?
-XX:+UseParallelGC ... -XX:GCTimeRatio=4

Ideally we would benchmark before changing the default. @wburns @jabolina have we done any comparisons of GCs with the new benchmark?

Copy link

@Crumby Crumby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rigazilla There are some minor spacing issues in the PR and outdated JAVA vars in server-openjdk.yaml including JAVA_MAX_MEMORY_RATIO defaulting to 50%. That default has been changed for UBI9 OpenJDKs to 80% and I wonder if should let the default default to overtake for consistency.

I also wonder what documentation changes are required with this PR. If any.

if [ -n "${DEBUG:-}" ]; then
set -x
set -x
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect spacing

init_limit_env_vars
# Echo options, trimming trailing and multiple spaces
echo "${JAVA_OPTIONS:-} $(calc_init_memory) $(calc_max_memory) $(diagnostics_options) $(gc_options)" | awk '$1=$1'
get_java_options
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect spacing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants