<div class="docbook"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">9.6. Flow to Disk</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="Java-Broker-Runtime-Close-Connection-When-No-Route.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Runtime</th><td width="20%" align="right"> <a accesskey="n" href="Java-Broker-Runtime-Consumers.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Java-Broker-Runtime-Flow-To-Disk"></a>9.6. Flow to Disk</h2></div></div></div><p>Flow to disk limits the amount of <a class="link" href="Java-Broker-Runtime-Memory.html" title="9.11. Memory">direct and heap memory</a> | |
that can be occupied by messages. Once this | |
limit is reached any new transient messages and all existing transient messages will be | |
transferred to disk. Newly arriving transient messages will continue to go to the disk until the | |
cumulative size of all messages falls below the limit once again.</p><p>By default the Broker makes 75% of the max direct available memory for messages. This memory is | |
divided between all the queues across all virtual hosts defined on the Broker with a percentage | |
calculated according to their current queue size. These calculations are refreshed periodically | |
by the housekeeping cycle.</p><p>For example if there are two queues, one containing 75MB and the second 100MB messages | |
respectively and the Broker has 1GB direct memory with the default of 75% available for messages. | |
The first queue will have a target size of 320MB and the second 430MB. Once 750MB is taken by | |
messages, messages will begin to flow to disk. New messages will cease to flow to disk when | |
their cumulative size falls beneath 750MB.</p><p>Flow to disk is configured by Broker context variable | |
<code class="literal">broker.flowToDiskThreshold</code>. It is expressed as a size in bytes and defaults | |
to 75% of the JVM maximum heap size.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Flow-To-Disk-Monitoring"></a>9.6.1. Flow to Disk Monitoring</h3></div></div></div><p>A number of statistics attributes are available on the <code class="literal">Broker</code> to allow monitoring | |
of the amount of utilized direct memory by the enqueued messages. | |
</p><p>The total amount of allocated direct memory by the <code class="literal">Broker</code> can be determined by | |
checking <code class="literal">Broker</code> statistics <code class="literal">usedDirectMemorySize</code>. There is another | |
<code class="literal">Broker</code> level statistics <code class="literal">directMemoryTotalCapacity</code> to get the total amount | |
of allocated direct memory. Usually, the values reported by both statistics attributes | |
<code class="literal">usedDirectMemorySize</code> and <code class="literal">directMemoryTotalCapacity</code> are the same | |
or do not differ much. | |
</p><p>The direct memory consumed by the <code class="literal">VirtualHost</code> messages is reported as | |
<code class="literal">VirtualHost</code> statistics <code class="literal">inMemoryMessageSize</code>. The current value of | |
<code class="literal">VirtualHost</code> direct memory threshold is exposed with statistics attribute | |
<code class="literal">inMemoryMessageThreshold</code>. When the value of <code class="literal">inMemoryMessageSize</code> is | |
greater than <code class="literal">inMemoryMessageThreshold</code>, the flow to disk is triggered to bring the amount of | |
direct memory consumed by the <code class="literal">VirtualHost</code> messages in-line with the | |
<code class="literal">inMemoryMessageThreshold</code>. | |
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Flow-To-Disk-Logging"></a>9.6.2. Flow to Disk Logging</h3></div></div></div><p>The <code class="literal">Flow to Disk</code> events are not reported as operational logs or | |
<code class="literal">INFO</code> logs due to quite frequent triggering of <code class="literal">Flow to Disk</code> | |
for messaging use cases requiring holding messages on the <code class="literal">Broker</code> side for some time. | |
As result, the <code class="literal">Flow to Disk</code> logs can quickly dominate the broker logs and cause unnecessary | |
disk consumption. | |
</p><p>Though, if required, the <code class="literal">Flow to Disk</code> DEBUG logs can be enabled by adding | |
the following logging rule into the corresponding <code class="literal">Broker</code> logger. | |
</p><div class="example"><a id="d0e9203"></a><p class="title"><strong>Example 9.1. Flow to Disk logging rule</strong></p><div class="example-contents"><pre class="programlisting"> | |
{ | |
"name" : "DirectMemory", | |
"type" : "NameAndLevel", | |
"level" : "DEBUG", | |
"loggerName" : "org.apache.qpid.server.directMemory.*" | |
} | |
</pre></div></div><p><br class="example-break" /> | |
</p><p>Please note, that the logger <code class="literal">org.apache.qpid.server.directMemory.broker</code> | |
is used by the <code class="literal">Broker</code> to report conditions when direct memory utilization exceeds the pred-defined | |
<code class="literal">Broker</code> threshold, whilst the logger <code class="literal">org.apache.qpid.server.directMemory.virtualhost</code> | |
is used to report conditions when direct memory utilization by the <code class="literal">VirtualHost</code> | |
messages exceeds the current value of the <code class="literal">VirtualHost</code> threshold. | |
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="Java-Broker-Runtime-Close-Connection-When-No-Route.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="Java-Broker-Runtime.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="Java-Broker-Runtime-Consumers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.5. Closing client connections on unroutable mandatory messages </td><td width="20%" align="center"><a accesskey="h" href="Apache-Qpid-Broker-J-Book.html">Home</a></td><td width="40%" align="right" valign="top"> 9.7. Consumers</td></tr></table></div></div> |