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.
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
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 destName]
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).
Pause the destination.
imqcmd pause dst -t q -n myQueue -u admin |
Compact the disk.
imqcmd compact dst -t q -n myQueue -u admin |
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.