Menu Search

9.6. Flow to Disk

Flow to disk limits the amount of direct memory that can be occupied by messages. Once this limit is reached any new 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.

By default the Broker makes 40% 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.

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 40% available for messages. The first queue will have a target size of 170MB and the second 230MB. Once 400MB 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 400MB.

Flow to disk is configured by Broker context variable broker.flowToDiskThreshold. It is expressed as a size in bytes and defaults to 40% of the JVM maximum heap size.

Periodically, the log message VHT-1008 will be issued if messages are newly flowed to disk indicating the total amount of bytes evacuated from memory during the lifetime of the VirtualHost.