Sun Java System Message Queue 3.7 UR1 Administration Guide

Compacting Physical Destinations

If you are using a file-based data store as the persistent store for messages, you can monitor disk utilization and compact the disk when necessary.

The file-based message store is structured so that messages are stored in directories corresponding to the physical destinations in which they are being held. In each physical destination’s directory, most messages are stored in one file consisting of variable-sized records. (To alleviate fragmentation, messages whose size exceeds a configurable threshold are stored in their own individual files.)

As messages of varying sizes are persisted and then removed from the record file, holes may develop in the file where free records are not being re-used.

To manage unused free records, the Command utility includes subcommands for monitoring disk utilization per physical destination and for reclaiming free disk space when utilization drops.

Monitoring a Physical Destination’s Disk Utilization

To monitor a physical destination’s disk utilization, use a command like the following:

imqcmd metrics dst -t q -n myQueue -m dsk -u admin

This command produces output like the following:

Reserved   Used      Utilization Ratio
806400     804096    99
1793024    1793024   100
2544640    2518272   98

The columns in the subcommand output have the following meaning:

Table 6–2 Physical Destination Disk Utilization Metrics




Disk space in bytes used by all records, including records that hold active messages and free records waiting to be reused. 


Disk space in bytes used by records that hold active messages. 

Utilization Ratio

Quotient of used disk space divided by reserved disk space. The higher the ratio, the more the disk space is being used to hold active messages.

Reclaiming Unused Physical Destination Disk Space

The disk utilization pattern depends on the characteristics of the messaging application that uses a particular physical destination. Depending on the relative flow of messages into and out of a physical destination, and the relative size of messages, the reserved disk space might grow over time.

If the message producing rate is greater than the message consuming rate, free records should generally be reused and the utilization ratio should be on the high side. However, if the message producing rate is similar to or smaller than the message consuming rate, you can expect that the utilization ratio will be low.

In general, you want the reserved disk space to stabilize and the utilization to remain high. As a rule, if the system reaches a steady state in which the amount of reserved disk space generally stays constant and utilization rate is high (above 75%), there is no need to reclaim the unused disk space. If the system reaches a steady state and utilization rate is low (below 50%), you can compact the disk to reclaim the disk space occupied by free records.

Use the compact dst subcommand to compact the data store. This is the syntax for the compact dst subcommand:

compact dst [-t destType -n 

The subcommand compacts the file-based data store for the physical destination of the specified type and name. If no destination type and name are specified, all destinations are compacted. Physical destinations must be paused before they can be compacted.

If the reserved disk space continues to increase over time, reconfigure the destination’s memory management by setting destination memory limit properties and limit behaviors (see Table 15–1).

ProcedureTo Reclaim Unused Physical Destination Disk Space

  1. Pause the destination.

    imqcmd pause dst -t q -n myQueue -u admin
  2. Compact the disk.

    imqcmd compact dst -t q -n myQueue -u admin
  3. Resume the physical destination.

    imqcmd resume dst -t q -n myQueue -u admin

    If destination type and name are not specified, these operations are performed for all physical destinations.