Author: jmesnil
Date: 2009-10-13 10:28:25 -0400 (Tue, 13 Oct 2009)
New Revision: 8092
Modified:
trunk/docs/user-manual/en/configuration-index.xml
trunk/docs/user-manual/en/perf-tuning.xml
trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-164: Allow MemoryManager to be disabled
* allowed memory-measure-interval to set to -1 to disable MemoryManager
* added documentation for memory-measure-interval & memory-warning-threshold in
configuration
index + memory settings chapter
Modified: trunk/docs/user-manual/en/configuration-index.xml
===================================================================
--- trunk/docs/user-manual/en/configuration-index.xml 2009-10-13 13:01:11 UTC (rev 8091)
+++ trunk/docs/user-manual/en/configuration-index.xml 2009-10-13 14:28:25 UTC (rev 8092)
@@ -394,6 +394,20 @@
<entry>true</entry>
</row>
<row>
+ <entry><link linkend="perf-tuning.memory"
+ >memory-measure-interval</link></entry>
+ <entry>Long</entry>
+ <entry>frequency to sample JVM memory in ms (or -1 to
disable memory sampling)</entry>
+ <entry>30000</entry>
+ </row>
+ <row>
+ <entry><link linkend="perf-tuning.memory"
+ >memory-warning-threshold</link></entry>
+ <entry>Integer</entry>
+ <entry>Percentage of available memory which threshold a
warning log</entry>
+ <entry>25</entry>
+ </row>
+ <row>
<entry><link
linkend="configuring-transports.acceptors"
acceptors</link></entry>
<entry>Acceptor</entry>
Modified: trunk/docs/user-manual/en/perf-tuning.xml
===================================================================
--- trunk/docs/user-manual/en/perf-tuning.xml 2009-10-13 13:01:11 UTC (rev 8091)
+++ trunk/docs/user-manual/en/perf-tuning.xml 2009-10-13 14:28:25 UTC (rev 8092)
@@ -193,7 +193,7 @@
garbage collection algorithm, e.g. using the JVM argument
<literal
-XX:+UseParallelGC</literal> on Sun JDKs.</para>
</listitem>
- <listitem>
+ <listitem id="perf-tuning.memory">
<para>Memory settings. Give as much memory as you can to the
server. HornetQ can run
in low memory by using paging (described in <xref
linkend="paging"/>) but if it
can run with all queues in RAM this will improve performance. The
amount of
@@ -201,6 +201,13 @@
size and number of your messages. Use the JVM arguments
<literal>-Xms</literal>
and <literal>-Xmx</literal> to set server available RAM.
We recommend setting
them to the same high value.</para>
+ <para>HornetQ will regularly sample JVM memory and reports if the
available memory is below
+ a configurable threshold. Use this information to properly set JVM
memory and paging.
+ The sample frequency can be configured by setting
<literal>memory-measure-interval</literal>
+ in <literal>hornetq-configuration.xml</literal> (default
is 30000ms, set it to -1 to disable
+ memory sampling). When the available memory goes below the configured
threshold, a warning is logged.
+ The threshold can be configured by setting
<literal>memory-warning-threshold</literal> in
+ <literal>hornetq-configuration.xml</literal> (default is
25%).</para>
</listitem>
<listitem>
<para>Aggressive options. Different JVMs provide different sets of
JVM tuning
@@ -256,7 +263,7 @@
Instead the temporary queue should be re-used for many
requests.</para>
</listitem>
<listitem>
- <para>Don't use Mesage Driven Beans for the sake of it. As soon
as you start using MDBs you are greatly
+ <para>Don't use Message-Driven Beans for the sake of it. As
soon as you start using MDBs you are greatly
increasing the codepath for each message received compared to a
straightforward message consumer, since a lot of
extra application server code is executed. Ask yourself
do you really need MDBs? Can you accomplish the same task using just a
normal message consumer?</para>
Modified: trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-13 13:01:11
UTC (rev 8091)
+++ trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-13 14:28:25
UTC (rev 8092)
@@ -332,7 +332,7 @@
memoryWarningThreshold = getInteger(e, "memory-warning-threshold",
memoryWarningThreshold, PERCENTAGE);
- memoryMeasureInterval = getLong(e, "memory-measure-interval",
memoryMeasureInterval, GT_ZERO); // in milliseconds
+ memoryMeasureInterval = getLong(e, "memory-measure-interval",
memoryMeasureInterval, MINUS_ONE_OR_GT_ZERO); // in milliseconds
started = true;
}
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-13 13:01:11
UTC (rev 8091)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-13 14:28:25
UTC (rev 8092)
@@ -389,8 +389,11 @@
pagingManager.stop();
}
- memoryManager.stop();
-
+ if (memoryManager != null)
+ {
+ memoryManager.stop();
+ }
+
pagingManager = null;
securityStore = null;
resourceManager = null;
@@ -938,10 +941,13 @@
scheduledPool,
managementConnectorID);
- memoryManager = new MemoryManagerImpl(configuration.getMemoryWarningThreshold(),
- configuration.getMemoryMeasureInterval());
+ if (configuration.getMemoryMeasureInterval() != -1)
+ {
+ memoryManager = new
MemoryManagerImpl(configuration.getMemoryWarningThreshold(),
+
configuration.getMemoryMeasureInterval());
- memoryManager.start();
+ memoryManager.start();
+ }
}
private void initialiseLogging()