Bump default JVM heap and add OOM diagnostics#2044
Conversation
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:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=$ACTIVEMQ_DATA and -XX:+ExitOnOutOfMemoryError so that an OutOfMemoryError produces a heap dump for postmortem and the JVM terminates instead of lingering in a degraded state. The same defaults are wired into the fallback in bin/activemq for the case where setenv is missing.
|
@cshannon I propose to update the default configuration like this. |
|
Hmm, I think this might need more discussion. I think the 2GB default is good but I don't know about the OOM heap dump as that will cause unexpected output to a file system for users. I think that needs to be configurable on set up maybe. We could bring it up for discussion on the dev list. |
|
@cshannon yes, I can add a optional flag to setup OOM. I'm just sharing my experience: I have to ask more of the ActiveMQ users to enable it it to investigate 😄 So having a way to enable it by default would be good (or at least documented). |
That sounds good, I personally set that flag myself so I am fine with it but I figure someone might not want the extra output. |
|
+1 to have a preconfigured but commented out set of options. Having it on by default can quickly lead to disk space usage issues -- there is also a 'where to write the files' problem |
-Xms64M -Xmx1Gto-Xms512M -Xmx2Ginassembly/src/release/bin/setenv. The previous default is undersized for a production broker; the new value is still modest and remains overridable viaACTIVEMQ_OPTS_MEMORY.ACTIVEMQ_OOM_OPTSvariable defaulting to-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$ACTIVEMQ_DATA -XX:+ExitOnOutOfMemoryErrorso that anOutOfMemoryErrorproduces a heap dump under the broker data directory and the JVM terminates rather than continuing in a degraded state.ACTIVEMQ_OOM_OPTSfallback insideassembly/src/release/bin/activemqso the diagnostics still apply ifsetenvis absent.Both new variables remain overridable from the environment or from any of the higher-priority configuration files (
/etc/default/activemq,~/.activemqrc,bin/setenv).