Chapter 23. Paging

In such a situation it's not possible to store all of the queues in memory at any one
time, so JBoss Messaging transparently pages messages into and out of
memory as they are needed, thus allowing massive queues with a low memory footprint.

JBoss Messaging will start paging messages to disk, when either a) the size of the queue
reaches a total configured maximum size or b) The total size of all queues reaches a
configured maximum size.

23.1. Page Files

Messages are stored per address on the file system. Each address has an individual
folder where messages are stored in multiple files (page files). Each file will contain
messages up to a max configured size. (page-size-bytes). When reading
page-files all messages on the page-file are read, routed and the file is deleted as
soon as the messages are recovered.

23.2. Global Paging Mode

JBoss Messaging goes into global paging mode when the total memory used by all queues
reaches a configured maximum value, determined by paging-max-global-size-bytes.

These messages are depaged back into memory once enough memory (global-page-size) has been freed up.

23.2.1. Configuration

Global paging parameters are specified on the main configuration file.

What's the max memory the address could have before entering
on page mode.

-1 (disabled)

page-size-bytes

The size of each page file used on the paging system

10MiB (10 * 1024 * 1024 bytes)

drop-messages-when-full

if true, messages are dropped instead of paged when used-memory is greater than max-size

false

23.4. Caution with Addresses with Multiple Queues

When a message is routed to an address that has multiple queues bound to it, e.g. a
JMS subscription, there is only 1 copy of the message in memory. Each queue only deals
with a reference to this. Because of this the memory is only freed up once all queues
referencing the message have delivered it. This means that if not all queues deliver the
message we can end up in a state where messages to not get delivered.

For example:

An address has 10 queues

One of the queues does not deliver its messages (maybe because of a slow
consumer).

Messages continually arrive at the address and paging is started.

The other 9 queues are empty even though messages have been sent.

In this example we have to wait until the last queue has delivered some of its
messages before we depage and the other queues finally receive some more
messages.