This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/main by this push:
new 8d56cffd62 Bump default JVM heap and add OOM diagnostics (#2044)
8d56cffd62 is described below
commit 8d56cffd625f4fc5b28a603ab7ce2b233059571b
Author: JB Onofré <[email protected]>
AuthorDate: Tue Jul 21 18:32:51 2026 +0200
Bump default JVM heap and add OOM diagnostics (#2044)
* Bump default JVM heap and add OOM diagnostics
Raise the shipped default heap from -Xms64M/-Xmx1G to -Xms512M/-Xmx2G
which is more representative of a production broker workload while
still leaving headroom on small hosts (override via ACTIVEMQ_OPTS_MEMORY).
Add ACTIVEMQ_OOM_OPTS with -XX:+ExitOnOutOfMemoryError so that an
OutOfMemoryError terminates the JVM instead of leaving the broker running
in a degraded state.
Heap dump on OOM is disabled by default to avoid unexpected disk usage
when large heap sizes are configured. Users can opt in by uncommenting
the ACTIVEMQ_OOM_DUMP_OPTS lines in bin/setenv (or bin/activemq for the
no-setenv fallback). The commented template includes -XX:HeapDumpGzipLevel=6
(JDK 17+) to compress the dump.
* Keep Xms at 64M; only bump Xmx to 2G
Per mattrpav's review feedback: setting -Xms512M by default would be
misconstrued as a high baseline memory requirement. Keep the initial
heap at the original 64M so the JVM starts small and grows on demand,
while still raising the ceiling to 2G.
---
assembly/src/release/bin/activemq | 8 +++++++-
assembly/src/release/bin/setenv | 15 +++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/assembly/src/release/bin/activemq
b/assembly/src/release/bin/activemq
index 9aa1eeeeb1..acb42f90c6 100755
--- a/assembly/src/release/bin/activemq
+++ b/assembly/src/release/bin/activemq
@@ -198,8 +198,14 @@ if [ "$CONFIG_LOAD" != "yes" ];then
echo
fi
+if [ -z "$ACTIVEMQ_OOM_OPTS" ] ; then
+ ACTIVEMQ_OOM_OPTS="-XX:+ExitOnOutOfMemoryError"
+ #ACTIVEMQ_OOM_DUMP_OPTS="-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=\"$ACTIVEMQ_DATA\" -XX:HeapDumpGzipLevel=6"
+ #ACTIVEMQ_OOM_OPTS="$ACTIVEMQ_OOM_OPTS $ACTIVEMQ_OOM_DUMP_OPTS"
+fi
+
if [ -z "$ACTIVEMQ_OPTS" ] ; then
- ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY
-Djava.util.logging.config.file=logging.properties
-Djava.security.auth.login.config=\"$ACTIVEMQ_CONF\"/login.config"
+ ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY $ACTIVEMQ_OOM_OPTS
-Djava.util.logging.config.file=logging.properties
-Djava.security.auth.login.config=\"$ACTIVEMQ_CONF\"/login.config"
fi
diff --git a/assembly/src/release/bin/setenv b/assembly/src/release/bin/setenv
index 799b640bc4..2442f899f3 100644
--- a/assembly/src/release/bin/setenv
+++ b/assembly/src/release/bin/setenv
@@ -31,10 +31,21 @@
# Set jvm memory configuration (minimal/maximum amount of memory)
if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
- ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
+ ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx2G"
fi
+
+# Terminate the JVM on OutOfMemoryError so the broker is not left running in a
degraded state.
+# Heap dump on OOM is disabled by default to avoid unexpected disk usage
(especially with large
+# heap sizes). Uncomment ACTIVEMQ_OOM_DUMP_OPTS to enable heap dumps;
-XX:HeapDumpGzipLevel=6
+# requires JDK 17+.
+if [ -z "$ACTIVEMQ_OOM_OPTS" ] ; then
+ ACTIVEMQ_OOM_OPTS="-XX:+ExitOnOutOfMemoryError"
+ #ACTIVEMQ_OOM_DUMP_OPTS="-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=$ACTIVEMQ_DATA -XX:HeapDumpGzipLevel=6"
+ #ACTIVEMQ_OOM_OPTS="$ACTIVEMQ_OOM_OPTS $ACTIVEMQ_OOM_DUMP_OPTS"
+fi
+
if [ -z "$ACTIVEMQ_OPTS" ] ; then
- ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY
-Djava.util.logging.config.file=logging.properties
-Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
+ ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY $ACTIVEMQ_OOM_OPTS
-Djava.util.logging.config.file=logging.properties
-Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
fi
if [ -z "$ACTIVEMQ_OUT" ]; then
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact